report

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DateTime is an ISO timestamp of the format "2017-07-03T09:45:00.329067309Z"
	DateTime = "datetime"

	// Duration specified in seconds, e.g. "3600" means one hour
	Duration = "duration"

	// IP is a string in the format "182.43.147.201"
	IP = "ip"

	// Number as an integer or a floating point
	Number = "number"
)
View Source
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"

	// WeaveOverlayPeerPrefix is the prefix for weave peers in the overlay network
	WeaveOverlayPeerPrefix = ""

	// DockerOverlayPeerPrefix is the prefix for docker peers in the overlay network
	DockerOverlayPeerPrefix = "docker_peer_"
)

Delimiters are used to separate parts of node IDs, to guarantee uniqueness in particular contexts.

View Source
const (
	// probe/endpoint
	ReverseDNSNames = "reverse_dns_names"
	SnoopedDNSNames = "snooped_dns_names"
	CopyOf          = "copy_of"
	// probe/process
	PID     = "pid"
	Name    = "name" // also used by probe/docker
	PPID    = "ppid"
	Cmdline = "cmdline"
	Threads = "threads"
	// probe/docker
	DockerContainerID            = "docker_container_id"
	DockerImageID                = "docker_image_id"
	DockerImageName              = "docker_image_name"
	DockerImageTag               = "docker_image_tag"
	DockerImageSize              = "docker_image_size"
	DockerImageVirtualSize       = "docker_image_virtual_size"
	DockerIsInHostNetwork        = "docker_is_in_host_network"
	DockerServiceName            = "service_name"
	DockerStackNamespace         = "stack_namespace"
	DockerDefaultNamespace       = "No stack"
	DockerStopContainer          = "docker_stop_container"
	DockerStartContainer         = "docker_start_container"
	DockerRestartContainer       = "docker_restart_container"
	DockerPauseContainer         = "docker_pause_container"
	DockerUnpauseContainer       = "docker_unpause_container"
	DockerRemoveContainer        = "docker_remove_container"
	DockerAttachContainer        = "docker_attach_container"
	DockerExecContainer          = "docker_exec_container"
	DockerContainerName          = "docker_container_name"
	DockerContainerCommand       = "docker_container_command"
	DockerContainerPorts         = "docker_container_ports"
	DockerContainerCreated       = "docker_container_created"
	DockerContainerNetworks      = "docker_container_networks"
	DockerContainerIPs           = "docker_container_ips"
	DockerContainerHostname      = "docker_container_hostname"
	DockerContainerIPsWithScopes = "docker_container_ips_with_scopes"
	DockerContainerState         = "docker_container_state"
	DockerContainerStateHuman    = "docker_container_state_human"
	DockerContainerUptime        = "docker_container_uptime"
	DockerContainerRestartCount  = "docker_container_restart_count"
	DockerContainerNetworkMode   = "docker_container_network_mode"
	DockerEnvPrefix              = "docker_env_"
	// probe/kubernetes
	KubernetesName                 = "kubernetes_name"
	KubernetesNamespace            = "kubernetes_namespace"
	KubernetesCreated              = "kubernetes_created"
	KubernetesIP                   = "kubernetes_ip"
	KubernetesObservedGeneration   = "kubernetes_observed_generation"
	KubernetesReplicas             = "kubernetes_replicas"
	KubernetesDesiredReplicas      = "kubernetes_desired_replicas"
	KubernetesNodeType             = "kubernetes_node_type"
	KubernetesGetLogs              = "kubernetes_get_logs"
	KubernetesDeletePod            = "kubernetes_delete_pod"
	KubernetesScaleUp              = "kubernetes_scale_up"
	KubernetesScaleDown            = "kubernetes_scale_down"
	KubernetesUpdatedReplicas      = "kubernetes_updated_replicas"
	KubernetesAvailableReplicas    = "kubernetes_available_replicas"
	KubernetesUnavailableReplicas  = "kubernetes_unavailable_replicas"
	KubernetesStrategy             = "kubernetes_strategy"
	KubernetesFullyLabeledReplicas = "kubernetes_fully_labeled_replicas"
	KubernetesState                = "kubernetes_state"
	KubernetesIsInHostNetwork      = "kubernetes_is_in_host_network"
	KubernetesRestartCount         = "kubernetes_restart_count"
	KubernetesMisscheduledReplicas = "kubernetes_misscheduled_replicas"
	KubernetesPublicIP             = "kubernetes_public_ip"
	KubernetesSchedule             = "kubernetes_schedule"
	KubernetesSuspended            = "kubernetes_suspended"
	KubernetesLastScheduled        = "kubernetes_last_scheduled"
	KubernetesActiveJobs           = "kubernetes_active_jobs"
	KubernetesType                 = "kubernetes_type"
	KubernetesPorts                = "kubernetes_ports"
	KubernetesVolumeClaim          = "kubernetes_volume_claim"
	KubernetesStorageClassName     = "kubernetes_storage_class_name"
	KubernetesAccessModes          = "kubernetes_access_modes"
	KubernetesReclaimPolicy        = "kubernetes_reclaim_policy"
	KubernetesStatus               = "kubernetes_status"
	KubernetesMessage              = "kubernetes_message"
	KubernetesVolumeName           = "kubernetes_volume_name"
	KubernetesProvisioner          = "kubernetes_provisioner"
	KubernetesStorageDriver        = "kubernetes_storage_driver"
	KubernetesVolumeSnapshotName   = "kubernetes_volume_snapshot_name"
	KubernetesSnapshotData         = "kuberneets_snapshot_data"
	KubernetesCreateVolumeSnapshot = "kubernetes_create_volume_snapshot"
	KubernetesVolumeCapacity       = "kubernetes_volume_capacity"
	KubernetesCloneVolumeSnapshot  = "kubernetes_clone_volume_snapshot"
	KubernetesDeleteVolumeSnapshot = "kubernetes_delete_volume_snapshot"
	KubernetesDescribe             = "kubernetes_describe"
	// probe/awsecs
	ECSCluster             = "ecs_cluster"
	ECSCreatedAt           = "ecs_created_at"
	ECSTaskFamily          = "ecs_task_family"
	ECSServiceDesiredCount = "ecs_service_desired_count"
	ECSServiceRunningCount = "ecs_service_running_count"
	ECSScaleUp             = "ecs_scale_up"
	ECSScaleDown           = "ecs_scale_down"
	// probe/host
	Timestamp         = "ts"
	HostName          = "host_name"
	HostLocalNetworks = "local_networks"
	OS                = "os"
	KernelVersion     = "kernel_version"
	Uptime            = "uptime"
	Load1             = "load1"
	HostCPUUsage      = "host_cpu_usage_percent"
	HostMemoryUsage   = "host_mem_usage_bytes"
	ScopeVersion      = "host_scope_version"
	// probe/overlay/weave
	WeavePeerName     = "weave_peer_name"
	WeavePeerNickName = "weave_peer_nick_name"
)

node metadata keys

