Documentation ¶
Overview ¶
Graph package provides support for the graph handlers such as supported path variables and query params, as well as types for graph processing.
Index ¶
- Constants
- Variables
- func AddOutgoingEdgeToMetadata(sourceMetadata, edgeMetadata Metadata)
- func AddServiceGraphTraffic(toEdge, fromEdge *Edge)
- func AddToMetadata(protocol string, val float64, code, flags string, ...)
- func BadRequest(message string)
- func CheckError(err error)
- func Error(message string)
- func Forbidden(message string)
- func Id(...) (id, nodeType string)
- func IsOK(telemetryVal string) bool
- type Appender
- type AppenderGlobalInfo
- type AppenderNamespaceInfo
- type AppenderVendorInfo
- type CommonOptions
- type ConfigOptions
- type ConfigVendor
- type Edge
- type Metadata
- type MetadataKey
- type NamespaceInfo
- type Node
- type NodeOptions
- type Options
- type Protocol
- type Rate
- type RequestedAppenders
- type Response
- type ResponseFlags
- type Responses
- type Service
- type TelemetryOptions
- type TelemetryVendor
- type TrafficMap
Constants ¶
const ( VendorCytoscape string = "cytoscape" VendorIstio string = "istio" )
The supported vendors
const ( GroupByApp string = "app" GroupByNone string = "none" GroupByVersion string = "version" NamespaceIstio string = "istio-system" )
const ( GraphTypeApp string = "app" GraphTypeService string = "service" // Treated as graphType Workload, with service injection, and then condensed GraphTypeVersionedApp string = "versionedApp" GraphTypeWorkload string = "workload" NodeTypeApp string = "app" NodeTypeService string = "service" NodeTypeUnknown string = "unknown" // The special "unknown" traffic gen node NodeTypeWorkload string = "workload" TF string = "2006-01-02 15:04:05" // TF is the TimeFormat for timestamps Unknown string = "unknown" // Istio unknown label value )
Variables ¶
Protocols defines the supported protocols to be handled by the vendor code.
Functions ¶
func AddOutgoingEdgeToMetadata ¶ added in v0.14.0
func AddOutgoingEdgeToMetadata(sourceMetadata, edgeMetadata Metadata)
func AddServiceGraphTraffic ¶ added in v0.14.0
func AddServiceGraphTraffic(toEdge, fromEdge *Edge)
func AddToMetadata ¶ added in v0.14.0
func BadRequest ¶ added in v0.12.0
func BadRequest(message string)
BadRequest panics with BadRequest and the provided message
func CheckError ¶ added in v0.12.0
func CheckError(err error)
CheckError panics with the supplied error if it is non-nil
func Error ¶ added in v0.12.0
func Error(message string)
Error panics with InternalServerError and the provided message
func Forbidden ¶ added in v0.12.0
func Forbidden(message string)
Forbidden panics with Forbidden and the provided message
Types ¶
type Appender ¶ added in v0.21.0
type Appender interface { // AppendGraph performs the appender work on the provided traffic map. The map // may be initially empty. An appender is allowed to add or remove map entries. AppendGraph(trafficMap TrafficMap, globalInfo *AppenderGlobalInfo, namespaceInfo *AppenderNamespaceInfo) // Name returns a unique appender name and which is the name used to identify the appender (e.g in 'appenders' query param) Name() string }
Appender is implemented by any code offering to append a service graph with supplemental information. On error the appender should panic and it will be handled as an error response.
type AppenderGlobalInfo ¶ added in v0.21.0
type AppenderGlobalInfo struct { Business *business.Layer PromClient *prometheus.Client Vendor AppenderVendorInfo // telemetry vendor's global info }
AppenderGlobalInfo caches information relevant to a single graph. It allows an appender to populate the cache and then it, or another appender can re-use the information. A new instance is generated for graph and is initially empty.
func NewAppenderGlobalInfo ¶ added in v0.21.0
func NewAppenderGlobalInfo() *AppenderGlobalInfo
type AppenderNamespaceInfo ¶ added in v0.21.0
type AppenderNamespaceInfo struct { Namespace string // always provided Vendor AppenderVendorInfo // telemetry vendor's namespace info }
AppenderNamespaceInfo caches information relevant to a single namespace. It allows one appender to populate the cache and another to then re-use the information. A new instance is generated for each namespace of a single graph and is initially seeded with only Namespace.
func NewAppenderNamespaceInfo ¶ added in v0.21.0
func NewAppenderNamespaceInfo(namespace string) *AppenderNamespaceInfo
type AppenderVendorInfo ¶ added in v0.21.0
type AppenderVendorInfo map[string]interface{}
func NewAppenderVendorInfo ¶ added in v0.21.0
func NewAppenderVendorInfo() AppenderVendorInfo
type CommonOptions ¶ added in v0.21.0
type CommonOptions struct { Duration time.Duration GraphType string Params url.Values // make available the raw query params for vendor-specific handling QueryTime int64 // unix time in seconds }
CommonOptions are those supplied to Telemetry and Config Vendors
type ConfigOptions ¶ added in v0.21.0
type ConfigOptions struct { GroupBy string CommonOptions }
ConfigOptions are those supplied to Config Vendors
type ConfigVendor ¶ added in v0.21.0
type ConfigVendor interface { // NewConfig is required by the ConfigVendor interface. It must produce a valid // Config for the provided TrafficMap, It is recommended to use the graph/util.go // definitions for error handling. Refer to the Cytoscape implementation as an example. NewConfig(trafficMap TrafficMap, o ConfigOptions) interface{} }
ConfigVendor is an interface that must be satisfied for each config vendor implementation.
type Metadata ¶ added in v0.21.0
type Metadata map[MetadataKey]interface{}
Metadata is a map for storing node and edge metadata values reported by the vendors
func NewMetadata ¶ added in v0.21.0
func NewMetadata() Metadata
NewMetadata returns an empty Metadata map
type MetadataKey ¶ added in v0.21.0
type MetadataKey string
MetadataKey is a mnemonic type name for string
const ( DestServices MetadataKey = "destServices" HasCB MetadataKey = "hasCB" HasMissingSC MetadataKey = "hasMissingSC" HasVS MetadataKey = "hasVS" IsDead MetadataKey = "isDead" IsInaccessible MetadataKey = "isInaccessible" IsMisconfigured MetadataKey = "isMisconfigured" IsMTLS MetadataKey = "isMTLS" IsOutside MetadataKey = "isOutside" IsRoot MetadataKey = "isRoot" IsServiceEntry MetadataKey = "isServiceEntry" IsUnused MetadataKey = "isUnused" ProtocolKey MetadataKey = "protocol" ResponseTime MetadataKey = "responseTime" )
Metadata keys to be used instead of literal strings
type NamespaceInfo ¶ added in v0.9.1
type Node ¶ added in v0.6.0
type Node struct { ID string // unique identifier for the node NodeType string // Node type Namespace string // Namespace Workload string // Workload (deployment) name App string // Workload app label value Version string // Workload version label value Service string // Service name Edges []*Edge // child nodes Metadata Metadata // app-specific data }
func NewNodeExplicit ¶ added in v0.6.0
type NodeOptions ¶ added in v0.21.0
type NodeOptions struct { App string Namespace string Service string Version string Workload string }
NodeOptions are those that apply only to node-detail graphs
type Options ¶ added in v0.21.0
type Options struct { ConfigVendor string TelemetryVendor string ConfigOptions TelemetryOptions }
Options comprises all available options
func NewOptions ¶ added in v0.21.0
type Protocol ¶ added in v0.14.0
type Protocol struct { Name string EdgeRates []Rate EdgeResponses MetadataKey NodeRates []Rate Unit string UnitShort string }
Protocol describes a supported protocol and the rates it provides
var GRPC Protocol = Protocol{ Name: grpc, EdgeRates: []Rate{ Rate{Name: grpc, IsTotal: true, Precision: 2}, Rate{Name: grpcErr, IsErr: true, Precision: 2}, Rate{Name: grpcPercentErr, IsPercentErr: true, Precision: 1}, Rate{Name: grpcPercentReq, IsPercentReq: true, Precision: 1}, }, EdgeResponses: grpcResponses, NodeRates: []Rate{ Rate{Name: grpcIn, IsIn: true, Precision: 2}, Rate{Name: grpcInErr, IsErr: true, Precision: 2}, Rate{Name: grpcOut, IsOut: true, Precision: 2}, }, Unit: requestsPerSecond, UnitShort: rps, }
var HTTP Protocol = Protocol{ Name: http, EdgeRates: []Rate{ Rate{Name: http, IsTotal: true, Precision: 2}, Rate{Name: http3xx, Precision: 2}, Rate{Name: http4xx, IsErr: true, Precision: 2}, Rate{Name: http5xx, IsErr: true, Precision: 2}, Rate{Name: httpPercentErr, IsPercentErr: true, Precision: 1}, Rate{Name: httpPercentReq, IsPercentReq: true, Precision: 1}, }, EdgeResponses: httpResponses, NodeRates: []Rate{ Rate{Name: httpIn, IsIn: true, Precision: 2}, Rate{Name: httpIn3xx, Precision: 2}, Rate{Name: httpIn4xx, IsErr: true, Precision: 2}, Rate{Name: httpIn5xx, IsErr: true, Precision: 2}, Rate{Name: httpOut, IsOut: true, Precision: 2}, }, Unit: requestsPerSecond, UnitShort: rps, }
type Rate ¶ added in v0.14.0
type Rate struct { Name MetadataKey IsErr bool IsIn bool IsOut bool IsPercentErr bool IsPercentReq bool IsTotal bool Precision int }
Rate describes one rate provided by a protocol
type RequestedAppenders ¶ added in v0.21.0
type ResponseFlags ¶ added in v0.17.0
type Responses ¶ added in v0.17.0
type Responses map[string]ResponseFlags
type TelemetryOptions ¶ added in v0.21.0
type TelemetryOptions struct { AccessibleNamespaces map[string]time.Time Appenders RequestedAppenders // requested appenders, nil if param not supplied InjectServiceNodes bool // inject destination service nodes between source and destination nodes. Namespaces map[string]NamespaceInfo CommonOptions NodeOptions }
TelemetryOptions are those supplied to Telemetry Vendors
func (*TelemetryOptions) GetGraphKind ¶ added in v0.21.0
func (o *TelemetryOptions) GetGraphKind() string
GetGraphKind will return the kind of graph represented by the options.
type TelemetryVendor ¶ added in v0.21.0
type TelemetryVendor interface { // BuildNamespaceTrafficMap is required by the TelemetryVendor interface. It must produce a valid // TrafficMap for the requested namespaces, It is recommended to use the graph/util.go definitions for // error handling. It should be modeled after the Istio implementation. BuildNamespacesTrafficMap(o TelemetryOptions, client *prometheus.Client, globalInfo *AppenderGlobalInfo) TrafficMap // BuildNodeTrafficMap is required by the TelemetryVendor interface. It must produce a valid // TrafficMap for the requested node, It is recommended to use the graph/util.go definitions for // error handling. It should be modeled after the Istio implementation. BuildNodeTrafficMap(o TelemetryOptions, client *prometheus.Client, globalInfo *AppenderGlobalInfo) TrafficMap }
TelemetryVendor is an interface that must be satisfied for each telemetry implementation.
type TrafficMap ¶
TrafficMap is a map of app Nodes, each optionally holding Edge data. Metadata is a general purpose map for holding any desired node or edge information. Each app node should have a unique namespace+workload. Note that it is feasible but likely unusual to have two nodes with the same name+version in the same namespace.
func NewTrafficMap ¶
func NewTrafficMap() TrafficMap
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
config
|
|
cytoscape
Package cytoscape provides conversion from our graph to the CystoscapeJS configuration json model.
|
Package cytoscape provides conversion from our graph to the CystoscapeJS configuration json model. |
telemetry
|
|
istio
Package istio provides the Istio implementation of graph/TelemetryProvider.
|
Package istio provides the Istio implementation of graph/TelemetryProvider. |