Documentation ¶
Index ¶
- Constants
- func AddressIP(id string) net.IP
- func AddressIPPort(id string) net.IP
- type Adjacency
- type AggregateMetadata
- type ByID
- type DetailedNode
- type Diff
- type EdgeMetadata
- type EdgeMetadatas
- type HostMetadata
- type HostMetadatas
- type IDAddresser
- type IDList
- type MapFunc
- type MappedNode
- func GenericGroupedPseudoNode(src string, srcMapped RenderableNode, dst string) (MappedNode, bool)
- func GenericPseudoNode(src string, srcMapped RenderableNode, dst string) (MappedNode, bool)
- func InternetOnlyPseudoNode(_ string, _ RenderableNode, dst string) (MappedNode, bool)
- func NetworkHostname(_ string, m NodeMetadata) (MappedNode, bool)
- func ProcessContainer(_ string, m NodeMetadata) (MappedNode, bool)
- func ProcessContainerImage(_ string, m NodeMetadata) (MappedNode, bool)
- func ProcessName(_ string, m NodeMetadata) (MappedNode, bool)
- func ProcessPID(_ string, m NodeMetadata) (MappedNode, bool)
- type NodeMetadata
- type NodeMetadatas
- type PseudoFunc
- type RenderableNode
- type Report
- type Row
- type Table
- type Topology
Constants ¶
const ( // KeyBytesIngress is the aggregate metadata key for the total count of // ingress bytes. KeyBytesIngress = "ingress_bytes" // KeyBytesEgress is the aggregate metadata key for the total count of // egress bytes. KeyBytesEgress = "egress_bytes" // KeyMaxConnCountTCP is the aggregate metadata key for the maximum number // of simultaneous observed TCP connections in the window. KeyMaxConnCountTCP = "max_conn_count_tcp" )
const ( // ScopeDelim separates the scope portion of an address from the address // string itself. ScopeDelim = ";" // IDDelim separates fields in a node ID. IDDelim = "|" )
const ( // TheInternet is the ID that we assign to the super-node composed of all // remote nodes that have been squashed together. TheInternet = "theinternet" )
Variables ¶
This section is empty.
Functions ¶
func AddressIP ¶
AddressIP translates "scope;ip" to the IP address. These are used by Network topologies.
func AddressIPPort ¶
AddressIPPort translates "scope;ip;port" to the IP address. These are used by Process topologies.
Types ¶
type Adjacency ¶
Adjacency is an adjacency-list encoding of the topology. Keys are node IDs, as produced by the relevant MappingFunc for the topology.
type AggregateMetadata ¶
AggregateMetadata is a composable version of an EdgeMetadata. It's used when we want to merge nodes/edges for any reason.
Even though we base it on EdgeMetadata, we can apply it to nodes, by summing up (merging) all of the {ingress, egress} metadatas of the {incoming, outgoing} edges to the node.
func (*AggregateMetadata) Merge ¶
func (r *AggregateMetadata) Merge(other AggregateMetadata)
Merge adds the fields from AggregateMetadata to r. r must be initialized.
type DetailedNode ¶
type DetailedNode struct { ID string `json:"id"` LabelMajor string `json:"label_major"` LabelMinor string `json:"label_minor,omitempty"` Pseudo bool `json:"pseudo,omitempty"` Tables []Table `json:"tables"` }
DetailedNode is the data type that's yielded to the JavaScript layer when we want deep information about an individual node.
type Diff ¶
type Diff struct { Add []RenderableNode `json:"add"` Update []RenderableNode `json:"update"` Remove []string `json:"remove"` }
Diff is returned by TopoDiff. It represents the changes between two RenderableNode maps.
func TopoDiff ¶
func TopoDiff(a, b map[string]RenderableNode) Diff
TopoDiff gives you the diff to get from A to B.
type EdgeMetadata ¶
type EdgeMetadata struct { WithBytes bool `json:"with_bytes,omitempty"` BytesIngress uint `json:"bytes_ingress,omitempty"` // dst -> src BytesEgress uint `json:"bytes_egress,omitempty"` // src -> dst WithConnCountTCP bool `json:"with_conn_count_tcp,omitempty"` MaxConnCountTCP uint `json:"max_conn_count_tcp,omitempty"` }
EdgeMetadata describes a superset of the metadata that probes can conceivably (and usefully) collect about an edge between two nodes in any topology.
func (*EdgeMetadata) Flatten ¶
func (m *EdgeMetadata) Flatten(other EdgeMetadata)
Flatten sums two EdgeMetadatas, their 'Window's should be the same size. The two EdgeMetadatas should represent different edges at the same time.
func (*EdgeMetadata) Merge ¶
func (m *EdgeMetadata) Merge(other EdgeMetadata)
Merge merges another EdgeMetadata into the receiver. The two edge metadatas should represent the same edge on different times.
func (EdgeMetadata) Transform ¶
func (md EdgeMetadata) Transform() AggregateMetadata
Transform calculates a AggregateMetadata from an EdgeMetadata.
type EdgeMetadatas ¶
type EdgeMetadatas map[string]EdgeMetadata
EdgeMetadatas collect metadata about each edge in a topology. Keys are a concatenation of node IDs.
func (*EdgeMetadatas) Merge ¶
func (e *EdgeMetadatas) Merge(other EdgeMetadatas)
Merge merges another EdgeMetadatas into the receiver. If other is from another probe this is the union of both metadatas. Keys present in both are summed.
type HostMetadata ¶
type HostMetadata struct { Timestamp time.Time Hostname string LocalNets []*net.IPNet OS string LoadOne, LoadFive, LoadFifteen float64 }
HostMetadata describes metadata that probes can collect about the host that they run on. It has a timestamp when the measurement was made.
func (*HostMetadata) UnmarshalJSON ¶
func (m *HostMetadata) UnmarshalJSON(data []byte) error
UnmarshalJSON is a custom JSON deserializer for HostMetadata to deal with the Localnets.
type HostMetadatas ¶
type HostMetadatas map[string]HostMetadata
HostMetadatas contains metadata about the host(s) represented in the Report.
func (HostMetadatas) LocalNets ¶
func (m HostMetadatas) LocalNets() []*net.IPNet
LocalNets gives the union of all local network IPNets for all hosts represented in the HostMetadatas.
func (*HostMetadatas) Merge ¶
func (e *HostMetadatas) Merge(other HostMetadatas)
Merge merges another HostMetadata into the receiver. It'll takes the lastest version if there are conflicts.
type IDAddresser ¶
IDAddresser is used to get the IP address from an addressID. Or nil.
type IDList ¶
type IDList []string
IDList is a list of string IDs, which are always sorted and without duplicates.
type MapFunc ¶
type MapFunc func(string, NodeMetadata) (MappedNode, bool)
MapFunc is anything which can take an arbitrary NodeMetadata, which is always one-to-one with nodes in a topology, and return a specific representation of the referenced node, in the form of a node ID and a human-readable major and minor labels.
A single NodeMetadata can yield arbitrary many representations, including representations that reduce the cardinality of the set of nodes.
If the final output parameter is false, the node shall be omitted from the rendered topology.
type MappedNode ¶
MappedNode is returned by the MapFuncs.
func GenericGroupedPseudoNode ¶ added in v0.1.0
func GenericGroupedPseudoNode(src string, srcMapped RenderableNode, dst string) (MappedNode, bool)
GenericGroupedPseudoNode contains heuristics for building sensible pseudo nodes. It should go away.
func GenericPseudoNode ¶ added in v0.1.0
func GenericPseudoNode(src string, srcMapped RenderableNode, dst string) (MappedNode, bool)
GenericPseudoNode contains heuristics for building sensible pseudo nodes. It should go away.
func InternetOnlyPseudoNode ¶ added in v0.1.0
func InternetOnlyPseudoNode(_ string, _ RenderableNode, dst string) (MappedNode, bool)
InternetOnlyPseudoNode never creates a pseudo node, unless it's the Internet.
func NetworkHostname ¶
func NetworkHostname(_ string, m NodeMetadata) (MappedNode, bool)
NetworkHostname takes a node NodeMetadata from a Network topology, and returns a representation based on the hostname. Major label is the hostname, the minor label is the domain, if any.
func ProcessContainer ¶ added in v0.1.0
func ProcessContainer(_ string, m NodeMetadata) (MappedNode, bool)
ProcessContainer maps Process topology nodes to the containers they run in. We consider container and image IDs to be globally unique, and so don't scope them further by e.g. host. If no container metadata is found, nodes are grouped into the Uncontained node.
func ProcessContainerImage ¶ added in v0.1.0
func ProcessContainerImage(_ string, m NodeMetadata) (MappedNode, bool)
ProcessContainerImage maps Process topology nodes to the container images they run on. If no container metadata is found, nodes are grouped into the Uncontained node.
func ProcessName ¶
func ProcessName(_ string, m NodeMetadata) (MappedNode, bool)
ProcessName takes a node NodeMetadata from a Process topology, and returns a representation with the ID based on the process name (grouping all processes with the same name together).
func ProcessPID ¶
func ProcessPID(_ string, m NodeMetadata) (MappedNode, bool)
ProcessPID takes a node NodeMetadata from a Process topology, and returns a representation with the ID based on the process PID and the labels based on the process name.
type NodeMetadata ¶
NodeMetadata describes a superset of the metadata that probes can collect about a given node in a given topology. Right now it's a weakly-typed map, which should probably change (see comment on type MapFunc).
type NodeMetadatas ¶
type NodeMetadatas map[string]NodeMetadata
NodeMetadatas collect metadata about each node in a topology. Keys are node IDs.
func (*NodeMetadatas) Merge ¶
func (m *NodeMetadatas) Merge(other NodeMetadatas)
Merge merges another NodeMetadatas into the receiver.
type PseudoFunc ¶ added in v0.1.0
type PseudoFunc func(srcNodeID string, srcNode RenderableNode, dstNodeID string) (MappedNode, bool)
PseudoFunc creates MappedNode representing pseudo nodes given the dstNodeID. The srcNode renderable node is essentially from MapFunc, representing one of the rendered nodes this pseudo node refers to. srcNodeID and dstNodeID are node IDs prior to mapping.
type RenderableNode ¶
type RenderableNode struct { ID string `json:"id"` // LabelMajor string `json:"label_major"` // e.g. "process", human-readable LabelMinor string `json:"label_minor,omitempty"` // e.g. "hostname", human-readable, optional Rank string `json:"rank"` // to help the layout engine Pseudo bool `json:"pseudo,omitempty"` // sort-of a placeholder node, for rendering purposes Adjacency IDList `json:"adjacency,omitempty"` // Node IDs (in the same topology domain) OriginHosts IDList `json:"origin_hosts,omitempty"` // Which hosts contributed information to this node OriginNodes IDList `json:"origin_nodes,omitempty"` // Which origin nodes (depends on topology) contributed Metadata AggregateMetadata `json:"metadata"` // Numeric sums }
RenderableNode is the data type that's yielded to the JavaScript layer as an element of a topology. It should contain information that's relevant to rendering a node when there are many nodes visible at once.
type Report ¶
type Report struct { Process Topology // Transport Topology Network Topology HostMetadatas }
Report is the internal structure produced and emitted by the probe, and operated-on (e.g. merged) by intermediaries and the app. The probe may fill in as many topologies as it's capable of producing, including none.
Process, [Transport,] and Network topologies are distinct because the data sources are distinct. That is, the Process topology can only be populated by extant connections between processes, but the Network topology may be populated from e.g. system-level data sources.
Since the data sources are fundamentally different for each topology, it might make sense to make them more distinct in the user interface.
func NewReport ¶
func NewReport() Report
NewReport makes a clean report, ready to Merge() other reports into.
func (Report) SquashRemote ¶
SquashRemote folds all remote nodes into a special supernode. It uses the LocalNets of the hosts in HostMetadata to determine which addresses are local.
type Row ¶
type Row struct { Key string `json:"key"` // e.g. Ingress ValueMajor string `json:"value_major"` // e.g. 25 ValueMinor string `json:"value_minor,omitempty"` // e.g. KB/s }
Row is a single entry in a Table dataset.
type Table ¶
type Table struct { Title string `json:"title"` // e.g. Bandwidth Numeric bool `json:"numeric"` // should the major column be right-aligned? Rows []Row `json:"rows"` }
Table is a dataset associated with a node. It will be displayed in the detail panel when a user clicks on a node.
type Topology ¶
type Topology struct { Adjacency EdgeMetadatas NodeMetadatas }
Topology describes a specific view of a network. It consists of nodes and edges, represented by Adjacency, and metadata about those nodes and edges, represented by EdgeMetadatas and NodeMetadatas respectively.
func Squash ¶
func Squash(t Topology, f IDAddresser, localNets []*net.IPNet) Topology
Squash takes a Topology, and folds all remote nodes into a supernode.
func (Topology) EdgeMetadata ¶
func (t Topology) EdgeMetadata(mapFunc MapFunc, srcRenderableID, dstRenderableID string) EdgeMetadata
EdgeMetadata gives the metadata of an edge from the perspective of the srcRenderableID. Since an edgeID can have multiple edges on the address level, it uses the supplied mapping function to translate address IDs to renderable node (mapped) IDs.
func (Topology) RenderBy ¶
func (t Topology) RenderBy(mapFunc MapFunc, pseudoFunc PseudoFunc) map[string]RenderableNode
RenderBy transforms a given Topology into a set of RenderableNodes, which the UI will render collectively as a graph. Note that a RenderableNode will always be rendered with other nodes, and therefore contains limited detail.
RenderBy takes a a MapFunc, which defines how to group and label nodes. Npdes with the same mapped IDs will be merged.