Documentation
¶
Index ¶
- Constants
- func RegisterCollector(id string, c collectorFactory)
- type Collector
- type CollectorEvent
- type Container
- type ContainerImage
- type ContainerPort
- type ContainerRuntime
- type ContainerState
- type ECSLaunchType
- type ECSTask
- type Entity
- type EntityID
- type EntityMeta
- type Event
- type EventBundle
- type EventType
- type Filter
- type Kind
- type KubernetesPod
- type KubernetesPodOwner
- type OrchestratorContainer
- type Store
Constants ¶
const ( KindContainer Kind = "container" KindKubernetesPod Kind = "kubernetes_pod" KindECSTask Kind = "ecs_task" ContainerRuntimeDocker ContainerRuntime = "docker" ContainerRuntimeContainerd ContainerRuntime = "containerd" ECSLaunchTypeEC2 ECSLaunchType = "ec2" ECSLaunchTypeFargate ECSLaunchType = "fargate" EventTypeSet EventType = iota EventTypeUnset )
List of enumerable constants for the types above.
Variables ¶
This section is empty.
Functions ¶
func RegisterCollector ¶
func RegisterCollector(id string, c collectorFactory)
RegisterCollector registers a new collector, identified by an id for logging and telemetry purposes, to be used by the store.
Types ¶
type Collector ¶
type Collector interface {
// Start starts a collector. The collector should run until the context
// is done. It also gets a reference to the store that started it so it
// can use Notify, or get access to other entities in the store.
Start(context.Context, Store) error
// Pull triggers an entity collection. To be used by collectors that
// don't have streaming functionality, and called periodically by the
// store.
Pull(context.Context) error
}
Collector is responsible for collecting metadata about workloads.
type CollectorEvent ¶
CollectorEvent is an event generated by a metadata collector, to be handled by the metadata store.
type Container ¶
type Container struct {
EntityID
EntityMeta
EnvVars map[string]string
Hostname string
Image ContainerImage
NetworkIPs map[string]string
PID int
Ports []ContainerPort
Runtime ContainerRuntime
State ContainerState
}
Container is a containerized workload.
type ContainerImage ¶
ContainerImage is the an image used by a container.
func NewContainerImage ¶
func NewContainerImage(imageName string) (ContainerImage, error)
NewContainerImage builds a ContainerImage from an image name
type ContainerPort ¶
ContainerPort is a port open in the container.
type ContainerRuntime ¶
type ContainerRuntime string
ContainerRuntime is the container runtime used by a container.
type ContainerState ¶
ContainerState is the state of a container.
type ECSTask ¶
type ECSTask struct {
EntityID
EntityMeta
Tags map[string]string
ContainerInstanceTags map[string]string
ClusterName string
Region string
AvailabilityZone string
Family string
Version string
LaunchType ECSLaunchType
Containers []OrchestratorContainer
}
ECSTask is an ECS Task.
type Entity ¶
Entity is an item in the metadata store. It exists as an interface to avoid usage of interface{}.
type EntityID ¶
EntityID represents the ID of an Entity.
type EntityMeta ¶
type EntityMeta struct {
Name string
Namespace string
Annotations map[string]string
Labels map[string]string
}
EntityMeta represents generic metadata about an Entity.
type EventBundle ¶
type EventBundle struct {
Events []Event
Ch chan struct{}
}
EventBundle is a collection of events, and a channel that needs to be closed when the receiving subscriber wants to unblock the notifier.
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter allows a subscriber to filter events by entity kind or event source.
func (*Filter) Match ¶
func (f *Filter) Match(ev CollectorEvent) bool
Match returns true if the filter matches an event.
func (*Filter) MatchKind ¶
MatchKind returns true if the filter matches the passed Kind. If the filter is nil, or has no kinds, it always matches.
func (*Filter) MatchSource ¶
MatchSource returns true if the filter matches the passed sources. If the filter is nil, or has no sources, it always matches.
type KubernetesPod ¶
type KubernetesPod struct {
EntityID
EntityMeta
Owners []KubernetesPodOwner
PersistentVolumeClaimNames []string
Containers []OrchestratorContainer
Ready bool
Phase string
IP string
PriorityClass string
KubeServices []string
NamespaceLabels map[string]string
}
KubernetesPod is a Kubernetes Pod.
func (KubernetesPod) DeepCopy ¶
func (p KubernetesPod) DeepCopy() Entity
DeepCopy returns a deep copy of the pod.
func (KubernetesPod) GetID ¶
func (p KubernetesPod) GetID() EntityID
GetID returns the KubernetesPod's EntityID.
func (*KubernetesPod) Merge ¶
func (p *KubernetesPod) Merge(e Entity) error
Merge merges a KubernetesPod with another. Returns an error if trying to merge with another kind.
type KubernetesPodOwner ¶
KubernetesPodOwner is extracted from a pod's owner references.
type OrchestratorContainer ¶
OrchestratorContainer is a reference to a Container with orchestrator-specific data attached to it.
type Store ¶
type Store interface {
Start(ctx context.Context)
Subscribe(name string, filter *Filter) chan EventBundle
Unsubscribe(ch chan EventBundle)
GetContainer(id string) (*Container, error)
GetKubernetesPod(id string) (*KubernetesPod, error)
GetKubernetesPodForContainer(containerID string) (*KubernetesPod, error)
GetECSTask(id string) (*ECSTask, error)
Notify(events []CollectorEvent)
}
Store is a central storage of metadata about workloads. A workload is any unit of work being done by a piece of software, like a process, a container, a kubernetes pod, or a task in any cloud provider.
func GetGlobalStore ¶
func GetGlobalStore() Store
GetGlobalStore returns a global instance of the workloadmeta store, creating one if it doesn't exist. Start() needs to be called before any data collection happens.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package collectors is a wrapper that loads the available workloadmeta collectors.
|
Package collectors is a wrapper that loads the available workloadmeta collectors. |