Documentation ¶
Index ¶
- Constants
- Variables
- func AddLocalBridge(name string) error
- func ExtractHostID(m Node) string
- func IsLoopback(address string) bool
- func LocalAddresses() ([]net.IP, error)
- func MakeAddressNodeID(hostID, address string) string
- func MakeEndpointNodeID(hostID, namespaceID, address, port string) string
- func MakeOverlayNodeID(peerName string) string
- func MakeProcessNodeID(hostID, pid string) string
- func MakeScopedAddressNodeID(scope, address string) string
- func MakeScopedEndpointNodeID(scope, address, port string) string
- func ParseAddressNodeID(addressNodeID string) (hostID, address string, ok bool)
- func ParseEndpointNodeID(endpointNodeID string) (scope, address, port string, ok bool)
- func ParseNodeID(nodeID string) (hostID string, remainder string, ok bool)
- type Control
- type Controls
- type Counters
- func (c Counters) Add(key string, value int) Counters
- func (c *Counters) CodecDecodeSelf(decoder *codec.Decoder)
- func (c *Counters) CodecEncodeSelf(encoder *codec.Encoder)
- func (c Counters) Copy() Counters
- func (c Counters) DeepEqual(d Counters) bool
- func (c Counters) ForEach(f func(key string, val int))
- func (c *Counters) GobDecode(input []byte) error
- func (c Counters) GobEncode() ([]byte, error)
- func (c Counters) Lookup(key string) (int, bool)
- func (Counters) MarshalJSON() ([]byte, error)
- func (c Counters) Merge(other Counters) Counters
- func (c Counters) Size() int
- func (c Counters) String() string
- func (*Counters) UnmarshalJSON(b []byte) error
- type EdgeMetadata
- type EdgeMetadatas
- func (c EdgeMetadatas) Add(key string, value EdgeMetadata) EdgeMetadatas
- func (c *EdgeMetadatas) CodecDecodeSelf(decoder *codec.Decoder)
- func (c *EdgeMetadatas) CodecEncodeSelf(encoder *codec.Encoder)
- func (c EdgeMetadatas) Copy() EdgeMetadatas
- func (c EdgeMetadatas) DeepEqual(d EdgeMetadatas) bool
- func (c EdgeMetadatas) Flatten() EdgeMetadata
- func (c EdgeMetadatas) ForEach(fn func(k string, v EdgeMetadata))
- func (c *EdgeMetadatas) GobDecode(input []byte) error
- func (c EdgeMetadatas) GobEncode() ([]byte, error)
- func (c EdgeMetadatas) Lookup(key string) (EdgeMetadata, bool)
- func (EdgeMetadatas) MarshalJSON() ([]byte, error)
- func (c EdgeMetadatas) Merge(other EdgeMetadatas) EdgeMetadatas
- func (c EdgeMetadatas) Size() int
- func (c EdgeMetadatas) String() string
- func (*EdgeMetadatas) UnmarshalJSON(b []byte) error
- type IDList
- type Interface
- type LatestEntry
- type LatestMap
- func (m *LatestMap) CodecDecodeSelf(decoder *codec.Decoder)
- func (m *LatestMap) CodecEncodeSelf(encoder *codec.Encoder)
- func (m LatestMap) Copy() LatestMap
- func (m LatestMap) DeepEqual(n LatestMap) bool
- func (m LatestMap) Delete(key string) LatestMap
- func (m LatestMap) ForEach(fn func(k, v string))
- func (m LatestMap) Lookup(key string) (string, bool)
- func (m LatestMap) LookupEntry(key string) (string, time.Time, bool)
- func (LatestMap) MarshalJSON() ([]byte, error)
- func (m LatestMap) Merge(other LatestMap) LatestMap
- func (m LatestMap) Set(key string, timestamp time.Time, value string) LatestMap
- func (m LatestMap) Size() int
- func (m LatestMap) String() string
- func (*LatestMap) UnmarshalJSON(b []byte) error
- type MetadataRow
- type MetadataRowsByPriority
- type MetadataTemplate
- type MetadataTemplates
- type Metric
- func (m *Metric) CodecDecodeSelf(decoder *codec.Decoder)
- func (m *Metric) CodecEncodeSelf(encoder *codec.Encoder)
- func (m Metric) Div(n float64) Metric
- func (m Metric) LastSample() (Sample, bool)
- func (m Metric) Len() int
- func (Metric) MarshalJSON() ([]byte, error)
- func (m Metric) Merge(other Metric) Metric
- func (m Metric) ToIntermediate() WireMetrics
- func (*Metric) UnmarshalJSON(b []byte) error
- func (m Metric) WithMax(max float64) Metric
- type MetricRow
- type MetricRowsByPriority
- type MetricTemplate
- type MetricTemplates
- type Metrics
- type Networks
- type Node
- func (node Node) AddTable(prefix string, labels map[string]string) Node
- func (n Node) After(other Node) bool
- func (n Node) Before(other Node) bool
- func (n Node) Equal(other Node) bool
- func (node Node) ExtractTable(prefix string) (rows map[string]string, truncationCount int)
- func (n Node) Merge(other Node) Node
- func (n Node) PruneParents() Node
- func (n Node) WithAdjacent(a ...string) Node
- func (n Node) WithChild(child Node) Node
- func (n Node) WithChildren(children NodeSet) Node
- func (n Node) WithControls(cs ...string) Node
- func (n Node) WithCounters(c map[string]int) Node
- func (n Node) WithEdge(dst string, md EdgeMetadata) Node
- func (n Node) WithID(id string) Node
- func (n Node) WithLatest(k string, ts time.Time, v string) Node
- func (n Node) WithLatests(m map[string]string) Node
- func (n Node) WithMetric(key string, metric Metric) Node
- func (n Node) WithMetrics(metrics Metrics) Node
- func (n Node) WithParents(parents Sets) Node
- func (n Node) WithSet(key string, set StringSet) Node
- func (n Node) WithSets(sets Sets) Node
- func (n Node) WithTopology(topology string) Node
- type NodeControls
- func (nc NodeControls) Add(ids ...string) NodeControls
- func (nc *NodeControls) CodecDecodeSelf(decoder *codec.Decoder)
- func (nc *NodeControls) CodecEncodeSelf(encoder *codec.Encoder)
- func (nc NodeControls) Copy() NodeControls
- func (NodeControls) MarshalJSON() ([]byte, error)
- func (nc NodeControls) Merge(other NodeControls) NodeControls
- func (*NodeControls) UnmarshalJSON(b []byte) error
- type NodeSet
- func (n NodeSet) Add(nodes ...Node) NodeSet
- func (n *NodeSet) CodecDecodeSelf(decoder *codec.Decoder)
- func (n *NodeSet) CodecEncodeSelf(encoder *codec.Encoder)
- func (n NodeSet) Copy() NodeSet
- func (n NodeSet) DeepEqual(i interface{}) bool
- func (n NodeSet) Delete(ids ...string) NodeSet
- func (n NodeSet) ForEach(f func(Node))
- func (n *NodeSet) GobDecode(input []byte) error
- func (n NodeSet) GobEncode() ([]byte, error)
- func (n NodeSet) Keys() []string
- func (n NodeSet) Lookup(key string) (Node, bool)
- func (NodeSet) MarshalJSON() ([]byte, error)
- func (n NodeSet) Merge(other NodeSet) NodeSet
- func (n NodeSet) Size() int
- func (n NodeSet) String() string
- func (*NodeSet) UnmarshalJSON(b []byte) error
- type Nodes
- type Report
- func (r Report) Copy() Report
- func (r Report) Merge(other Report) Report
- func (rep *Report) ReadBinary(r io.Reader, gzipped bool, codecHandle codec.Handle) error
- func (r Report) Topologies() []Topology
- func (r Report) Topology(name string) (Topology, bool)
- func (r Report) Validate() error
- func (r *Report) WalkTopologies(f func(*Topology))
- func (rep Report) WriteBinary(w io.Writer, compressionLevel int) error
- type Sample
- type Sampling
- type Sets
- func (s Sets) Add(key string, value StringSet) Sets
- func (s *Sets) CodecDecodeSelf(decoder *codec.Decoder)
- func (s *Sets) CodecEncodeSelf(encoder *codec.Encoder)
- func (s Sets) Copy() Sets
- func (s Sets) DeepEqual(t Sets) bool
- func (s Sets) Delete(key string) Sets
- func (s *Sets) GobDecode(input []byte) error
- func (s Sets) GobEncode() ([]byte, error)
- func (s Sets) Keys() []string
- func (s Sets) Lookup(key string) (StringSet, bool)
- func (Sets) MarshalJSON() ([]byte, error)
- func (s Sets) Merge(other Sets) Sets
- func (s Sets) Size() int
- func (s Sets) String() string
- func (*Sets) UnmarshalJSON(b []byte) error
- type StringSet
- type Table
- type TableTemplate
- type TableTemplates
- type Topology
- func (t Topology) AddNode(node Node) Topology
- func (t Topology) Copy() Topology
- func (t Topology) GetShape() string
- func (t Topology) Merge(other Topology) Topology
- func (t Topology) Validate() error
- func (t Topology) WithLabel(label, labelPlural string) Topology
- func (t Topology) WithMetadataTemplates(other MetadataTemplates) Topology
- func (t Topology) WithMetricTemplates(other MetricTemplates) Topology
- func (t Topology) WithShape(shape string) Topology
- func (t Topology) WithTableTemplates(other TableTemplates) Topology
- type WireMetrics
Constants ¶
const ( // ScopeDelim is a general-purpose delimiter used within node IDs to // separate different contextual scopes. Different topologies have // different key structures. ScopeDelim = ";" // EdgeDelim separates two node IDs when they need to exist in the same key. // Concretely, it separates node IDs in keys that represent edges. EdgeDelim = "|" // Key added to nodes to prevent them being joined with conntracked connections DoesNotMakeConnections = "does_not_make_connections" )
Delimiters are used to separate parts of node IDs, to guarantee uniqueness in particular contexts.
const ( FromLatest = "latest" FromSets = "sets" FromCounters = "counters" )
FromLatest and friends denote the different fields where metadata can be gathered from.
const ( DefaultFormat = "" FilesizeFormat = "filesize" IntegerFormat = "integer" PercentFormat = "percent" )
DefaultFormat and friends tell the UI how to render the "Value" of this metric.
const ( Endpoint = "endpoint" Process = "process" Container = "container" Pod = "pod" Service = "service" Deployment = "deployment" ReplicaSet = "replica_set" ContainerImage = "container_image" Host = "host" Overlay = "overlay" // Shapes used for different nodes Circle = "circle" Square = "square" Heptagon = "heptagon" Hexagon = "hexagon" Cloud = "cloud" // Used when counting the number of containers ContainersKey = "containers" )
Names of the various topologies.
const ( // HostNodeID is a metadata foreign key, linking a node in any topology to // a node in the host topology. That host node is the origin host, where // the node was originally detected. HostNodeID = "host_node_id" // ControlProbeID is the random ID of the probe which controls the specific node. ControlProbeID = "control_probe_id" )
const ( MaxTableRows = 20 TruncationCountPrefix = "table_truncation_count_" )
MaxTableRows sets the limit on the table size to render TODO: this won't be needed once we send reports incrementally
const TheInternet = "theinternet"
TheInternet is used as a node ID to indicate a remote IP.
Variables ¶
var ( // MakeHostNodeID produces a host node ID from its composite parts. MakeHostNodeID = makeSingleComponentID("host") // ParseHostNodeID parses a host node ID ParseHostNodeID = parseSingleComponentID("host") // MakeContainerNodeID produces a container node ID from its composite parts. MakeContainerNodeID = makeSingleComponentID("container") // ParseContainerNodeID parses a container node ID ParseContainerNodeID = parseSingleComponentID("container") // MakeContainerImageNodeID produces a container image node ID from its composite parts. MakeContainerImageNodeID = makeSingleComponentID("container_image") // ParseContainerImageNodeID parses a container image node ID ParseContainerImageNodeID = parseSingleComponentID("container_image") // MakePodNodeID produces a pod node ID from its composite parts. MakePodNodeID = makeSingleComponentID("pod") // ParsePodNodeID parses a pod node ID ParsePodNodeID = parseSingleComponentID("pod") // MakeServiceNodeID produces a service node ID from its composite parts. MakeServiceNodeID = makeSingleComponentID("service") // ParseServiceNodeID parses a service node ID ParseServiceNodeID = parseSingleComponentID("service") // MakeDeploymentNodeID produces a deployment node ID from its composite parts. MakeDeploymentNodeID = makeSingleComponentID("deployment") // ParseDeploymentNodeID parses a deployment node ID ParseDeploymentNodeID = parseSingleComponentID("deployment") // MakeReplicaSetNodeID produces a replica set node ID from its composite parts. MakeReplicaSetNodeID = makeSingleComponentID("replica_set") // ParseReplicaSetNodeID parses a replica set node ID ParseReplicaSetNodeID = parseSingleComponentID("replica_set") )
var ( LocalNetworks = Networks{} InterfaceByNameStub = func(name string) (Interface, error) { return net.InterfaceByName(name) } )
Variables exposed for testing. TODO this design is broken, make it consistent with probe networks.
var EmptyCounters = Counters{ps.NewMap()}
EmptyCounters is the set of empty counters.
var EmptyEdgeMetadatas = EdgeMetadatas{ps.NewMap()}
EmptyEdgeMetadatas is the set of empty EdgeMetadatas.
var EmptyIDList = IDList(EmptyStringSet)
EmptyIDList is an Empty ID List.
var EmptyLatestMap = LatestMap{ps.NewMap()}
EmptyLatestMap is an empty LatestMap. Start with this.
var EmptyNodeSet = NodeSet{ps.NewMap()}
EmptyNodeSet is the empty set of nodes.
var EmptySets = Sets{ps.NewMap()}
EmptySets is an empty Sets. Starts with this.
Functions ¶
func AddLocalBridge ¶ added in v0.4.0
AddLocalBridge records the subnet address associated with the bridge name supplied, such that MakeAddressNodeID will scope addresses in this subnet as local.
func ExtractHostID ¶ added in v0.4.0
ExtractHostID extracts the host id from Node
func IsLoopback ¶ added in v0.17.0
IsLoopback ascertains if an address comes from a loopback interface.
func LocalAddresses ¶ added in v0.9.0
LocalAddresses returns a list of the local IP addresses.
func MakeAddressNodeID ¶ added in v0.3.0
MakeAddressNodeID produces an address node ID from its composite parts.
func MakeEndpointNodeID ¶ added in v0.3.0
MakeEndpointNodeID produces an endpoint node ID from its composite parts.
func MakeOverlayNodeID ¶ added in v0.4.0
MakeOverlayNodeID produces an overlay topology node ID from a router peer's name, which is assumed to be globally unique.
func MakeProcessNodeID ¶ added in v0.3.0
MakeProcessNodeID produces a process node ID from its composite parts.
func MakeScopedAddressNodeID ¶ added in v0.9.0
MakeScopedAddressNodeID is like MakeAddressNodeID, but it always prefixes the ID witha scope.
func MakeScopedEndpointNodeID ¶ added in v0.9.0
MakeScopedEndpointNodeID is like MakeEndpointNodeID, but it always prefixes the ID with a scope.
func ParseAddressNodeID ¶ added in v0.7.0
ParseAddressNodeID produces the host ID, address from an address node ID.
func ParseEndpointNodeID ¶ added in v0.5.0
ParseEndpointNodeID produces the scope, address, and port and remainder. Note that hostID may be blank.
Types ¶
type Control ¶ added in v0.10.0
type Control struct { ID string `json:"id"` Human string `json:"human"` Icon string `json:"icon"` // from https://fortawesome.github.io/Font-Awesome/cheatsheet/ please Rank int `json:"rank"` }
A Control basically describes an RPC
type Controls ¶ added in v0.10.0
Controls describe the control tags within the Nodes
func (Controls) AddControl ¶ added in v0.10.0
AddControl adds c added to cs.
func (Controls) AddControls ¶ added in v0.15.0
AddControls adds a collection of controls to cs.
type Counters ¶ added in v0.7.0
type Counters struct {
// contains filtered or unexported fields
}
Counters is a string->int map.
func MakeCounters ¶ added in v0.12.0
func MakeCounters() Counters
MakeCounters returns EmptyCounters
func (*Counters) CodecDecodeSelf ¶ added in v0.13.0
CodecDecodeSelf implements codec.Selfer
func (*Counters) CodecEncodeSelf ¶ added in v0.13.0
CodecEncodeSelf implements codec.Selfer
func (Counters) ForEach ¶ added in v0.14.0
ForEach calls f for each k/v pair of counters. Keys are iterated in lexicographical order.
func (Counters) MarshalJSON ¶ added in v0.12.0
MarshalJSON shouldn't be used, use CodecEncodeSelf instead
func (Counters) Merge ¶ added in v0.7.0
Merge produces a fresh Counters, container the keys from both inputs. When both inputs container the same key, the latter value is used.
func (*Counters) UnmarshalJSON ¶ added in v0.12.0
UnmarshalJSON shouldn't be used, use CodecDecodeSelf instead
type EdgeMetadata ¶
type EdgeMetadata struct { EgressPacketCount *uint64 `json:"egress_packet_count,omitempty"` IngressPacketCount *uint64 `json:"ingress_packet_count,omitempty"` EgressByteCount *uint64 `json:"egress_byte_count,omitempty"` // Transport layer IngressByteCount *uint64 `json:"ingress_byte_count,omitempty"` // Transport layer }
EdgeMetadata describes a superset of the metadata that probes can possibly collect about a directed edge between two nodes in any topology.
func (EdgeMetadata) Copy ¶ added in v0.7.0
func (e EdgeMetadata) Copy() EdgeMetadata
Copy returns a value copy of the EdgeMetadata.
func (EdgeMetadata) Flatten ¶
func (e EdgeMetadata) Flatten(other EdgeMetadata) EdgeMetadata
Flatten sums two EdgeMetadatas and returns the result. The receiver is not modified. The two edge metadata windows should be the same duration; they should represent different edges at the same time.
func (EdgeMetadata) Merge ¶
func (e EdgeMetadata) Merge(other EdgeMetadata) EdgeMetadata
Merge merges another EdgeMetadata into the receiver and returns the result. The receiver is not modified. The two edge metadatas should represent the same edge on different times.
func (EdgeMetadata) Reversed ¶ added in v0.8.0
func (e EdgeMetadata) Reversed() EdgeMetadata
Reversed returns a value copy of the EdgeMetadata, with the direction reversed.
func (EdgeMetadata) String ¶ added in v0.14.0
func (e EdgeMetadata) String() string
String returns a string representation of this EdgeMetadata Helps with our use of Spew and diff.
type EdgeMetadatas ¶
type EdgeMetadatas struct {
// contains filtered or unexported fields
}
EdgeMetadatas collect metadata about each edge in a topology. Keys are the remote node IDs, as in Adjacency.
func MakeEdgeMetadatas ¶ added in v0.12.0
func MakeEdgeMetadatas() EdgeMetadatas
MakeEdgeMetadatas returns EmptyEdgeMetadatas
func (EdgeMetadatas) Add ¶ added in v0.12.0
func (c EdgeMetadatas) Add(key string, value EdgeMetadata) EdgeMetadatas
Add value to the counter 'key'
func (*EdgeMetadatas) CodecDecodeSelf ¶ added in v0.13.0
func (c *EdgeMetadatas) CodecDecodeSelf(decoder *codec.Decoder)
CodecDecodeSelf implements codec.Selfer
func (*EdgeMetadatas) CodecEncodeSelf ¶ added in v0.13.0
func (c *EdgeMetadatas) CodecEncodeSelf(encoder *codec.Encoder)
CodecEncodeSelf implements codec.Selfer
func (EdgeMetadatas) Copy ¶ added in v0.7.0
func (c EdgeMetadatas) Copy() EdgeMetadatas
Copy is a noop
func (EdgeMetadatas) DeepEqual ¶ added in v0.12.0
func (c EdgeMetadatas) DeepEqual(d EdgeMetadatas) bool
DeepEqual tests equality with other Counters
func (EdgeMetadatas) Flatten ¶ added in v0.7.0
func (c EdgeMetadatas) Flatten() EdgeMetadata
Flatten flattens all the EdgeMetadatas in this set and returns the result. The original is not modified.
func (EdgeMetadatas) ForEach ¶ added in v0.12.0
func (c EdgeMetadatas) ForEach(fn func(k string, v EdgeMetadata))
ForEach executes f on each key value pair in the map
func (*EdgeMetadatas) GobDecode ¶ added in v0.12.0
func (c *EdgeMetadatas) GobDecode(input []byte) error
GobDecode implements gob.Unmarshaller
func (EdgeMetadatas) GobEncode ¶ added in v0.12.0
func (c EdgeMetadatas) GobEncode() ([]byte, error)
GobEncode implements gob.Marshaller
func (EdgeMetadatas) Lookup ¶ added in v0.12.0
func (c EdgeMetadatas) Lookup(key string) (EdgeMetadata, bool)
Lookup the counter 'key'
func (EdgeMetadatas) MarshalJSON ¶ added in v0.12.0
func (EdgeMetadatas) MarshalJSON() ([]byte, error)
MarshalJSON shouldn't be used, use CodecEncodeSelf instead
func (EdgeMetadatas) Merge ¶
func (c EdgeMetadatas) Merge(other EdgeMetadatas) EdgeMetadatas
Merge produces a fresh Counters, container the keys from both inputs. When both inputs container the same key, the latter value is used.
func (EdgeMetadatas) Size ¶ added in v0.12.0
func (c EdgeMetadatas) Size() int
Size is the number of elements
func (EdgeMetadatas) String ¶ added in v0.12.0
func (c EdgeMetadatas) String() string
func (*EdgeMetadatas) UnmarshalJSON ¶ added in v0.12.0
func (*EdgeMetadatas) UnmarshalJSON(b []byte) error
UnmarshalJSON shouldn't be used, use CodecDecodeSelf instead
type IDList ¶
type IDList StringSet
IDList is a list of string IDs, which are always sorted and unique.
func MakeIDList ¶ added in v0.3.0
MakeIDList makes a new IDList.
func (IDList) Intersection ¶ added in v0.14.0
Intersection returns the intersection of a and b
type LatestEntry ¶ added in v0.10.0
LatestEntry represents a timestamped value inside the LatestMap.
func (LatestEntry) Equal ¶ added in v0.12.0
func (e LatestEntry) Equal(e2 LatestEntry) bool
Equal returns true if the supplied LatestEntry is equal to this one.
func (LatestEntry) String ¶ added in v0.10.0
func (e LatestEntry) String() string
type LatestMap ¶ added in v0.10.0
LatestMap is a persitent map which support latest-win merges. We have to embed ps.Map as its an interface. LatestMaps are immutable.
func MakeLatestMap ¶ added in v0.10.0
func MakeLatestMap() LatestMap
MakeLatestMap makes an empty LatestMap
func (*LatestMap) CodecDecodeSelf ¶ added in v0.13.0
CodecDecodeSelf implements codec.Selfer This implementation does not use the intermediate form as that was a performance issue; skipping it saved almost 10% CPU. Note this means we are using undocumented, internal APIs, which could break in the future. See https://github.com/weaveworks/scope/pull/1709 for more information.
func (*LatestMap) CodecEncodeSelf ¶ added in v0.13.0
CodecEncodeSelf implements codec.Selfer
func (LatestMap) LookupEntry ¶ added in v0.14.0
LookupEntry returns the raw entry for the given key.
func (LatestMap) MarshalJSON ¶ added in v0.10.0
MarshalJSON shouldn't be used, use CodecEncodeSelf instead
func (LatestMap) Merge ¶ added in v0.10.0
Merge produces a fresh LatestMap, container the kers from both inputs. When both inputs container the same key, the latter value is used.
func (*LatestMap) UnmarshalJSON ¶ added in v0.10.0
UnmarshalJSON shouldn't be used, use CodecDecodeSelf instead
type MetadataRow ¶ added in v0.14.0
type MetadataRow struct { ID string `json:"id"` Label string `json:"label"` Value string `json:"value"` Priority float64 `json:"priority,omitempty"` Datatype string `json:"dataType,omitempty"` }
MetadataRow is a row for the metadata table.
func (MetadataRow) Copy ¶ added in v0.14.0
func (m MetadataRow) Copy() MetadataRow
Copy returns a value copy of a metadata row.
type MetadataRowsByPriority ¶ added in v0.14.0
type MetadataRowsByPriority []MetadataRow
MetadataRowsByPriority implements sort.Interface, so we can sort the rows by priority before rendering them to the UI.
func (MetadataRowsByPriority) Len ¶ added in v0.14.0
func (m MetadataRowsByPriority) Len() int
Len is part of sort.Interface.
func (MetadataRowsByPriority) Less ¶ added in v0.14.0
func (m MetadataRowsByPriority) Less(i, j int) bool
Less is part of sort.Interface.
func (MetadataRowsByPriority) Swap ¶ added in v0.14.0
func (m MetadataRowsByPriority) Swap(i, j int)
Swap is part of sort.Interface.
type MetadataTemplate ¶ added in v0.14.0
type MetadataTemplate struct { ID string `json:"id"` Label string `json:"label,omitempty"` // Human-readable descriptor for this row Truncate int `json:"truncate,omitempty"` // If > 0, truncate the value to this length. Datatype string `json:"dataType,omitempty"` Priority float64 `json:"priority,omitempty"` From string `json:"from,omitempty"` // Defines how to get the value from a report node }
MetadataTemplate extracts some metadata rows from a node
func (MetadataTemplate) Copy ¶ added in v0.14.0
func (t MetadataTemplate) Copy() MetadataTemplate
Copy returns a value-copy of the template
func (MetadataTemplate) MetadataRows ¶ added in v0.14.0
func (t MetadataTemplate) MetadataRows(n Node) []MetadataRow
MetadataRows returns the rows for a node
type MetadataTemplates ¶ added in v0.14.0
type MetadataTemplates map[string]MetadataTemplate
MetadataTemplates is a mergeable set of metadata templates
func (MetadataTemplates) Copy ¶ added in v0.14.0
func (e MetadataTemplates) Copy() MetadataTemplates
Copy returns a value copy of the metadata templates
func (MetadataTemplates) Merge ¶ added in v0.14.0
func (e MetadataTemplates) Merge(other MetadataTemplates) MetadataTemplates
Merge merges two sets of MetadataTemplates so far just ignores based on duplicate id key
func (MetadataTemplates) MetadataRows ¶ added in v0.14.0
func (e MetadataTemplates) MetadataRows(n Node) []MetadataRow
MetadataRows returns the rows for a node
type Metric ¶ added in v0.10.0
Metric is a list of timeseries data with some metadata. Clients must use the Add method to add values. Metrics are immutable.
func MakeMetric ¶ added in v0.10.0
MakeMetric makes a new Metric from unique samples incrementally ordered in time.
func MakeSingletonMetric ¶ added in v0.17.0
MakeSingletonMetric makes a metric with a single value
func (*Metric) CodecDecodeSelf ¶ added in v0.13.0
CodecDecodeSelf implements codec.Selfer
func (*Metric) CodecEncodeSelf ¶ added in v0.13.0
CodecEncodeSelf implements codec.Selfer
func (Metric) Div ¶ added in v0.10.0
Div returns a new copy of the metric, with each value divided by n.
func (Metric) LastSample ¶ added in v0.10.0
LastSample obtains the last sample of the metric
func (Metric) MarshalJSON ¶ added in v0.10.0
MarshalJSON shouldn't be used, use CodecEncodeSelf instead
func (Metric) ToIntermediate ¶ added in v0.12.0
func (m Metric) ToIntermediate() WireMetrics
ToIntermediate converts the metric to a representation suitable for serialization.
func (*Metric) UnmarshalJSON ¶ added in v0.10.0
UnmarshalJSON shouldn't be used, use CodecDecodeSelf instead
type MetricRow ¶ added in v0.14.0
type MetricRow struct { ID string Label string Format string Group string Value float64 Priority float64 Metric *Metric }
MetricRow is a tuple of data used to render a metric as a sparkline and accoutrements.
func (*MetricRow) CodecDecodeSelf ¶ added in v0.14.0
CodecDecodeSelf implements codec.Selfer
func (*MetricRow) CodecEncodeSelf ¶ added in v0.14.0
CodecEncodeSelf marshals this MetricRow. It takes the basic Metric rendering, then adds some row-specific fields.
func (MetricRow) MarshalJSON ¶ added in v0.14.0
MarshalJSON shouldn't be used, use CodecEncodeSelf instead
func (MetricRow) Summary ¶ added in v0.14.0
Summary returns a copy of the MetricRow, without the samples, just the value if there is one.
func (*MetricRow) UnmarshalJSON ¶ added in v0.14.0
UnmarshalJSON shouldn't be used, use CodecDecodeSelf instead
type MetricRowsByPriority ¶ added in v0.14.0
type MetricRowsByPriority []MetricRow
MetricRowsByPriority implements sort.Interface, so we can sort the rows by priority before rendering them to the UI.
func (MetricRowsByPriority) Len ¶ added in v0.14.0
func (m MetricRowsByPriority) Len() int
Len is part of sort.Interface.
func (MetricRowsByPriority) Less ¶ added in v0.14.0
func (m MetricRowsByPriority) Less(i, j int) bool
Less is part of sort.Interface.
func (MetricRowsByPriority) Swap ¶ added in v0.14.0
func (m MetricRowsByPriority) Swap(i, j int)
Swap is part of sort.Interface.
type MetricTemplate ¶ added in v0.14.0
type MetricTemplate struct { ID string `json:"id"` Label string `json:"label,omitempty"` Format string `json:"format,omitempty"` Group string `json:"group,omitempty"` Priority float64 `json:"priority,omitempty"` }
MetricTemplate extracts a metric row from a node
func (MetricTemplate) Copy ¶ added in v0.14.0
func (t MetricTemplate) Copy() MetricTemplate
Copy returns a value-copy of the metric template
func (MetricTemplate) MetricRows ¶ added in v0.14.0
func (t MetricTemplate) MetricRows(n Node) []MetricRow
MetricRows returns the rows for a node
type MetricTemplates ¶ added in v0.14.0
type MetricTemplates map[string]MetricTemplate
MetricTemplates is a mergeable set of metric templates
func (MetricTemplates) Copy ¶ added in v0.14.0
func (e MetricTemplates) Copy() MetricTemplates
Copy returns a value copy of the metadata templates
func (MetricTemplates) Merge ¶ added in v0.14.0
func (e MetricTemplates) Merge(other MetricTemplates) MetricTemplates
Merge merges two sets of MetricTemplates so far just ignores based on duplicate id key
func (MetricTemplates) MetricRows ¶ added in v0.14.0
func (e MetricTemplates) MetricRows(n Node) []MetricRow
MetricRows returns the rows for a node
type Metrics ¶ added in v0.10.0
Metrics is a string->metric map.
type Node ¶ added in v0.7.0
type Node struct { ID string `json:"id,omitempty"` Topology string `json:"topology,omitempty"` Counters Counters `json:"counters,omitempty"` Sets Sets `json:"sets,omitempty"` Adjacency IDList `json:"adjacency"` Edges EdgeMetadatas `json:"edges,omitempty"` Controls NodeControls `json:"controls,omitempty"` Latest LatestMap `json:"latest,omitempty"` Metrics Metrics `json:"metrics,omitempty"` Parents Sets `json:"parents,omitempty"` Children NodeSet `json:"children,omitempty"` }
Node describes a superset of the metadata that probes can collect about a given node in a given topology, along with the edges emanating from the node and metadata about those edges.
func MakeNodeWith ¶ added in v0.7.0
MakeNodeWith creates a new Node with the supplied map.
func (Node) AddTable ¶ added in v0.15.0
AddTable appends arbirary key-value pairs to the Node, returning a new node.
func (Node) ExtractTable ¶ added in v0.15.0
ExtractTable returns the key-value pairs with the given prefix from this Node,
func (Node) Merge ¶ added in v0.7.0
Merge mergses the individual components of a node and returns a fresh node.
func (Node) PruneParents ¶ added in v0.14.0
PruneParents returns a fresh copy of n, without any parents.
func (Node) WithAdjacent ¶ added in v0.7.0
WithAdjacent returns a fresh copy of n, with 'a' added to Adjacency
func (Node) WithChild ¶ added in v0.14.0
WithChild returns a fresh copy of n, with one child merged in.
func (Node) WithChildren ¶ added in v0.14.0
WithChildren returns a fresh copy of n, with children merged in.
func (Node) WithControls ¶ added in v0.10.0
WithControls returns a fresh copy of n, with cs added to Controls.
func (Node) WithCounters ¶ added in v0.7.0
WithCounters returns a fresh copy of n, with Counters c merged in.
func (Node) WithEdge ¶ added in v0.7.0
func (n Node) WithEdge(dst string, md EdgeMetadata) Node
WithEdge returns a fresh copy of n, with 'dst' added to Adjacency and md added to EdgeMetadata.
func (Node) WithLatest ¶ added in v0.10.0
WithLatest produces a new Node with k mapped to v in the Latest metadata.
func (Node) WithLatests ¶ added in v0.12.0
WithLatests returns a fresh copy of n, with Metadata m merged in.
func (Node) WithMetric ¶ added in v0.10.0
WithMetric returns a fresh copy of n, with metric merged in at key.
func (Node) WithMetrics ¶ added in v0.10.0
WithMetrics returns a fresh copy of n, with metrics merged in.
func (Node) WithParents ¶ added in v0.12.0
WithParents returns a fresh copy of n, with sets merged in.
func (Node) WithSet ¶ added in v0.10.0
WithSet returns a fresh copy of n, with set merged in at key.
func (Node) WithTopology ¶ added in v0.12.0
WithTopology returns a fresh copy of n, with ID changed.
type NodeControls ¶ added in v0.10.0
NodeControls represent the individual controls that are valid for a given node at a given point in time. It's immutable. A zero-value for Timestamp indicated this NodeControls is 'not set'.
func MakeNodeControls ¶ added in v0.10.0
func MakeNodeControls() NodeControls
MakeNodeControls makes a new NodeControls
func (NodeControls) Add ¶ added in v0.10.0
func (nc NodeControls) Add(ids ...string) NodeControls
Add the new control IDs to this NodeControls, producing a fresh NodeControls.
func (*NodeControls) CodecDecodeSelf ¶ added in v0.13.0
func (nc *NodeControls) CodecDecodeSelf(decoder *codec.Decoder)
CodecDecodeSelf implements codec.Selfer
func (*NodeControls) CodecEncodeSelf ¶ added in v0.13.0
func (nc *NodeControls) CodecEncodeSelf(encoder *codec.Encoder)
CodecEncodeSelf implements codec.Selfer
func (NodeControls) Copy ¶ added in v0.10.0
func (nc NodeControls) Copy() NodeControls
Copy is a noop, as NodeControls is immutable
func (NodeControls) MarshalJSON ¶ added in v0.11.0
func (NodeControls) MarshalJSON() ([]byte, error)
MarshalJSON shouldn't be used, use CodecEncodeSelf instead
func (NodeControls) Merge ¶ added in v0.10.0
func (nc NodeControls) Merge(other NodeControls) NodeControls
Merge returns the newest of the two NodeControls; it does not take the union of the valid Controls.
func (*NodeControls) UnmarshalJSON ¶ added in v0.11.0
func (*NodeControls) UnmarshalJSON(b []byte) error
UnmarshalJSON shouldn't be used, use CodecDecodeSelf instead
type NodeSet ¶ added in v0.12.0
type NodeSet struct {
// contains filtered or unexported fields
}
NodeSet is a set of nodes keyed on ID. Clients must use the Add method to add nodes
func MakeNodeSet ¶ added in v0.12.0
MakeNodeSet makes a new NodeSet with the given nodes.
func (NodeSet) Add ¶ added in v0.12.0
Add adds the nodes to the NodeSet. Add is the only valid way to grow a NodeSet. Add returns the NodeSet to enable chaining.
func (*NodeSet) CodecDecodeSelf ¶ added in v0.13.0
CodecDecodeSelf implements codec.Selfer
func (*NodeSet) CodecEncodeSelf ¶ added in v0.13.0
CodecEncodeSelf implements codec.Selfer
func (NodeSet) Delete ¶ added in v0.15.0
Delete deletes the nodes from the NodeSet by ID. Delete is the only valid way to shrink a NodeSet. Delete returns the NodeSet to enable chaining.
func (NodeSet) ForEach ¶ added in v0.12.0
ForEach executes f for each node in the set. Nodes are traversed in sorted order.
func (NodeSet) MarshalJSON ¶ added in v0.12.0
MarshalJSON shouldn't be used, use CodecEncodeSelf instead
func (*NodeSet) UnmarshalJSON ¶ added in v0.12.0
UnmarshalJSON shouldn't be used, use CodecDecodeSelf instead
type Nodes ¶ added in v0.7.0
Nodes is a collection of nodes in a topology. Keys are node IDs. TODO(pb): type Topology map[string]Node
type Report ¶
type Report struct { // Endpoint nodes are individual (address, port) tuples on each host. // They come from inspecting active connections and can (theoretically) // be traced back to a process. Edges are present. Endpoint Topology // Process nodes are processes on each host. Edges are not present. Process Topology // Container nodes represent all Docker containers on hosts running probes. // Metadata includes things like containter id, name, image id etc. // Edges are not present. Container Topology // Pod nodes represent all Kubernetes pods running on hosts running probes. // Metadata includes things like pod id, name etc. Edges are not // present. Pod Topology // Service nodes represent all Kubernetes services running on hosts running probes. // Metadata includes things like service id, name etc. Edges are not // present. Service Topology // Deployment nodes represent all Kubernetes deployments running on hosts running probes. // Metadata includes things like deployment id, name etc. Edges are not // present. Deployment Topology // ReplicaSet nodes represent all Kubernetes replicasets running on hosts running probes. // Metadata includes things like replicaset id, name etc. Edges are not // present. ReplicaSet Topology // ContainerImages nodes represent all Docker containers images on // hosts running probes. Metadata includes things like image id, name etc. // Edges are not present. ContainerImage Topology // Host nodes are physical hosts that run probes. Metadata includes things // like operating system, load, etc. The information is scraped by the // probes with each published report. Edges are not present. Host Topology // Overlay nodes are active peers in any software-defined network that's // overlaid on the infrastructure. The information is scraped by polling // their status endpoints. Edges could be present, but aren't currently. Overlay Topology // Sampling data for this report. Sampling Sampling // Window is the amount of time that this report purports to represent. // Windows must be carefully merged. They should only be added when // reports cover non-overlapping periods of time. By default, we assume // that's true, and add windows in merge operations. When that's not true, // such as in the app, we expect the component to overwrite the window // before serving it to consumers. Window time.Duration // Shortcut reports should be propagated to the UI as quickly as possible, // bypassing the usual spy interval, publish interval and app ws interval. Shortcut bool Plugins xfer.PluginSpecs // ID a random identifier for this report, used when caching // rendered views of the report. Reports with the same id // must be equal, but we don't require that equal reports have // the same id. ID string `deepequal:"skip"` }
Report is the core data type. It's produced by probes, and consumed and stored by apps. It's composed of multiple topologies, each representing a different (related, but not equivalent) view of the network.
func MakeFromBinary ¶ added in v0.16.1
MakeFromBinary constructs a Report from a gzipped msgpack.
func MakeReport ¶ added in v0.3.0
func MakeReport() Report
MakeReport makes a clean report, ready to Merge() other reports into.
func (Report) Merge ¶
Merge merges another Report into the receiver and returns the result. The original is not modified.
func (*Report) ReadBinary ¶ added in v0.16.1
ReadBinary reads bytes into a Report.
Will decompress the binary if gzipped is true, and will use the given codecHandle to decode it.
func (Report) Topologies ¶ added in v0.3.0
Topologies returns a slice of Topologies in this report
func (*Report) WalkTopologies ¶ added in v0.16.1
WalkTopologies iterates through the Topologies of the report, potentially modifying them
type Sampling ¶ added in v0.6.0
Sampling describes how the packet data sources for this report were sampled. It can be used to calculate effective sample rates. We can't just put the rate here, because that can't be accurately merged. Counts in e.g. edge metadata structures have already been adjusted to compensate for the sample rate.
type Sets ¶ added in v0.10.0
type Sets struct {
// contains filtered or unexported fields
}
Sets is a string->set-of-strings map. It is immutable.
func (*Sets) CodecDecodeSelf ¶ added in v0.13.0
CodecDecodeSelf implements codec.Selfer
func (*Sets) CodecEncodeSelf ¶ added in v0.13.0
CodecEncodeSelf implements codec.Selfer
func (Sets) MarshalJSON ¶ added in v0.12.0
MarshalJSON shouldn't be used, use CodecEncodeSelf instead
func (Sets) Merge ¶ added in v0.10.0
Merge merges two sets maps into a fresh set, performing set-union merges as appropriate.
func (*Sets) UnmarshalJSON ¶ added in v0.12.0
UnmarshalJSON shouldn't be used, use CodecDecodeSelf instead
type StringSet ¶ added in v0.10.0
type StringSet []string
StringSet is a sorted set of unique strings. Clients must use the Add method to add strings.
var EmptyStringSet StringSet
EmptyStringSet is an empty string set.
func MakeStringSet ¶ added in v0.10.0
MakeStringSet makes a new StringSet with the given strings.
func (StringSet) Add ¶ added in v0.10.0
Add adds the strings to the StringSet. Add is the only valid way to grow a StringSet. Add returns the StringSet to enable chaining.
func (StringSet) Contains ¶ added in v0.12.0
Contains returns true if the string set includes the given string
func (StringSet) Intersection ¶ added in v0.14.0
Intersection returns the intersections of a and b
type Table ¶
type Table struct { ID string `json:"id"` Label string `json:"label"` Rows []MetadataRow `json:"rows"` TruncationCount int `json:"truncationCount,omitempty"` }
Table is the type for a table in the UI.
type TableTemplate ¶ added in v0.15.0
type TableTemplate struct { ID string `json:"id"` Label string `json:"label"` Prefix string `json:"prefix"` }
TableTemplate describes how to render a table for the UI.
func (TableTemplate) Copy ¶ added in v0.15.0
func (t TableTemplate) Copy() TableTemplate
Copy returns a value-copy of the TableTemplate
func (TableTemplate) Merge ¶ added in v0.15.0
func (t TableTemplate) Merge(other TableTemplate) TableTemplate
Merge other into t, returning a fresh copy. Does fieldwise max - whilst this isn't particularly meaningful, at least it idempotent, commutativite and associative.
type TableTemplates ¶ added in v0.15.0
type TableTemplates map[string]TableTemplate
TableTemplates is a mergeable set of TableTemplate
func (TableTemplates) Copy ¶ added in v0.15.0
func (t TableTemplates) Copy() TableTemplates
Copy returns a value copy of the TableTemplates
func (TableTemplates) Merge ¶ added in v0.15.0
func (t TableTemplates) Merge(other TableTemplates) TableTemplates
Merge merges two sets of TableTemplates
func (TableTemplates) Tables ¶ added in v0.15.0
func (t TableTemplates) Tables(node Node) []Table
Tables renders the TableTemplates for a given node.
type Topology ¶
type Topology struct { Shape string `json:"shape,omitempty"` Label string `json:"label,omitempty"` LabelPlural string `json:"label_plural,omitempty"` Nodes `json:"nodes"` Controls `json:"controls,omitempty"` MetadataTemplates `json:"metadata_templates,omitempty"` MetricTemplates `json:"metric_templates,omitempty"` TableTemplates `json:"table_templates,omitempty"` }
Topology describes a specific view of a network. It consists of nodes and edges, and metadata about those nodes and edges, represented by EdgeMetadatas and Nodes respectively. Edges are directional, and embedded in the Node struct.
func (Topology) AddNode ¶ added in v0.7.0
AddNode adds node to the topology under key nodeID; if a node already exists for this key, nmd is merged with that node. The same topology is returned to enable chaining. This method is different from all the other similar methods in that it mutates the Topology, to solve issues of GC pressure.
func (Topology) GetShape ¶ added in v0.15.0
GetShape returns the current topology shape, or the default if there isn't one.
func (Topology) Merge ¶
Merge merges the other object into this one, and returns the result object. The original is not modified.
func (Topology) Validate ¶ added in v0.3.0
Validate checks the topology for various inconsistencies.
func (Topology) WithLabel ¶ added in v0.15.0
WithLabel sets the label terminology of this topology, returning a new topology.
func (Topology) WithMetadataTemplates ¶ added in v0.14.0
func (t Topology) WithMetadataTemplates(other MetadataTemplates) Topology
WithMetadataTemplates merges some metadata templates into this topology, returning a new topology.
func (Topology) WithMetricTemplates ¶ added in v0.14.0
func (t Topology) WithMetricTemplates(other MetricTemplates) Topology
WithMetricTemplates merges some metadata templates into this topology, returning a new topology.
func (Topology) WithShape ¶ added in v0.15.0
WithShape sets the shape of nodes from this topology, returning a new topology.
func (Topology) WithTableTemplates ¶ added in v0.15.0
func (t Topology) WithTableTemplates(other TableTemplates) Topology
WithTableTemplates merges some table templates into this topology, returning a new topology.
type WireMetrics ¶ added in v0.10.0
type WireMetrics struct { Samples []Sample `json:"samples,omitempty"` Min float64 `json:"min"` Max float64 `json:"max"` First string `json:"first,omitempty"` Last string `json:"last,omitempty"` }
WireMetrics is the on-the-wire representation of Metrics. Only needed for backwards compatibility with probes (time.Time is encoded in binary in MsgPack)
func (WireMetrics) FromIntermediate ¶ added in v0.13.0
func (m WireMetrics) FromIntermediate() Metric
FromIntermediate obtains the metric from a representation suitable for serialization.