View Source
const (
	DockerLabelPrefix      = "docker_label_"
	DockerImageLabelPrefix = "docker_image_label_"

	StateCreated    = "created"
	StateDead       = "dead"
	StateExited     = "exited"
	StatePaused     = "paused"
	StateRestarting = "restarting"
	StateRunning    = "running"
	StateDeleted    = "deleted"
	StateFailed     = "Failed"
)

constants used in node metadata values

View Source
const (
	FromLatest   = "latest"
	FromSets     = "sets"
	FromCounters = "counters"
)

FromLatest and friends denote the different fields where metadata can be gathered from.

View Source
const (
	DefaultFormat  = ""
	FilesizeFormat = "filesize"
	IntegerFormat  = "integer"
	PercentFormat  = "percent"
)

DefaultFormat and friends tell the UI how to render the "Value" of this metric.

View Source
const (
	Endpoint              = "endpoint"
	Process               = "process"
	Container             = "container"
	Pod                   = "pod"
	Service               = "service"
	Deployment            = "deployment"
	ReplicaSet            = "replica_set"
	DaemonSet             = "daemon_set"
	StatefulSet           = "stateful_set"
	CronJob               = "cron_job"
	Namespace             = "namespace"
	ContainerImage        = "container_image"
	Host                  = "host"
	Overlay               = "overlay"
	ECSService            = "ecs_service"
	ECSTask               = "ecs_task"
	SwarmService          = "swarm_service"
	PersistentVolume      = "persistent_volume"
	PersistentVolumeClaim = "persistent_volume_claim"
	StorageClass          = "storage_class"
	VolumeSnapshot        = "volume_snapshot"
	VolumeSnapshotData    = "volume_snapshot_data"
	Job                   = "job"

	// Shapes used for different nodes
	Circle         = "circle"
	Triangle       = "triangle"
	Square         = "square"
	Pentagon       = "pentagon"
	Hexagon        = "hexagon"
	Heptagon       = "heptagon"
	Octagon        = "octagon"
	Cloud          = "cloud"
	Cylinder       = "cylinder"
	DottedCylinder = "dottedcylinder"
	StorageSheet   = "sheet"
	Camera         = "camera"
	DottedTriangle = "dottedtriangle"

	// Used when counting the number of containers
	ContainersKey = "containers"
)

Names of the various topologies.

View Source
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"
)
View Source
const (
	MulticolumnTableType = "multicolumn-table"
	PropertyListType     = "property-list"
)

Table types

Variables

View Source
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")

	// MakeDaemonSetNodeID produces a replica set node ID from its composite parts.
	MakeDaemonSetNodeID = makeSingleComponentID("daemonset")

	// ParseDaemonSetNodeID parses a daemon set node ID
	ParseDaemonSetNodeID = parseSingleComponentID("daemonset")

	// MakeStatefulSetNodeID produces a statefulset node ID from its composite parts.
	MakeStatefulSetNodeID = makeSingleComponentID("statefulset")

	// ParseStatefulSetNodeID parses a statefulset node ID
	ParseStatefulSetNodeID = parseSingleComponentID("statefulset")

	// MakeCronJobNodeID produces a cronjob node ID from its composite parts.
	MakeCronJobNodeID = makeSingleComponentID("cronjob")

	// ParseCronJobNodeID parses a cronjob node ID
	ParseCronJobNodeID = parseSingleComponentID("cronjob")

	// MakeJobNodeID produces a job node ID from its composite parts.
	MakeJobNodeID = makeSingleComponentID("job")

	// ParseJobNodeID parses a job node ID
	ParseJobNodeID = parseSingleComponentID("job")

	// MakeNamespaceNodeID produces a namespace node ID from its composite parts.
	MakeNamespaceNodeID = makeSingleComponentID("namespace")

	// ParseNamespaceNodeID parses a namespace set node ID
	ParseNamespaceNodeID = parseSingleComponentID("namespace")

	// MakeECSTaskNodeID produces a ECSTask node ID from its composite parts.
	MakeECSTaskNodeID = makeSingleComponentID("ecs_task")

	// ParseECSTaskNodeID parses a ECSTask node ID
	ParseECSTaskNodeID = parseSingleComponentID("ecs_task")

	// MakeSwarmServiceNodeID produces a Swarm service node ID from its composite parts.
	MakeSwarmServiceNodeID = makeSingleComponentID("swarm_service")

	// ParseSwarmServiceNodeID parses a Swarm service node ID
	ParseSwarmServiceNodeID = parseSingleComponentID("swarm_service")

	// MakePersistentVolumeNodeID produces a Persistent Volume node ID from its composite parts.
	MakePersistentVolumeNodeID = makeSingleComponentID("persistent_volume")

	// ParsePersistentVolumeNodeID parses a Persistent Volume node ID
	ParsePersistentVolumeNodeID = parseSingleComponentID("persistent_volume")

	// MakePersistentVolumeClaimNodeID produces a Persistent Volume Claim node ID from its composite parts.
	MakePersistentVolumeClaimNodeID = makeSingleComponentID("persistent_volume_claim")

	// ParsePersistentVolumeClaimNodeID parses a Persistent Volume Claim node ID
	ParsePersistentVolumeClaimNodeID = parseSingleComponentID("persistent_volume_claim")

	// MakeStorageClassNodeID produces a storage class node ID from its composite parts.
	MakeStorageClassNodeID = makeSingleComponentID("storage_class")

	// ParseStorageClassNodeID parses a storage class node ID
	ParseStorageClassNodeID = parseSingleComponentID("storage_class")

	// MakeVolumeSnapshotNodeID produces a volume snapshot node ID from its composite parts.
	MakeVolumeSnapshotNodeID = makeSingleComponentID("volume_snapshot")

	// ParseVolumeSnapshotNodeID parses a volume snapshot node ID
	ParseVolumeSnapshotNodeID = parseSingleComponentID("volume_snapshot")

	// MakeVolumeSnapshotDataNodeID produces a volume snapshot data node ID from its composite parts.
	MakeVolumeSnapshotDataNodeID = makeSingleComponentID("volume_snapshot_data")

	// ParseVolumeSnapshotDataNodeID parses a volume snapshot data node ID
	ParseVolumeSnapshotDataNodeID = parseSingleComponentID("volume_snapshot_data")
)
View Source
var LocalNetworks = MakeNetworks()

LocalNetworks helps in determining which addresses a probe reports as being host-scoped.

TODO this design is broken, make it consistent with probe networks.

Functions

func AddLocalBridge added in v0.4.0

func AddLocalBridge(name string) error

AddLocalBridge records the subnet address associated with the bridge name supplied, such that MakeAddressNodeID will scope addresses in this subnet as local.

func ContainingIPv4Network added in v1.6.3

func ContainingIPv4Network(ips []net.IP) *net.IPNet

ContainingIPv4Network determines the smallest network containing the given IPv4 addresses. When no addresses are specified, nil is returned.

func ExtractHostID added in v0.4.0

