cytoscape

package
v1.29.2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: Apache-2.0 Imports: 5 Imported by: 7

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 requested boxing.

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)
	DestPrincipal   string          `json:"destPrincipal,omitempty"`   // principal used for the edge destination
	IsMTLS          string          `json:"isMTLS,omitempty"`          // set to the percentage of traffic using a mutual TLS connection
	ResponseTime    string          `json:"responseTime,omitempty"`    // in millis
	SourcePrincipal string          `json:"sourcePrincipal,omitempty"` // principal used for the edge source
	Traffic         ProtocolTraffic `json:"traffic,omitempty"`         // traffic rates for the edge protocol
}

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"`
	Cluster         string              `json:"cluster"`
	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
	Aggregate       string              `json:"aggregate,omitempty"`       // set like "<aggregate>=<aggregateVal>"
	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
	IsBox           string              `json:"isBox,omitempty"`           // set for NodeTypeBox, current values: [ 'app', 'cluster', 'namespace' ]
	IsDead          bool                `json:"isDead,omitempty"`          // true (has no pods) | false
	IsIdle          bool                `json:"isIdle,omitempty"`          // true | false
	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' ]
}

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