collection

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataCollector

type DataCollector struct {
	// contains filtered or unexported fields
}

DataCollector wraps around a metricsStore and a metadaStore exposing methods to perform on the underlying stores. DataCollector also provides an interface to interact with refactored code from SignalFx Agent which is confined to the collection package.

func NewDataCollector

func NewDataCollector(logger *zap.Logger, nodeConditionsToReport []string) *DataCollector

newDataCollector returns a DataCollector.

func (*DataCollector) CollectMetricData

func (dc *DataCollector) CollectMetricData(currentTime time.Time) []consumerdata.MetricsData

func (*DataCollector) RemoveFromMetricsStore

func (dc *DataCollector) RemoveFromMetricsStore(obj interface{})

func (*DataCollector) SetupMetadataStore

func (dc *DataCollector) SetupMetadataStore(o runtime.Object, store cache.Store)

SetupMetadataStore initializes a metadata store for the kubernetes object.

func (*DataCollector) SyncMetadata

func (dc *DataCollector) SyncMetadata(obj interface{}) map[ResourceID]*KubernetesMetadata

SyncMetadata updates the metric store with latest metrics from the kubernetes object

func (*DataCollector) SyncMetrics

func (dc *DataCollector) SyncMetrics(obj interface{})

SyncMetrics updates the metric store with latest metrics from the kubernetes object.

func (*DataCollector) UpdateMetricsStore

func (dc *DataCollector) UpdateMetricsStore(obj interface{}, rm []*resourceMetrics)

type KubernetesMetadata

type KubernetesMetadata struct {
	// contains filtered or unexported fields
}

KubernetesMetadata associates a resource to a set of properties.

type MetadataDelta

type MetadataDelta struct {
	// MetadataToAdd contains key-value pairs that are newly added to
	// the resource description in the current revision.
	MetadataToAdd map[string]string
	// MetadataToRemove contains key-value pairs that no longer describe
	// a resource and needs to be removed.
	MetadataToRemove map[string]string
	// MetadataToUpdate contains key-value pairs that have been updated
	// in the current revision compared to the previous revisions(s).
	MetadataToUpdate map[string]string
}

MetadataDelta keeps track of changes to metadata on resources. The fields on this struct should help determine if there have been changes to resource metadata such as Kubernetes labels. An example of how this is used. Let's say we are dealing with a Pod that has the following labels - {"env": "test", "team": "otell", "usser": "bob"}. Now, let's say there's an update to one or more labels on the same Pod and the labels now look like the following - {"env": "test", "team": "otel", "user": "bob"}. The k8sclusterreceiver upon receiving the event corresponding to the labels updates will generate a MetadataDelta with the following values -

MetadataToAdd: {"user": "bob"}
MetadataToRemove: {"usser": "bob"}
MetadataToUpdate: {"team": "otel"}

Apart from Kubernetes labels, the other metadata collected by this receiver are also handled in the same manner.

type MetadataExporter added in v0.10.0

type MetadataExporter interface {
	// ConsumeMetadata will be invoked every time there's an
	// update to a resource that results in one or more MetadataUpdate.
	ConsumeMetadata(metadata []*MetadataUpdate) error
}

MetadataExporter provides an interface to implement ConsumeMetadata in Exporters that support metadata.

type MetadataUpdate added in v0.10.0

type MetadataUpdate struct {
	// ResourceIDKey is the label key of UID label for the resource.
	ResourceIDKey string
	// ResourceID is the Kubernetes UID of the resource. In case of
	// containers, this value is the container id.
	ResourceID ResourceID
	MetadataDelta
}

MetadataUpdate provides a delta view of metadata on a resource between two revisions of a resource.

func GetMetadataUpdate added in v0.10.0

func GetMetadataUpdate(old, new map[ResourceID]*KubernetesMetadata) []*MetadataUpdate

GetMetadataUpdate processes metadata updates and returns a map of a delta of metadata mapped to each resource.

type ResourceID

type ResourceID string

Jump to

Keyboard shortcuts

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