func ExtractHostID(m Node) string

ExtractHostID extracts the host id from Node

func GetLocalNetworks added in v1.6.0

func GetLocalNetworks() ([]*net.IPNet, error)

GetLocalNetworks returns all the local networks.

func IsCommandEntry added in v1.11.0

func IsCommandEntry(key string) bool

IsCommandEntry returns true iff the entry comes from a command line that might need to be conditionally censored.

func IsEnvironmentVarsEntry added in v1.11.0

func IsEnvironmentVarsEntry(key string) bool

IsEnvironmentVarsEntry returns true if the entry might expose some environment variables data might need to be conditionally censored.

func IsLoopback added in v0.17.0

func IsLoopback(address string) bool

IsLoopback ascertains if an address comes from a loopback interface.

func IsPauseImageName added in v1.11.6

func IsPauseImageName(imageName string) bool

IsPauseImageName indicates whether an image name corresponds to a kubernetes pause container image.

func LocalAddresses added in v0.9.0

func LocalAddresses() ([]net.IP, error)

LocalAddresses returns a list of the local IP addresses.

func MakeAddressNodeID added in v0.3.0

func MakeAddressNodeID(hostID, address string) string

MakeAddressNodeID produces an address node ID from its composite parts.

func MakeAddressNodeIDB added in v1.12.0

func MakeAddressNodeIDB(hostID string, addressIP net.IP) string

MakeAddressNodeIDB produces an address node ID from its composite parts, in binary not string.

func MakeECSServiceNodeID added in v1.1.0

func MakeECSServiceNodeID(cluster, serviceName string) string

MakeECSServiceNodeID produces an ECS Service node ID from its composite parts.

func MakeEndpointNodeID added in v0.3.0

func MakeEndpointNodeID(hostID, namespaceID, address, port string) string

MakeEndpointNodeID produces an endpoint node ID from its composite parts.

func MakeEndpointNodeIDB added in v1.12.0

func MakeEndpointNodeIDB(hostID string, namespaceID uint32, addressIP net.IP, port uint16) string

MakeEndpointNodeIDB produces an endpoint node ID from its composite parts in binary, not strings.

func MakeOverlayNodeID added in v0.4.0

func MakeOverlayNodeID(peerPrefix, peerName string) string

MakeOverlayNodeID produces an overlay topology node ID from a router peer's prefix and name, which is assumed to be globally unique.

func MakeProcessNodeID added in v0.3.0

func MakeProcessNodeID(hostID, pid string) string

MakeProcessNodeID produces a process node ID from its composite parts.

func MakeScopedAddressNodeID added in v0.9.0

func MakeScopedAddressNodeID(scope, address string) string

MakeScopedAddressNodeID is like MakeAddressNodeID, but it always prefixes the ID witha scope.

func MakeScopedEndpointNodeID added in v0.9.0

func MakeScopedEndpointNodeID(scope, address, port string) string

MakeScopedEndpointNodeID is like MakeEndpointNodeID, but it always prefixes the ID with a scope.

func ParseAddressNodeID added in v0.7.0

func ParseAddressNodeID(addressNodeID string) (hostID, address string, ok bool)

ParseAddressNodeID produces the host ID, address from an address node ID.

func ParseECSServiceNodeID added in v1.1.0

func ParseECSServiceNodeID(ecsServiceNodeID string) (cluster, serviceName string, ok bool)

ParseECSServiceNodeID produces the cluster, service name from an ECS Service node ID

func ParseEndpointNodeID added in v0.5.0

func ParseEndpointNodeID(endpointNodeID string) (scope, address, port string, ok bool)

ParseEndpointNodeID produces the scope, address, and port and remainder. Note that scope may be blank.

func ParseIP added in v1.6.6

func ParseIP(s []byte, into []byte) net.IP

ParseIP parses s as an IP address into a byte slice if supplied, returning the result. (mostly copied from net.ParseIP, modified to save memory allocations)

func ParseNodeID added in v0.3.0

func ParseNodeID(nodeID string) (id string, tag string, ok bool)

ParseNodeID produces the id and tag of a single-component node ID.

func ParseOverlayNodeID added in v1.0.0

func ParseOverlayNodeID(id string) (overlayPrefix string, peerName string)

ParseOverlayNodeID produces the overlay type and peer name.

func ParseProcessNodeID added in v1.7.0

func ParseProcessNodeID(processNodeID string) (hostID, pid string, ok bool)

ParseProcessNodeID produces the host ID and PID from a process node ID.

func StripCommandArgs added in v1.11.0

func StripCommandArgs(command string) string

StripCommandArgs removes all the arguments from the command

func WithoutPrefix added in v1.2.0

func WithoutPrefix(s string, prefix string) (string, bool)

WithoutPrefix returns the string with trimmed prefix and a boolean information of whether that prefix was really there. NOTE: Consider moving this function to utilities.

Types

type CensorConfig added in v1.11.0

type CensorConfig struct {
	HideCommandLineArguments bool
	HideEnvironmentVariables bool
}

CensorConfig describes how probe reports should be censored when rendered through the API.

func GetCensorConfigFromRequest added in v1.11.0

func GetCensorConfigFromRequest(req *http.Request) CensorConfig

GetCensorConfigFromRequest extracts censor config from request query params.

type Column added in v1.2.0

type Column struct {
	ID       string `json:"id"`
	Label    string `json:"label"`
	DataType string `json:"dataType"`
}

Column is the type for multi-column tables in the UI.

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
	Confirmation string `json:"confirmation,omitempty"`
	Rank         int    `json:"rank"`
}

A Control basically describes an RPC

type Controls added in v0.10.0

type Controls map[string]Control

Controls describe the control tags within the Nodes

func (Controls) AddControl added in v0.10.0

func (cs Controls) AddControl(c Control)

AddControl adds c added to cs.

func (Controls) AddControls added in v0.15.0

func (cs Controls) AddControls(controls []Control)

AddControls adds a collection of controls to cs.

func (Controls) Copy added in v0.10.0

func (cs Controls) Copy() Controls

Copy produces a copy of cs.

func (Controls) Merge added in v0.10.0

func (cs Controls) Merge(other Controls) Controls

Merge merges other with cs, returning a fresh Controls.

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) Add added in v0.12.0

func (c Counters) Add(key string, value int) Counters

Add value to the counter 'key'

func (*Counters) CodecDecodeSelf added in v0.13.0

func (c *Counters) CodecDecodeSelf(decoder *codec.Decoder)

CodecDecodeSelf implements codec.Selfer

func (*Counters) CodecEncodeSelf added in v0.13.0

func (c *Counters) CodecEncodeSelf(encoder *codec.Encoder)

CodecEncodeSelf implements codec.Selfer

func (Counters) DeepEqual added in v0.12.0

func (c Counters) DeepEqual(d Counters) bool

DeepEqual tests equality with other Counters

func (Counters) Lookup added in v0.12.0

func (c Counters) Lookup(key string) (int, bool)

