cytoscape

package
v1.18.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package cytoscape provides conversion from our graph to the CystoscapeJS configuration json model.

The following links are useful for understanding CytoscapeJS and it's configuration:

Main page: http://js.cytoscape.org/ JSON config: http://js.cytoscape.org/#notation/elements-json Demos: http://js.cytoscape.org/#demos

Algorithm: Process the graph structure adding nodes and edges, decorating each

with information provided.  An optional second pass generates compound
nodes for version grouping.

The package provides the Cytoscape implementation of graph/ConfigVendor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Timestamp int64    `json:"timestamp"`
	Duration  int64    `json:"duration"`
	GraphType string   `json:"graphType"`
	Elements  Elements `json:"elements"`
}

func NewConfig

func NewConfig(trafficMap graph.TrafficMap, o graph.ConfigOptions) (result Config)

NewConfig is required by the graph/ConfigVendor interface

type EdgeData

type EdgeData struct {
	// Cytoscape Fields
	Id     string `json:"id"`     // unique internal edge ID (e0, e1...)
	Source string `json:"source"` // parent node ID
	Target string `json:"target"` // child node ID

	// App Fields (not required by Cytoscape)
	Traffic      ProtocolTraffic `json:"traffic,omitempty"`      // traffic rates for the edge protocol
	ResponseTime string          `json:"responseTime,omitempty"` // in millis
	IsMTLS       string          `json:"isMTLS,omitempty"`       // set to the percentage of traffic using a mutual TLS connection
}

type EdgeWrapper

type EdgeWrapper struct {
	Data *EdgeData `json:"data"`
}

type Elements

type Elements struct {
	Nodes []*NodeWrapper `json:"nodes"`
	Edges []*EdgeWrapper `json:"edges"`
}

type NodeData

type NodeData struct {
	// Cytoscape Fields
	Id     string `json:"id"`               // unique internal node ID (n0, n1...)
	Parent string `json:"parent,omitempty"` // Compound Node parent ID

	// App Fields (not required by Cytoscape)
	NodeType        string              `json:"nodeType"`
	Namespace       string              `json:"namespace"`
	Workload        string              `json:"workload,omitempty"`
	App             string              `json:"app,omitempty"`
	Version         string              `json:"version,omitempty"`
	Service         string              `json:"service,omitempty"`         // requested service for NodeTypeService
	DestServices    []graph.ServiceName `json:"destServices,omitempty"`    // requested services for [dest] node
	Traffic         []ProtocolTraffic   `json:"traffic,omitempty"`         // traffic rates for all detected protocols
	HasCB           bool                `json:"hasCB,omitempty"`           // true (has circuit breaker) | false
	HasMissingSC    bool                `json:"hasMissingSC,omitempty"`    // true (has missing sidecar) | false
	HasVS           bool                `json:"hasVS,omitempty"`           // true (has route rule) | false
	IsDead          bool                `json:"isDead,omitempty"`          // true (has no pods) | false
	IsGroup         string              `json:"isGroup,omitempty"`         // set to the grouping type, current values: [ 'app', 'version' ]
	IsInaccessible  bool                `json:"isInaccessible,omitempty"`  // true if the node exists in an inaccessible namespace
	IsMisconfigured string              `json:"isMisconfigured,omitempty"` // set to misconfiguration list, current values: [ 'labels' ]
	IsOutside       bool                `json:"isOutside,omitempty"`       // true | false
	IsRoot          bool                `json:"isRoot,omitempty"`          // true | false
	IsServiceEntry  string              `json:"isServiceEntry,omitempty"`  // set to the location, current values: [ 'MESH_EXTERNAL', 'MESH_INTERNAL' ]
	IsUnused        bool                `json:"isUnused,omitempty"`        // true | false
}

type NodeWrapper

type NodeWrapper struct {
	Data *NodeData `json:"data"`
}

type ProtocolTraffic

type ProtocolTraffic struct {
	Protocol  string            `json:"protocol,omitempty"`  // protocol
	Rates     map[string]string `json:"rates,omitempty"`     // map[rate]value
	Responses Responses         `json:"responses,omitempty"` // see comment above
}

ProtocolTraffic supplies all of the traffic information for a single protocol

type ResponseDetail added in v1.6.0

type ResponseDetail struct {
	Flags ResponseFlags `json:"flags,omitempty"`
	Hosts ResponseHosts `json:"hosts,omitempty"`
}

ResponseDetail holds information broken down by response code.

type ResponseFlags

type ResponseFlags map[string]string

ResponseFlags is a map of maps. Each response code is broken down by responseFlags:percentageOfTraffic, e.g.:

"200" : {
   "-"     : "80.0",
   "DC"    : "10.0",
   "FI,FD" : "10.0"
}, ...

type ResponseHosts added in v1.6.0

type ResponseHosts map[string]string

ResponseHosts is a map of maps. Each response host is broken down by responseFlags:percentageOfTraffic, e.g.:

"200" : {
   "www.google.com" : "80.0",
   "www.yahoo.com"  : "20.0"
}, ...

type Responses

type Responses map[string]*ResponseDetail

Responses maps responseCodes to detailed information for that code

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL