cytoscape

package
v1.57.16 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 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
	Throughput      string          `json:"throughput,omitempty"`      // in bytes/sec (request or response, depends on client request)
	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 GWInfo added in v1.38.1

type GWInfo struct {
	// IngressInfo contains the resolved gateway configuration if the node represents an Istio ingress gateway
	IngressInfo GWInfoIngress `json:"ingressInfo,omitempty"`
	// EgressInfo contains the resolved gateway configuration if the node represents an Istio egress gateway
	EgressInfo GWInfoIngress `json:"egressInfo,omitempty"`
	// GatewayAPIInfo contains the resolved gateway configuration if the node represents a Gateway API gateway
	GatewayAPIInfo GWInfoIngress `json:"gatewayAPIInfo,omitempty"`
}

GWInfo contains the resolved gateway configuration if the node represents an Istio gateway

type GWInfoIngress added in v1.38.1

type GWInfoIngress struct {
	// Hostnames is the list of hosts being served by the associated Istio gateways.
	Hostnames []string `json:"hostnames,omitempty"`
}

GWInfoIngress contains the resolved gateway configuration if the node represents an Istio ingress gateway

type HealthConfig added in v1.30.0

type HealthConfig map[string]string

HealthConfig maps annotations information for health

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
	Labels                map[string]string   `json:"labels,omitempty"`                // k8s labels associated with the node
	Traffic               []ProtocolTraffic   `json:"traffic,omitempty"`               // traffic rates for all detected protocols
	HealthData            interface{}         `json:"healthData"`                      // data to calculate health status from configurations
	HealthDataApp         interface{}         `json:"-"`                               // for local use to generate appBox health
	HasCB                 bool                `json:"hasCB,omitempty"`                 // true (has circuit breaker) | false
	HasFaultInjection     bool                `json:"hasFaultInjection,omitempty"`     // true (vs has fault injection) | false
	HasHealthConfig       HealthConfig        `json:"hasHealthConfig,omitempty"`       // set to the health config override
	HasMirroring          bool                `json:"hasMirroring,omitempty"`          // true (has mirroring) | false
	HasMissingSC          bool                `json:"hasMissingSC,omitempty"`          // true (has missing sidecar) | false
	HasRequestRouting     bool                `json:"hasRequestRouting,omitempty"`     // true (vs has request routing) | false
	HasRequestTimeout     bool                `json:"hasRequestTimeout,omitempty"`     // true (vs has request timeout) | false
	HasTCPTrafficShifting bool                `json:"hasTCPTrafficShifting,omitempty"` // true (vs has tcp traffic shifting) | false
	HasTrafficShifting    bool                `json:"hasTrafficShifting,omitempty"`    // true (vs has traffic shifting) | false
	HasVS                 *VSInfo             `json:"hasVS,omitempty"`                 // it can be empty if there is a VS without hostnames
	HasWorkloadEntry      []graph.WEInfo      `json:"hasWorkloadEntry,omitempty"`      // static workload entry information | empty if there are no workload entries
	IsBox                 string              `json:"isBox,omitempty"`                 // set for NodeTypeBox, current values: [ 'app', 'cluster', 'namespace' ]
	IsDead                bool                `json:"isDead,omitempty"`                // true (has no pods) | false
	IsGateway             *GWInfo             `json:"isGateway,omitempty"`             // Istio ingress/egress gateway information
	IsIdle                bool                `json:"isIdle,omitempty"`                // true | false
	IsInaccessible        bool                `json:"isInaccessible,omitempty"`        // true if the node exists in an inaccessible namespace
	IsOutside             bool                `json:"isOutside,omitempty"`             // true | false
	IsRoot                bool                `json:"isRoot,omitempty"`                // true | false
	IsServiceEntry        *graph.SEInfo       `json:"isServiceEntry,omitempty"`        // set static service entry information
}

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

type VSInfo added in v1.38.1

type VSInfo struct {
	// Hostnames is the list of hostnames configured in the associated VSs
	Hostnames []string `json:"hostnames,omitempty"`
}

VSInfo contains the resolved VS configuration if the node has a VS attached.

Jump to

Keyboard shortcuts

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