Lookup the counter 'key'

func (Counters) MarshalJSON added in v0.12.0

func (Counters) MarshalJSON() ([]byte, error)

MarshalJSON shouldn't be used, use CodecEncodeSelf instead

func (Counters) Merge added in v0.7.0

func (c Counters) Merge(other Counters) Counters

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) Size added in v0.12.0

func (c Counters) Size() int

Size returns the number of counters

func (Counters) String added in v0.12.0

func (c Counters) String() string

String serializes Counters into a string.

func (*Counters) UnmarshalJSON added in v0.12.0

func (*Counters) UnmarshalJSON(b []byte) error

UnmarshalJSON shouldn't be used, use CodecDecodeSelf instead

type DNSRecord added in v1.8.0

type DNSRecord struct {
	Forward StringSet `json:"forward,omitempty"`
	Reverse StringSet `json:"reverse,omitempty"`
}

DNSRecord contains names that an IP address maps to

type DNSRecords added in v1.8.0

type DNSRecords map[string]DNSRecord

DNSRecords contains all address->name mappings for a report

func (DNSRecords) Copy added in v1.8.0

func (r DNSRecords) Copy() DNSRecords

Copy makes a copy of the DNSRecords

func (DNSRecords) FirstMatch added in v1.8.0

func (r DNSRecords) FirstMatch(id string, match func(name string) bool) (string, bool)

FirstMatch returns the first DNS name where match() returns true

func (DNSRecords) Merge added in v1.8.0

func (r DNSRecords) Merge(other DNSRecords) DNSRecords

Merge merges the other object into this one, and returns the result object. The original is not modified.

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

func MakeIDList(ids ...string) IDList

MakeIDList makes a new IDList.

func (IDList) Add

func (a IDList) Add(ids ...string) IDList

Add is the only correct way to add ids to an IDList.

func (IDList) Contains added in v0.3.0

func (a IDList) Contains(id string) bool

Contains returns true if id is in the list.

func (IDList) Equal added in v1.11.6

func (a IDList) Equal(b IDList) bool

Equal returns true if a and b have the same contents

func (IDList) Intersection added in v0.14.0

func (a IDList) Intersection(b IDList) IDList

Intersection returns the intersection of a and b

func (IDList) Merge added in v0.5.0

func (a IDList) Merge(b IDList) IDList

Merge all elements from a and b into a new list

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"`
	Truncate int     `json:"truncate,omitempty"`
}

MetadataRow is a row for the metadata table.

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) MetadataRow added in v1.7.0

func (t MetadataTemplate) MetadataRow(n Node) (MetadataRow, bool)

MetadataRow returns the row 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

Copy returns a value copy of the metadata templates

func (MetadataTemplates) Merge added in v0.14.0

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

type Metric struct {
	Samples []Sample `json:"samples,omitempty"`
	Min     float64  `json:"min"`
	Max     float64  `json:"max"`
}

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

func MakeMetric(samples []Sample) Metric

MakeMetric makes a new Metric from unique samples incrementally ordered in time.

func MakeSingletonMetric added in v0.17.0

func MakeSingletonMetric(t time.Time, v float64) Metric

MakeSingletonMetric makes a metric with a single value

func (Metric) LastSample added in v0.10.0

func (m Metric) LastSample() (Sample, bool)

LastSample obtains the last sample of the metric

func (Metric) Len added in v0.10.0

func (m Metric) Len() int

Len returns the number of samples in the metric.

func (Metric) Merge added in v0.10.0

func (m Metric) Merge(other Metric) Metric

Merge combines the two Metrics and returns a new result.

func (Metric) WithMax added in v0.11.0

func (m Metric) WithMax(max float64) Metric

WithMax returns a fresh copy of m, with Max set to max

type MetricRow added in v0.14.0

type MetricRow struct {
	ID         string
	Label      string
	Format     string
	Group      string
	Value      float64
	ValueEmpty bool
	Priority   float64
	URL        string
	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

func (m *MetricRow) CodecDecodeSelf(decoder *codec.Decoder)

CodecDecodeSelf implements codec.Selfer

func (*MetricRow) CodecEncodeSelf added in v0.14.0

func (m *MetricRow) CodecEncodeSelf(encoder *codec.Encoder)

CodecEncodeSelf marshals this MetricRow. It takes the basic Metric rendering, then adds some row-specific fields.

func (MetricRow) MarshalJSON added in v0.14.0

func (MetricRow) MarshalJSON() ([]byte, error)

MarshalJSON shouldn't be used, use CodecEncodeSelf instead

func (MetricRow) Summary added in v0.14.0

func (m MetricRow) Summary() MetricRow

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

func (*MetricRow) UnmarshalJSON(b []byte) error

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) MetricRow added in v1.7.0

func (t MetricTemplate) MetricRow(n Node) (MetricRow, bool)

MetricRow returns the row 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

Copy returns a value copy of the metadata templates

func (MetricTemplates) Merge added in v0.14.0

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

type Metrics map[string]Metric

Metrics is a string->metric map.

func (Metrics) Copy added in v0.10.0

func (m Metrics) Copy() Metrics

Copy returns a value copy of the sets map.

func (Metrics) Lookup added in v0.14.0

func (m Metrics) Lookup(key string) (Metric, bool)

Lookup the metric for the given key

func (Metrics) Merge added in v0.10.0

func (m Metrics) Merge(other Metrics) Metrics

Merge merges two sets maps into a fresh set, performing set-union merges as appropriate.

type Networks added in v0.4.0

type Networks struct{ *critbitgo.Net }

Networks represent a set of subnets

func MakeNetworks added in v1.6.0

func MakeNetworks() Networks

MakeNetworks creates a datastructure representing a set of networks.

func (Networks) Add added in v1.6.0

func (n Networks) Add(ipnet *net.IPNet) error

Add adds a network.

func (Networks) AddCIDR added in v1.6.0

func (n Networks) AddCIDR(cidr string) error

AddCIDR adds a network, represented as CIDR.

func (Networks) Contains added in v0.4.0

func (n Networks) Contains(ip net.IP) bool

Contains returns true if IP is in Networks.

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,omitempty"`
	LatestControls NodeControlDataLatestMap `json:"latestControls,omitempty"`
	Latest         StringLatestMap          `json:"latest,omitempty"`
	Metrics        Metrics                  `json:"metrics,omitempty" deepequal:"nil==empty"`
	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 (aka adjacency) emanating from the node.

func MakeNode added in v0.7.0

func MakeNode(id string) Node

MakeNode creates a new Node with no initial metadata.

func MakeNodeWith added in v0.7.0

func MakeNodeWith(id string, m map[string]string) Node

MakeNodeWith creates a new Node with the supplied map.

func (Node) AddPrefixMulticolumnTable added in v1.2.0

func (node Node) AddPrefixMulticolumnTable(prefix string, rows []Row) Node

AddPrefixMulticolumnTable appends arbitrary rows to the Node, returning a new node.

