Documentation ¶
Index ¶
- Constants
- Variables
- func AddLocalBridge(name string) error
- func ExtractHostID(m Node) string
- func LocalAddresses() ([]net.IP, error)
- func MakeAddressNodeID(hostID, address string) string
- func MakeContainerImageNodeID(containerImageID string) string
- func MakeContainerNodeID(containerID string) string
- func MakeEndpointNodeID(hostID, address, port string) string
- func MakeHostNodeID(hostID string) string
- func MakeOverlayNodeID(peerName string) string
- func MakePodNodeID(namespaceID, podID string) string
- func MakeProcessNodeID(hostID, pid string) string
- func MakeScopedAddressNodeID(hostID, address string) string
- func MakeScopedEndpointNodeID(hostID, address, port string) string
- func MakeServiceNodeID(namespaceID, serviceID string) string
- func ParseAddressNodeID(addressNodeID string) (hostID, address string, ok bool)
- func ParseContainerNodeID(containerNodeID string) (containerID string, ok bool)
- func ParseEndpointNodeID(endpointNodeID string) (hostID, 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) GobDecode(input []byte) error
- func (m LatestMap) GobEncode() ([]byte, error)
- 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) Add(t time.Time, v float64) Metric
- func (m *Metric) CodecDecodeSelf(decoder *codec.Decoder)
- func (m *Metric) CodecEncodeSelf(encoder *codec.Encoder)
- func (m Metric) Copy() Metric
- func (m Metric) Div(n float64) Metric
- func (m *Metric) GobDecode(input []byte) error
- func (m Metric) GobEncode() ([]byte, error)
- func (m Metric) LastSample() *Sample
- 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) WithFirst(t time.Time) Metric
- func (m Metric) WithMax(max float64) Metric
- type MetricRow
- type MetricRowsByPriority
- type MetricTemplate
- type MetricTemplates
- type Metrics
- type Networks
- type Node
- func (n Node) After(other Node) bool
- func (n Node) Before(other Node) bool
- func (n Node) Copy() Node
- func (n Node) Equal(other Node) bool
- func (n Node) Merge(other Node) Node
- func (n Node) Prune() 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) 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 Probe
- type Probes
- type Report
- 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) 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 Topology
- func (t Topology) AddNode(nodeID string, node Node) Topology
- func (t Topology) Copy() Topology
- func (t Topology) Merge(other Topology) Topology
- func (t Topology) Validate() error
- func (t Topology) WithMetadataTemplates(other MetadataTemplates) Topology
- func (t Topology) WithMetricTemplates(other MetricTemplates) Topology
- type WireMetrics
- type WireNodeControls
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 = "|" )
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" ContainerImage = "container_image" Host = "host" Overlay = "overlay" // 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 TheInternet = "theinternet"
TheInternet is used as a node ID to indicate a remote IP.
Variables ¶
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 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 MakeContainerImageNodeID ¶ added in v0.12.0
MakeContainerImageNodeID produces a container image node ID from its composite parts.
func MakeContainerNodeID ¶ added in v0.3.0
MakeContainerNodeID produces a container node ID from its composite parts.
func MakeEndpointNodeID ¶ added in v0.3.0
MakeEndpointNodeID produces an endpoint node ID from its composite parts.
func MakeHostNodeID ¶ added in v0.3.0
MakeHostNodeID produces a host 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 MakePodNodeID ¶ added in v0.9.0
MakePodNodeID produces a pod node ID from its composite parts.
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 witha scope.
func MakeServiceNodeID ¶ added in v0.9.0
MakeServiceNodeID produces a service node ID from its composite parts.
func ParseAddressNodeID ¶ added in v0.7.0
ParseAddressNodeID produces the host ID, address from an address node ID.
func ParseContainerNodeID ¶ added in v0.7.0
ParseContainerNodeID produces the container id from an container node ID.
func ParseEndpointNodeID ¶ added in v0.5.0
ParseEndpointNodeID produces the host ID, address, and port and remainder (typically an address) from an endpoint node ID. 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 }
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 returns a fresh Controls, c added 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
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 (Metric) Add ¶ added in v0.10.0
Add returns a new Metric with (t, v) added to its Samples. Add is the only valid way to grow a Metric.
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) Copy ¶ added in v0.10.0
Copy returns a value copy of the Metric. Metric is immutable, so we can skip this.
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 returns the last sample in the metric, or nil if there are no samples.
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 MakeNode ¶ added in v0.7.0
func MakeNode() Node
MakeNode creates a new Node with no initial metadata.
func MakeNodeWith ¶ added in v0.7.0
MakeNodeWith creates a new Node with the supplied map.
func (Node) Merge ¶ added in v0.7.0
Merge mergses the individual components of a node and returns a fresh node.
func (Node) Prune ¶ added in v0.14.0
Prune returns a copy of the Node with all information not strictly necessary for rendering nodes and edges stripped away. Specifically, that means cutting out parts of the 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. Its is 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) 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 Probes ¶ added in v0.14.0
Probes contains details of the probe(s) which generated a report.
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 // 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"` // Probes is the details of the probes who reported this report Probes Probes }
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 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) Topologies ¶ added in v0.3.0
Topologies returns a slice of Topologies in this report
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 Topology ¶
type Topology struct { Nodes `json:"nodes"` Controls `json:"controls,omitempty"` MetadataTemplates `json:"metadata_templates,omitempty"` MetricTemplates `json:"metric_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) 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) 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.
type WireMetrics ¶ added in v0.10.0
type WireMetrics struct { Samples []Sample `json:"samples,omitempty"` // On the wire, samples are sorted oldest to newest, Min float64 `json:"min"` // the opposite order to how we store them internally. Max float64 `json:"max"` First string `json:"first,omitempty"` Last string `json:"last,omitempty"` }
WireMetrics is the on-the-wire representation of Metrics.
func (WireMetrics) FromIntermediate ¶ added in v0.13.0
func (m WireMetrics) FromIntermediate() Metric
FromIntermediate obtains the metric from a representation suitable for serialization.
type WireNodeControls ¶ added in v0.11.0
type WireNodeControls struct { Timestamp string `json:"timestamp,omitempty"` Controls StringSet `json:"controls,omitempty"` }
WireNodeControls is the intermediate type for json encoding.