func (Node) AddPrefixPropertyList added in v1.2.0

func (node Node) AddPrefixPropertyList(prefix string, propertyList map[string]string) Node

AddPrefixPropertyList appends arbitrary key-value pairs to the Node, returning a new node.

func (Node) After added in v0.12.0

func (n Node) After(other Node) bool

After is used for sorting nodes by topology and id

func (Node) Before added in v0.12.0

func (n Node) Before(other Node) bool

Before is used for sorting nodes by topology and id

func (Node) Equal added in v0.12.0

func (n Node) Equal(other Node) bool

Equal is used for comparing nodes by topology and id

func (Node) ExtractMulticolumnTable added in v1.2.0

func (node Node) ExtractMulticolumnTable(template TableTemplate) (rows []Row)

ExtractMulticolumnTable returns the rows to build a multicolumn table from this node

func (Node) ExtractPropertyList added in v1.2.0

func (node Node) ExtractPropertyList(template TableTemplate) (rows []Row)

ExtractPropertyList returns the rows to build a property list from this node

func (Node) ExtractTable added in v0.15.0

func (node Node) ExtractTable(template TableTemplate) (rows []Row, truncationCount int)

ExtractTable returns the rows to build either a property list or a generic table from this node. It also returns the number of rows, if any, that were truncated. The probes used to limit the number of labels, env vars and Weave Net connections they report, but this logic has since been removed. So the code here dealing with truncation is only retained in order to handle legacy reports.

func (Node) Merge added in v0.7.0

func (n Node) Merge(other Node) Node

Merge mergses the individual components of a node and returns a fresh node.

func (Node) PruneParents added in v0.14.0

func (n Node) PruneParents() Node

PruneParents returns a fresh copy of n, without any parents.

func (*Node) UnsafeUnMerge added in v1.11.6

func (n *Node) UnsafeUnMerge(other Node) bool

UnsafeUnMerge removes data from n that would be added by merging other, modifying the original. returns true if n.Merge(other) is the same as n

func (Node) WithAdjacent added in v0.7.0

func (n Node) WithAdjacent(a ...string) Node

WithAdjacent returns a fresh copy of n, with 'a' added to Adjacency

func (Node) WithChild added in v0.14.0

func (n Node) WithChild(child Node) Node

WithChild returns a fresh copy of n, with one child merged in.

func (Node) WithChildren added in v0.14.0

func (n Node) WithChildren(children NodeSet) Node

WithChildren returns a fresh copy of n, with children merged in.

func (Node) WithCounters added in v0.7.0

func (n Node) WithCounters(c map[string]int) Node

WithCounters returns a fresh copy of n, with Counters c merged in.

func (Node) WithID added in v0.12.0

func (n Node) WithID(id string) Node

WithID returns a fresh copy of n, with ID changed.

func (Node) WithLatest added in v0.10.0

func (n Node) WithLatest(k string, ts time.Time, v string) Node

WithLatest produces a new Node with k mapped to v in the Latest metadata.

func (Node) WithLatestActiveControls added in v1.0.0

func (n Node) WithLatestActiveControls(cs ...string) Node

WithLatestActiveControls returns a fresh copy of n, with active controls cs added to LatestControls.

func (Node) WithLatestControl added in v1.0.0

func (n Node) WithLatestControl(control string, ts time.Time, data NodeControlData) Node

WithLatestControl produces a new Node with control added to it

func (Node) WithLatestControls added in v1.0.0

func (n Node) WithLatestControls(lcs map[string]NodeControlData) Node

WithLatestControls returns a fresh copy of n, with lcs added to LatestControls.

func (Node) WithLatests added in v0.12.0

func (n Node) WithLatests(m map[string]string) Node

WithLatests returns a fresh copy of n, with Metadata m merged in.

func (Node) WithMetric added in v0.10.0

func (n Node) WithMetric(key string, metric Metric) Node

WithMetric returns a fresh copy of n, with metric merged in at key.

func (Node) WithMetrics added in v0.10.0

func (n Node) WithMetrics(metrics Metrics) Node

WithMetrics returns a fresh copy of n, with metrics merged in.

func (Node) WithParent added in v1.9.1

func (n Node) WithParent(key, parent string) Node

WithParent returns a fresh copy of n, with one parent added

func (Node) WithParents added in v0.12.0

func (n Node) WithParents(parents Sets) Node

WithParents returns a fresh copy of n, with sets merged in.

func (Node) WithSet added in v0.10.0

func (n Node) WithSet(key string, set StringSet) Node

WithSet returns a fresh copy of n, with set merged in at key.

func (Node) WithSets added in v0.10.0

func (n Node) WithSets(sets Sets) Node

WithSets returns a fresh copy of n, with sets merged in.

func (Node) WithTopology added in v0.12.0

func (n Node) WithTopology(topology string) Node

WithTopology returns a fresh copy of n, with ID changed.

type NodeControlData added in v1.0.0

type NodeControlData struct {
	Dead bool `json:"dead"`
}

NodeControlData contains specific information about the control. It is used as a Value field of LatestEntry in NodeControlDataLatestMap.

type NodeControlDataLatestMap added in v1.0.0

type NodeControlDataLatestMap []nodeControlDataLatestEntry

NodeControlDataLatestMap holds latest NodeControlData instances, as a slice sorted by key.

func MakeNodeControlDataLatestMap added in v1.0.0

func MakeNodeControlDataLatestMap() NodeControlDataLatestMap

MakeNodeControlDataLatestMap makes an empty NodeControlDataLatestMap.

func (*NodeControlDataLatestMap) CodecDecodeSelf added in v1.0.0

func (m *NodeControlDataLatestMap) CodecDecodeSelf(decoder *codec.Decoder)

CodecDecodeSelf implements codec.Selfer. Decodes the input as for a built-in map, without creating an intermediate copy of the data structure to save time. Uses undocumented, internal APIs as for CodecEncodeSelf.

func (NodeControlDataLatestMap) CodecEncodeSelf added in v1.0.0

func (m NodeControlDataLatestMap) CodecEncodeSelf(encoder *codec.Encoder)

CodecEncodeSelf implements codec.Selfer. Duplicates the output for a built-in map without generating an intermediate copy of the data structure, to save time. 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 (NodeControlDataLatestMap) DeepEqual added in v1.0.0

DeepEqual tests equality with other NodeControlDataLatestMap.

func (NodeControlDataLatestMap) EqualIgnoringTimestamps added in v1.11.6

func (m NodeControlDataLatestMap) EqualIgnoringTimestamps(n NodeControlDataLatestMap) bool

EqualIgnoringTimestamps returns true if all keys and values are the same.

func (NodeControlDataLatestMap) ForEach added in v1.0.0

func (m NodeControlDataLatestMap) ForEach(fn func(k string, timestamp time.Time, v NodeControlData))

ForEach executes fn on each key value pair in the map.

func (NodeControlDataLatestMap) Lookup added in v1.0.0

Lookup the value for the given key.

func (NodeControlDataLatestMap) LookupEntry added in v1.0.0

LookupEntry returns the raw entry for the given key.

func (NodeControlDataLatestMap) MarshalJSON added in v1.0.0

func (NodeControlDataLatestMap) MarshalJSON() ([]byte, error)

MarshalJSON shouldn't be used, use CodecEncodeSelf instead.

func (NodeControlDataLatestMap) Merge added in v1.0.0

Merge produces a NodeControlDataLatestMap containing the keys from both inputs. When both inputs contain the same key, the newer value is used. Tries to return one of its inputs, if that already holds the correct result.

func (NodeControlDataLatestMap) Set added in v1.0.0

Set the value for the given key.

func (NodeControlDataLatestMap) Size added in v1.0.0

func (m NodeControlDataLatestMap) Size() int

Size returns the number of elements.

func (NodeControlDataLatestMap) String added in v1.0.0

func (m NodeControlDataLatestMap) String() string

String returns the NodeControlDataLatestMap's string representation.

func (*NodeControlDataLatestMap) UnmarshalJSON added in v1.0.0

func (*NodeControlDataLatestMap) 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

func MakeNodeSet(nodes ...Node) NodeSet

MakeNodeSet makes a new NodeSet with the given nodes.

func (NodeSet) Add added in v0.12.0

func (n NodeSet) Add(nodes ...Node) NodeSet

Add adds the nodes to the NodeSet, and returns the NodeSet to enable chaining.

func (*NodeSet) CodecDecodeSelf added in v0.13.0

func (n *NodeSet) CodecDecodeSelf(decoder *codec.Decoder)

CodecDecodeSelf implements codec.Selfer

func (*NodeSet) CodecEncodeSelf added in v0.13.0

func (n *NodeSet) CodecEncodeSelf(encoder *codec.Encoder)

CodecEncodeSelf implements codec.Selfer

func (NodeSet) Copy added in v0.12.0

func (n NodeSet) Copy() NodeSet

Copy returns a value copy of the Nodes.

func (NodeSet) DeepEqual added in v0.12.0

func (n NodeSet) DeepEqual(o NodeSet) bool

DeepEqual tests equality with other NodeSets

func (NodeSet) Delete added in v0.15.0

func (n NodeSet) Delete(ids ...string) NodeSet

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

func (n NodeSet) ForEach(f func(Node))

ForEach executes f for each node in the set.

func (NodeSet) Lookup added in v0.12.0

func (n NodeSet) Lookup(key string) (Node, bool)

Lookup the node 'key'

func (NodeSet) MarshalJSON added in v0.12.0

func (NodeSet) MarshalJSON() ([]byte, error)

MarshalJSON shouldn't be used, use CodecEncodeSelf instead

func (NodeSet) Merge added in v0.12.0

func (n NodeSet) Merge(other NodeSet) NodeSet

Merge combines the two NodeSets and returns a new result.

func (NodeSet) Size added in v0.12.0

func (n NodeSet) Size() int

Size is the number of nodes in the set

func (NodeSet) String added in v0.12.0

func (n NodeSet) String() string

func (*NodeSet) UnmarshalJSON added in v0.12.0

func (*NodeSet) UnmarshalJSON(b []byte) error

UnmarshalJSON shouldn't be used, use CodecDecodeSelf instead

func (*NodeSet) UnsafeAdd added in v1.8.1

func (n *NodeSet) UnsafeAdd(node Node)

UnsafeAdd adds a node to the NodeSet. Only call this if n has one owner.

func (*NodeSet) UnsafeMerge added in v1.8.1

func (n *NodeSet) UnsafeMerge(other NodeSet)

UnsafeMerge combines the two NodeSets, altering n

type Nodes added in v0.7.0

type Nodes map[string]Node

Nodes is a collection of nodes in a topology. Keys are node IDs. TODO(pb): type Topology map[string]Node

func (Nodes) Copy added in v0.7.0

func (n Nodes) Copy() Nodes

Copy returns a value copy of the Nodes.

func (Nodes) Merge added in v0.7.0

func (n Nodes) Merge(other Nodes) Nodes

Merge merges the other object into this one, and returns the result object. The original is not modified.

func (*Nodes) UnsafeMerge added in v1.9.1

func (n *Nodes) UnsafeMerge(other Nodes)

UnsafeMerge merges the other object into this one, modifying the original.

func (*Nodes) UnsafeUnMerge added in v1.11.6

func (n *Nodes) UnsafeUnMerge(other Nodes)

UnsafeUnMerge removes nodes from n that would be added by merging other, modifying the original.

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

	// DaemonSet nodes represent all Kubernetes DaemonSets running on hosts running probes.
	// Metadata includes things like DaemonSet id, name etc. Edges are not
	// present.
	DaemonSet Topology

	// StatefulSet nodes represent all Kubernetes Stateful Sets running on hosts running probes.
	// Metadata includes things like Stateful Set id, name, etc. Edges are not
	// present.
	StatefulSet Topology

	// CronJob nodes represent all Kubernetes Cron Jobs running on hosts running probes.
	// Metadata includes things like Cron Job id, name, etc. Edges are not
	// present.
	CronJob Topology

	// Namespace nodes represent all Kubernetes Namespaces running on hosts running probes.
	// Metadata includes things like Namespace id, name, etc. Edges are not
	// present.
	Namespace 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

	// ECS Task nodes are AWS ECS tasks, which represent a group of containers.
	// Metadata is limited for now, more to come later. Edges are not present.
	ECSTask Topology

	// ECS Service nodes are AWS ECS services, which represent a specification for a
	// desired count of tasks with a task definition template.
	// Metadata is limited for now, more to come later. Edges are not present.
	ECSService Topology

	// Swarm Service nodes are Docker Swarm services, which represent a specification for a
	// group of tasks (either one per host, or a desired count).
	// Edges are not present.
	SwarmService 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 are present.
	Overlay Topology

	// Persistent Volume nodes represent all Kubernetes Persistent Volumes running on hosts running probes.
	// Metadata is limited for now, more to come later.
	PersistentVolume Topology

	// Persistent Volume Claim nodes represent all Kubernetes Persistent Volume Claims running on hosts running probes.
	// Metadata is limited for now, more to come later.
	PersistentVolumeClaim Topology

	// Storage Class represent all kubernetes Storage Classes on hosts running probes.
	// Metadata is limited for now, more to come later.
	StorageClass Topology

	// VolumeSnapshot represent all Kubernetes Volume Snapshots on hosts running probes.
	VolumeSnapshot Topology

	// VolumeSnapshotData represent all Kubernetes Volume Snapshot Data on hosts running probes.
	VolumeSnapshotData Topology

	// Job represent all Kubernetes Job on hosts running probes.
	Job Topology

	DNS DNSRecords `json:"DNS,omitempty" deepequal:"nil==empty"`
	// Backwards-compatibility for an accident in commit 951629a / release 1.11.6.
	BugDNS DNSRecords `json:"nodes,omitempty"`

	// 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 CensorRawReport added in v1.11.0

func CensorRawReport(rawReport Report, cfg CensorConfig) Report

CensorRawReport removes any sensitive data from the raw report based on the request query params.

func MakeFromBinary added in v0.16.1

func MakeFromBinary(ctx context.Context, r io.Reader, gzipped bool, msgpack bool) (*Report, error)

MakeFromBinary constructs a Report from binary data.

Will decompress the binary if gzipped is true, and decode as msgpack if true, otherwise JSON

func MakeFromFile added in v1.5.0

func MakeFromFile(ctx context.Context, path string) (rpt *Report, _ error)

MakeFromFile construct a Report from a file, with the encoding determined by the extension (".msgpack" or ".json", with an optional ".gz").

func MakeReport added in v0.3.0

func MakeReport() Report

MakeReport makes a clean report, ready to Merge() other reports into.

func (Report) Copy added in v0.7.0

func (r Report) Copy() Report

Copy returns a value copy of the report.

func (Report) DropTopologiesOver added in v1.10.0

func (r Report) DropTopologiesOver(limit int) Report

DropTopologiesOver - as a protection against overloading the app server, drop topologies that have really large node counts. In practice we only see this with runaway numbers of zombie processes.

func (Report) Merge

func (r Report) Merge(other Report) Report

Merge merges another Report into the receiver and returns the result. The original is not modified.

func (Report) Summary added in v1.11.6

func (r Report) Summary() string

Summary returns a human-readable string summarising the contents, for diagnostic purposes

func (Report) Topology added in v0.14.0

func (r Report) Topology(name string) (Topology, bool)

Topology returns one of the report's topologies, selected by name.

func (*Report) UnsafeMerge added in v1.9.1

func (r *Report) UnsafeMerge(other Report)

UnsafeMerge merges another Report into the receiver. The original is modified.

func (*Report) UnsafeUnMerge added in v1.11.6

func (r *Report) UnsafeUnMerge(other Report)

UnsafeUnMerge removes any information from r that would be added by merging other. The original is modified.

func (Report) Upgrade added in v1.0.0

func (r Report) Upgrade() Report

Upgrade returns a new report based on a report received from the old probe.

func (Report) Validate added in v0.3.0

func (r Report) Validate() error

Validate checks the report for various inconsistencies.

func (*Report) WalkNamedTopologies added in v1.7.0

func (r *Report) WalkNamedTopologies(f func(string, *Topology))

WalkNamedTopologies iterates through the Topologies of the report, potentially modifying them.

func (*Report) WalkPairedTopologies added in v1.4.0

func (r *Report) WalkPairedTopologies(o *Report, f func(*Topology, *Topology))

WalkPairedTopologies iterates through the Topologies of this and another report, potentially modifying one or both.

func (*Report) WalkTopologies added in v0.16.1

func (r *Report) WalkTopologies(f func(*Topology))

WalkTopologies iterates through the Topologies of the report, potentially modifying them

func (Report) WriteBinary added in v0.16.1

func (rep Report) WriteBinary() (*bytes.Buffer, error)

WriteBinary writes a Report as a gzipped msgpack into a bytes.Buffer

func (*Report) WriteToFile added in v1.5.0

func (rep *Report) WriteToFile(path string) error

WriteToFile writes a Report to a file. The encoding is determined by the file extension (".msgpack" or ".json", with an optional ".gz").

type Row

type Row struct {
	ID      string            `json:"id"`
	Entries map[string]string `json:"entries"`
}

Row is the type that holds the table data for the UI. Entries map from column ID to cell value.

type Sample added in v0.10.0

type Sample struct {
	Timestamp time.Time `json:"date"`
	Value     float64   `json:"value"`
}

Sample is a single datapoint of a metric.

type Sampling added in v0.6.0

type Sampling struct {
	Count uint64 // observed and processed
	Total uint64 // observed overall
}

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.

func (Sampling) Merge added in v0.6.0

func (s Sampling) Merge(other Sampling) Sampling

Merge combines two sampling structures via simple addition and returns the result. The original is not modified.

func (Sampling) Rate added in v0.6.0

func (s Sampling) Rate() float64

Rate returns the effective sampling 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 MakeSets added in v0.12.0

func MakeSets() Sets

MakeSets returns EmptySets

func (Sets) Add added in v0.12.0

func (s Sets) Add(key string, value StringSet) Sets

Add the given value to the Sets.

func (Sets) AddString added in v1.9.1

func (s Sets) AddString(key string, str string) Sets

AddString adds a single string under a key, creating a new StringSet if necessary.

func (*Sets) CodecDecodeSelf added in v0.13.0

func (s *Sets) CodecDecodeSelf(decoder *codec.Decoder)

CodecDecodeSelf implements codec.Selfer

func (*Sets) CodecEncodeSelf added in v0.13.0

func (s *Sets) CodecEncodeSelf(encoder *codec.Encoder)

CodecEncodeSelf implements codec.Selfer

func (Sets) DeepEqual added in v0.12.0

func (s Sets) DeepEqual(t Sets) bool

DeepEqual tests equality with other Sets

func (Sets) Delete added in v0.16.0

func (s Sets) Delete(key string) Sets

Delete the given set from the Sets.

func (Sets) Keys added in v0.12.0

func (s Sets) Keys() []string

Keys returns the keys for this set

func (Sets) Lookup added in v0.12.0

func (s Sets) Lookup(key string) (StringSet, bool)

Lookup returns the sets stored under key.

func (Sets) MarshalJSON added in v0.12.0

func (Sets) MarshalJSON() ([]byte, error)

MarshalJSON shouldn't be used, use CodecEncodeSelf instead

func (Sets) Merge added in v0.10.0

func (s Sets) Merge(other Sets) Sets

Merge merges two sets maps into a fresh set, performing set-union merges as appropriate.

func (Sets) Size added in v0.12.0

func (s Sets) Size() int

Size returns the number of elements

func (Sets) String added in v0.12.0

func (s Sets) String() string

func (*Sets) UnmarshalJSON added in v0.12.0

func (*Sets) UnmarshalJSON(b []byte) error

UnmarshalJSON shouldn't be used, use CodecDecodeSelf instead

type StdoutPublisher added in v1.9.1

type StdoutPublisher struct{}

StdoutPublisher is useful when debugging

func (StdoutPublisher) Publish added in v1.9.1

func (StdoutPublisher) Publish(rep Report) error

Publish implements probe.ReportPublisher

type StringLatestMap added in v1.0.0

type StringLatestMap []stringLatestEntry

StringLatestMap holds latest string instances, as a slice sorted by key.

func MakeStringLatestMap added in v1.0.0

func MakeStringLatestMap() StringLatestMap

MakeStringLatestMap makes an empty StringLatestMap.

func (*StringLatestMap) CodecDecodeSelf added in v1.0.0

func (m *StringLatestMap) CodecDecodeSelf(decoder *codec.Decoder)

CodecDecodeSelf implements codec.Selfer. Decodes the input as for a built-in map, without creating an intermediate copy of the data structure to save time. Uses undocumented, internal APIs as for CodecEncodeSelf.

func (StringLatestMap) CodecEncodeSelf added in v1.0.0

func (m StringLatestMap) CodecEncodeSelf(encoder *codec.Encoder)

CodecEncodeSelf implements codec.Selfer. Duplicates the output for a built-in map without generating an intermediate copy of the data structure, to save time. 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 (StringLatestMap) DeepEqual added in v1.0.0

func (m StringLatestMap) DeepEqual(n StringLatestMap) bool

DeepEqual tests equality with other StringLatestMap.

func (StringLatestMap) EqualIgnoringTimestamps added in v1.11.6

func (m StringLatestMap) EqualIgnoringTimestamps(n StringLatestMap) bool

EqualIgnoringTimestamps returns true if all keys and values are the same.

func (StringLatestMap) ForEach added in v1.0.0

func (m StringLatestMap) ForEach(fn func(k string, timestamp time.Time, v string))

ForEach executes fn on each key value pair in the map.

func (StringLatestMap) Len added in v1.9.1

func (m StringLatestMap) Len() int

These let us sort a StringLatestMap strings by key

func (StringLatestMap) Less added in v1.9.1

func (m StringLatestMap) Less(i, j int) bool

func (StringLatestMap) Lookup added in v1.0.0

func (m StringLatestMap) Lookup(key string) (string, bool)

Lookup the value for the given key.

func (StringLatestMap) LookupEntry added in v1.0.0

func (m StringLatestMap) LookupEntry(key string) (string, time.Time, bool)

LookupEntry returns the raw entry for the given key.

func (StringLatestMap) MarshalJSON added in v1.0.0

func (StringLatestMap) MarshalJSON() ([]byte, error)

MarshalJSON shouldn't be used, use CodecEncodeSelf instead.

func (StringLatestMap) Merge added in v1.0.0

Merge produces a StringLatestMap containing the keys from both inputs. When both inputs contain the same key, the newer value is used. Tries to return one of its inputs, if that already holds the correct result.

func (StringLatestMap) Propagate added in v1.9.1

func (m StringLatestMap) Propagate(from StringLatestMap, keys ...string) StringLatestMap

Propagate a set of latest values from one set to another.

func (StringLatestMap) Set added in v1.0.0

func (m StringLatestMap) Set(key string, timestamp time.Time, value string) StringLatestMap

Set the value for the given key.

func (StringLatestMap) Size added in v1.0.0

func (m StringLatestMap) Size() int

Size returns the number of elements.

func (StringLatestMap) String added in v1.0.0

func (m StringLatestMap) String() string

String returns the StringLatestMap's string representation.

func (StringLatestMap) Swap added in v1.9.1

func (m StringLatestMap) Swap(i, j int)

func (*StringLatestMap) UnmarshalJSON added in v1.0.0

func (*StringLatestMap) UnmarshalJSON(b []byte) error

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.

func MakeStringSet added in v0.10.0

func MakeStringSet(strs ...string) StringSet

MakeStringSet makes a new StringSet with the given strings.

func (StringSet) Add added in v0.10.0

func (s StringSet) Add(strs ...string) StringSet

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

func (s StringSet) Contains(str string) bool

Contains returns true if the string set includes the given string

func (StringSet) Equal added in v1.8.0

func (s StringSet) Equal(b StringSet) bool

Equal returns true if a and b have the same contents

func (StringSet) Intersection added in v0.14.0

func (s StringSet) Intersection(b StringSet) StringSet

Intersection returns the intersections of a and b

func (StringSet) Merge added in v0.10.0

func (s StringSet) Merge(other StringSet) (StringSet, bool)

Merge combines the two StringSets and returns a new result. Second return value is true if the return value is s

type Table

type Table struct {
	ID              string   `json:"id"`
	Label           string   `json:"label"`
	Type            string   `json:"type"`
	Columns         []Column `json:"columns"`
	Rows            []Row    `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"`
	Type    string   `json:"type"`
	Columns []Column `json:"columns"`
	// FixedRows indicates what predetermined rows to render each entry is
	// indexed by the key to extract the row value is mapped to the row
	// label
	FixedRows map[string]string `json:"fixedRows"`
}

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

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"`
	Tag               string            `json:"tag,omitempty"`
	Label             string            `json:"label,omitempty"`
	LabelPlural       string            `json:"label_plural,omitempty"`
	Nodes             Nodes             `json:"nodes,omitempty" deepequal:"nil==empty"`
	Controls          Controls          `json:"controls,omitempty" deepequal:"nil==empty"`
	MetadataTemplates MetadataTemplates `json:"metadata_templates,omitempty"`
	MetricTemplates   MetricTemplates   `json:"metric_templates,omitempty"`
	TableTemplates    TableTemplates    `json:"table_templates,omitempty"`
}

Topology describes a specific view of a network. It consists of nodes with metadata, and edges. Edges are directional, and embedded in the Node struct.

func MakeTopology added in v0.7.0

func MakeTopology() Topology

MakeTopology gives you a Topology.

func (Topology) AddNode added in v0.7.0

func (t Topology) AddNode(node Node)

AddNode adds node to the topology under key nodeID; if a node already exists for this key, nmd is merged with that node. This method is different from all the other similar methods in that it mutates the Topology, to solve issues of GC pressure.

func (Topology) Copy added in v0.7.0

func (t Topology) Copy() Topology

Copy returns a value copy of the Topology.

func (Topology) GetShape added in v0.15.0

func (t Topology) GetShape() string

GetShape returns the current topology shape, or the default if there isn't one.

func (Topology) Merge

func (t Topology) Merge(other Topology) Topology

Merge merges the other object into this one, and returns the result object. The original is not modified.

func (Topology) ReplaceNode added in v1.8.0

func (t Topology) ReplaceNode(node Node)

ReplaceNode adds node to the topology under key nodeID; if a node already exists for this key, node replaces that node. Like AddNode, it mutates the Topology

func (*Topology) UnsafeMerge added in v1.9.1

func (t *Topology) UnsafeMerge(other Topology)

UnsafeMerge merges the other object into this one, modifying the original.

func (*Topology) UnsafeUnMerge added in v1.11.6

func (t *Topology) UnsafeUnMerge(other Topology)

UnsafeUnMerge removes any information from t that would be added by merging other, modifying the original.

func (Topology) Validate added in v0.3.0

func (t Topology) Validate() error

Validate checks the topology for various inconsistencies.

func (Topology) WithLabel added in v0.15.0

func (t Topology) WithLabel(label, labelPlural string) Topology

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

func (t Topology) WithShape(shape string) Topology

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.

func (Topology) WithTag added in v1.10.0

func (t Topology) WithTag(tag string) Topology

WithTag sets the tag of nodes from this topology, returning a new topology.

Jump to

Keyboard shortcuts

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