metadata

package
v0.116.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogsStability    = component.StabilityLevelDevelopment
	MetricsStability = component.StabilityLevelBeta
)

Variables

View Source
var (
	Type      = component.MustNewType("k8s_cluster")
	ScopeName = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver"
)

Functions

func GetEntityEvents added in v0.82.0

func GetEntityEvents(oldMetadata, newMetadata map[metadataPkg.ResourceID]*KubernetesMetadata, timestamp pcommon.Timestamp, reportingInterval time.Duration) metadataPkg.EntityEventsSlice

GetEntityEvents processes metadata updates and returns entity events that describe the metadata changes.

func GetMetadataUpdate

func GetMetadataUpdate(oldMetadata, newMetadata map[metadataPkg.ResourceID]*KubernetesMetadata) []*metadataPkg.MetadataUpdate

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

func GetOTelNameFromKind

func GetOTelNameFromKind(kind string) string

func GetOTelUIDFromKind

func GetOTelUIDFromKind(kind string) string

func MergeKubernetesMetadataMaps

func MergeKubernetesMetadataMaps(maps ...map[metadataPkg.ResourceID]*KubernetesMetadata) map[metadataPkg.ResourceID]*KubernetesMetadata

mergeKubernetesMetadataMaps merges maps of string (resource id) to KubernetesMetadata into a single map.

func TransformObjectMeta added in v0.80.0

func TransformObjectMeta(om v1.ObjectMeta) v1.ObjectMeta

Types

type KubernetesMetadata

type KubernetesMetadata struct {
	// The type of the entity, e.g. k8s.pod
	EntityType string
	// 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 metadataPkg.ResourceID
	// metadata is a set of key-value pairs that describe a resource.
	Metadata map[string]string
}

KubernetesMetadata associates a resource to a set of properties.

func GetGenericMetadata

func GetGenericMetadata(om *v1.ObjectMeta, resourceType string) *KubernetesMetadata

GetGenericMetadata is responsible for collecting metadata from K8s resources that live on v1.ObjectMeta.

type MetricBuilderOption added in v0.110.0

type MetricBuilderOption interface {
	// contains filtered or unexported methods
}

MetricBuilderOption applies changes to default metrics builder.

func WithStartTime added in v0.82.0

func WithStartTime(startTime pcommon.Timestamp) MetricBuilderOption

WithStartTime sets startTime on the metrics builder.

type MetricConfig added in v0.82.0

type MetricConfig struct {
	Enabled bool `mapstructure:"enabled"`
	// contains filtered or unexported fields
}

MetricConfig provides common config for a particular metric.

func (*MetricConfig) Unmarshal added in v0.82.0

func (ms *MetricConfig) Unmarshal(parser *confmap.Conf) error

type MetricsBuilder added in v0.82.0

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

MetricsBuilder provides an interface for scrapers to report metrics while taking care of all the transformations required to produce metric representation defined in metadata and user config.

func NewMetricsBuilder added in v0.82.0

func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.Settings, options ...MetricBuilderOption) *MetricsBuilder

func (*MetricsBuilder) Emit added in v0.82.0

func (mb *MetricsBuilder) Emit(options ...ResourceMetricsOption) pmetric.Metrics

Emit returns all the metrics accumulated by the metrics builder and updates the internal state to be ready for recording another set of metrics. This function will be responsible for applying all the transformations required to produce metric representation defined in metadata and user config, e.g. delta or cumulative.

func (*MetricsBuilder) EmitForResource added in v0.82.0

func (mb *MetricsBuilder) EmitForResource(options ...ResourceMetricsOption)

EmitForResource saves all the generated metrics under a new resource and updates the internal state to be ready for recording another set of data points as part of another resource. This function can be helpful when one scraper needs to emit metrics from several resources. Otherwise calling this function is not required, just `Emit` function can be called instead. Resource attributes should be provided as ResourceMetricsOption arguments.

func (*MetricsBuilder) NewResourceBuilder added in v0.83.0

func (mb *MetricsBuilder) NewResourceBuilder() *ResourceBuilder

NewResourceBuilder returns a new resource builder that should be used to build a resource associated with for the emitted metrics.

func (*MetricsBuilder) RecordK8sContainerCPULimitDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sContainerCPULimitDataPoint(ts pcommon.Timestamp, val float64)

RecordK8sContainerCPULimitDataPoint adds a data point to k8s.container.cpu_limit metric.

func (*MetricsBuilder) RecordK8sContainerCPURequestDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sContainerCPURequestDataPoint(ts pcommon.Timestamp, val float64)

RecordK8sContainerCPURequestDataPoint adds a data point to k8s.container.cpu_request metric.

func (*MetricsBuilder) RecordK8sContainerEphemeralstorageLimitDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sContainerEphemeralstorageLimitDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sContainerEphemeralstorageLimitDataPoint adds a data point to k8s.container.ephemeralstorage_limit metric.

func (*MetricsBuilder) RecordK8sContainerEphemeralstorageRequestDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sContainerEphemeralstorageRequestDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sContainerEphemeralstorageRequestDataPoint adds a data point to k8s.container.ephemeralstorage_request metric.

func (*MetricsBuilder) RecordK8sContainerMemoryLimitDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sContainerMemoryLimitDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sContainerMemoryLimitDataPoint adds a data point to k8s.container.memory_limit metric.

func (*MetricsBuilder) RecordK8sContainerMemoryRequestDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sContainerMemoryRequestDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sContainerMemoryRequestDataPoint adds a data point to k8s.container.memory_request metric.

func (*MetricsBuilder) RecordK8sContainerReadyDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sContainerReadyDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sContainerReadyDataPoint adds a data point to k8s.container.ready metric.

func (*MetricsBuilder) RecordK8sContainerRestartsDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sContainerRestartsDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sContainerRestartsDataPoint adds a data point to k8s.container.restarts metric.

func (*MetricsBuilder) RecordK8sContainerStorageLimitDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sContainerStorageLimitDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sContainerStorageLimitDataPoint adds a data point to k8s.container.storage_limit metric.

func (*MetricsBuilder) RecordK8sContainerStorageRequestDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sContainerStorageRequestDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sContainerStorageRequestDataPoint adds a data point to k8s.container.storage_request metric.

func (*MetricsBuilder) RecordK8sCronjobActiveJobsDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sCronjobActiveJobsDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sCronjobActiveJobsDataPoint adds a data point to k8s.cronjob.active_jobs metric.

func (*MetricsBuilder) RecordK8sDaemonsetCurrentScheduledNodesDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sDaemonsetCurrentScheduledNodesDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sDaemonsetCurrentScheduledNodesDataPoint adds a data point to k8s.daemonset.current_scheduled_nodes metric.

func (*MetricsBuilder) RecordK8sDaemonsetDesiredScheduledNodesDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sDaemonsetDesiredScheduledNodesDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sDaemonsetDesiredScheduledNodesDataPoint adds a data point to k8s.daemonset.desired_scheduled_nodes metric.

func (*MetricsBuilder) RecordK8sDaemonsetMisscheduledNodesDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sDaemonsetMisscheduledNodesDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sDaemonsetMisscheduledNodesDataPoint adds a data point to k8s.daemonset.misscheduled_nodes metric.

func (*MetricsBuilder) RecordK8sDaemonsetReadyNodesDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sDaemonsetReadyNodesDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sDaemonsetReadyNodesDataPoint adds a data point to k8s.daemonset.ready_nodes metric.

func (*MetricsBuilder) RecordK8sDeploymentAvailableDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sDeploymentAvailableDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sDeploymentAvailableDataPoint adds a data point to k8s.deployment.available metric.

func (*MetricsBuilder) RecordK8sDeploymentDesiredDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sDeploymentDesiredDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sDeploymentDesiredDataPoint adds a data point to k8s.deployment.desired metric.

func (*MetricsBuilder) RecordK8sHpaCurrentReplicasDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sHpaCurrentReplicasDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sHpaCurrentReplicasDataPoint adds a data point to k8s.hpa.current_replicas metric.

func (*MetricsBuilder) RecordK8sHpaDesiredReplicasDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sHpaDesiredReplicasDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sHpaDesiredReplicasDataPoint adds a data point to k8s.hpa.desired_replicas metric.

func (*MetricsBuilder) RecordK8sHpaMaxReplicasDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sHpaMaxReplicasDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sHpaMaxReplicasDataPoint adds a data point to k8s.hpa.max_replicas metric.

func (*MetricsBuilder) RecordK8sHpaMinReplicasDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sHpaMinReplicasDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sHpaMinReplicasDataPoint adds a data point to k8s.hpa.min_replicas metric.

func (*MetricsBuilder) RecordK8sJobActivePodsDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sJobActivePodsDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sJobActivePodsDataPoint adds a data point to k8s.job.active_pods metric.

func (*MetricsBuilder) RecordK8sJobDesiredSuccessfulPodsDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sJobDesiredSuccessfulPodsDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sJobDesiredSuccessfulPodsDataPoint adds a data point to k8s.job.desired_successful_pods metric.

func (*MetricsBuilder) RecordK8sJobFailedPodsDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sJobFailedPodsDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sJobFailedPodsDataPoint adds a data point to k8s.job.failed_pods metric.

func (*MetricsBuilder) RecordK8sJobMaxParallelPodsDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sJobMaxParallelPodsDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sJobMaxParallelPodsDataPoint adds a data point to k8s.job.max_parallel_pods metric.

func (*MetricsBuilder) RecordK8sJobSuccessfulPodsDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sJobSuccessfulPodsDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sJobSuccessfulPodsDataPoint adds a data point to k8s.job.successful_pods metric.

func (*MetricsBuilder) RecordK8sNamespacePhaseDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sNamespacePhaseDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sNamespacePhaseDataPoint adds a data point to k8s.namespace.phase metric.

func (*MetricsBuilder) RecordK8sNodeConditionDataPoint added in v0.89.0

func (mb *MetricsBuilder) RecordK8sNodeConditionDataPoint(ts pcommon.Timestamp, val int64, conditionAttributeValue string)

RecordK8sNodeConditionDataPoint adds a data point to k8s.node.condition metric.

func (*MetricsBuilder) RecordK8sPodPhaseDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sPodPhaseDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sPodPhaseDataPoint adds a data point to k8s.pod.phase metric.

func (*MetricsBuilder) RecordK8sPodStatusReasonDataPoint added in v0.85.0

func (mb *MetricsBuilder) RecordK8sPodStatusReasonDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sPodStatusReasonDataPoint adds a data point to k8s.pod.status_reason metric.

func (*MetricsBuilder) RecordK8sReplicasetAvailableDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sReplicasetAvailableDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sReplicasetAvailableDataPoint adds a data point to k8s.replicaset.available metric.

func (*MetricsBuilder) RecordK8sReplicasetDesiredDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sReplicasetDesiredDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sReplicasetDesiredDataPoint adds a data point to k8s.replicaset.desired metric.

func (*MetricsBuilder) RecordK8sReplicationControllerAvailableDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sReplicationControllerAvailableDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sReplicationControllerAvailableDataPoint adds a data point to k8s.replication_controller.available metric.

func (*MetricsBuilder) RecordK8sReplicationControllerDesiredDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sReplicationControllerDesiredDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sReplicationControllerDesiredDataPoint adds a data point to k8s.replication_controller.desired metric.

func (*MetricsBuilder) RecordK8sResourceQuotaHardLimitDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sResourceQuotaHardLimitDataPoint(ts pcommon.Timestamp, val int64, resourceAttributeValue string)

RecordK8sResourceQuotaHardLimitDataPoint adds a data point to k8s.resource_quota.hard_limit metric.

func (*MetricsBuilder) RecordK8sResourceQuotaUsedDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sResourceQuotaUsedDataPoint(ts pcommon.Timestamp, val int64, resourceAttributeValue string)

RecordK8sResourceQuotaUsedDataPoint adds a data point to k8s.resource_quota.used metric.

func (*MetricsBuilder) RecordK8sStatefulsetCurrentPodsDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sStatefulsetCurrentPodsDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sStatefulsetCurrentPodsDataPoint adds a data point to k8s.statefulset.current_pods metric.

func (*MetricsBuilder) RecordK8sStatefulsetDesiredPodsDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sStatefulsetDesiredPodsDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sStatefulsetDesiredPodsDataPoint adds a data point to k8s.statefulset.desired_pods metric.

func (*MetricsBuilder) RecordK8sStatefulsetReadyPodsDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sStatefulsetReadyPodsDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sStatefulsetReadyPodsDataPoint adds a data point to k8s.statefulset.ready_pods metric.

func (*MetricsBuilder) RecordK8sStatefulsetUpdatedPodsDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordK8sStatefulsetUpdatedPodsDataPoint(ts pcommon.Timestamp, val int64)

RecordK8sStatefulsetUpdatedPodsDataPoint adds a data point to k8s.statefulset.updated_pods metric.

func (*MetricsBuilder) RecordOpenshiftAppliedclusterquotaLimitDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordOpenshiftAppliedclusterquotaLimitDataPoint(ts pcommon.Timestamp, val int64, k8sNamespaceNameAttributeValue string, resourceAttributeValue string)

RecordOpenshiftAppliedclusterquotaLimitDataPoint adds a data point to openshift.appliedclusterquota.limit metric.

func (*MetricsBuilder) RecordOpenshiftAppliedclusterquotaUsedDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordOpenshiftAppliedclusterquotaUsedDataPoint(ts pcommon.Timestamp, val int64, k8sNamespaceNameAttributeValue string, resourceAttributeValue string)

RecordOpenshiftAppliedclusterquotaUsedDataPoint adds a data point to openshift.appliedclusterquota.used metric.

func (*MetricsBuilder) RecordOpenshiftClusterquotaLimitDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordOpenshiftClusterquotaLimitDataPoint(ts pcommon.Timestamp, val int64, resourceAttributeValue string)

RecordOpenshiftClusterquotaLimitDataPoint adds a data point to openshift.clusterquota.limit metric.

func (*MetricsBuilder) RecordOpenshiftClusterquotaUsedDataPoint added in v0.82.0

func (mb *MetricsBuilder) RecordOpenshiftClusterquotaUsedDataPoint(ts pcommon.Timestamp, val int64, resourceAttributeValue string)

RecordOpenshiftClusterquotaUsedDataPoint adds a data point to openshift.clusterquota.used metric.

func (*MetricsBuilder) Reset added in v0.82.0

func (mb *MetricsBuilder) Reset(options ...MetricBuilderOption)

Reset resets metrics builder to its initial state. It should be used when external metrics source is restarted, and metrics builder should update its startTime and reset it's internal state accordingly.

type MetricsBuilderConfig added in v0.82.0

type MetricsBuilderConfig struct {
	Metrics            MetricsConfig            `mapstructure:"metrics"`
	ResourceAttributes ResourceAttributesConfig `mapstructure:"resource_attributes"`
}

MetricsBuilderConfig is a configuration for k8s_cluster metrics builder.

func DefaultMetricsBuilderConfig added in v0.82.0

func DefaultMetricsBuilderConfig() MetricsBuilderConfig

type MetricsConfig added in v0.82.0

type MetricsConfig struct {
	K8sContainerCPULimit                MetricConfig `mapstructure:"k8s.container.cpu_limit"`
	K8sContainerCPURequest              MetricConfig `mapstructure:"k8s.container.cpu_request"`
	K8sContainerEphemeralstorageLimit   MetricConfig `mapstructure:"k8s.container.ephemeralstorage_limit"`
	K8sContainerEphemeralstorageRequest MetricConfig `mapstructure:"k8s.container.ephemeralstorage_request"`
	K8sContainerMemoryLimit             MetricConfig `mapstructure:"k8s.container.memory_limit"`
	K8sContainerMemoryRequest           MetricConfig `mapstructure:"k8s.container.memory_request"`
	K8sContainerReady                   MetricConfig `mapstructure:"k8s.container.ready"`
	K8sContainerRestarts                MetricConfig `mapstructure:"k8s.container.restarts"`
	K8sContainerStorageLimit            MetricConfig `mapstructure:"k8s.container.storage_limit"`
	K8sContainerStorageRequest          MetricConfig `mapstructure:"k8s.container.storage_request"`
	K8sCronjobActiveJobs                MetricConfig `mapstructure:"k8s.cronjob.active_jobs"`
	K8sDaemonsetCurrentScheduledNodes   MetricConfig `mapstructure:"k8s.daemonset.current_scheduled_nodes"`
	K8sDaemonsetDesiredScheduledNodes   MetricConfig `mapstructure:"k8s.daemonset.desired_scheduled_nodes"`
	K8sDaemonsetMisscheduledNodes       MetricConfig `mapstructure:"k8s.daemonset.misscheduled_nodes"`
	K8sDaemonsetReadyNodes              MetricConfig `mapstructure:"k8s.daemonset.ready_nodes"`
	K8sDeploymentAvailable              MetricConfig `mapstructure:"k8s.deployment.available"`
	K8sDeploymentDesired                MetricConfig `mapstructure:"k8s.deployment.desired"`
	K8sHpaCurrentReplicas               MetricConfig `mapstructure:"k8s.hpa.current_replicas"`
	K8sHpaDesiredReplicas               MetricConfig `mapstructure:"k8s.hpa.desired_replicas"`
	K8sHpaMaxReplicas                   MetricConfig `mapstructure:"k8s.hpa.max_replicas"`
	K8sHpaMinReplicas                   MetricConfig `mapstructure:"k8s.hpa.min_replicas"`
	K8sJobActivePods                    MetricConfig `mapstructure:"k8s.job.active_pods"`
	K8sJobDesiredSuccessfulPods         MetricConfig `mapstructure:"k8s.job.desired_successful_pods"`
	K8sJobFailedPods                    MetricConfig `mapstructure:"k8s.job.failed_pods"`
	K8sJobMaxParallelPods               MetricConfig `mapstructure:"k8s.job.max_parallel_pods"`
	K8sJobSuccessfulPods                MetricConfig `mapstructure:"k8s.job.successful_pods"`
	K8sNamespacePhase                   MetricConfig `mapstructure:"k8s.namespace.phase"`
	K8sNodeCondition                    MetricConfig `mapstructure:"k8s.node.condition"`
	K8sPodPhase                         MetricConfig `mapstructure:"k8s.pod.phase"`
	K8sPodStatusReason                  MetricConfig `mapstructure:"k8s.pod.status_reason"`
	K8sReplicasetAvailable              MetricConfig `mapstructure:"k8s.replicaset.available"`
	K8sReplicasetDesired                MetricConfig `mapstructure:"k8s.replicaset.desired"`
	K8sReplicationControllerAvailable   MetricConfig `mapstructure:"k8s.replication_controller.available"`
	K8sReplicationControllerDesired     MetricConfig `mapstructure:"k8s.replication_controller.desired"`
	K8sResourceQuotaHardLimit           MetricConfig `mapstructure:"k8s.resource_quota.hard_limit"`
	K8sResourceQuotaUsed                MetricConfig `mapstructure:"k8s.resource_quota.used"`
	K8sStatefulsetCurrentPods           MetricConfig `mapstructure:"k8s.statefulset.current_pods"`
	K8sStatefulsetDesiredPods           MetricConfig `mapstructure:"k8s.statefulset.desired_pods"`
	K8sStatefulsetReadyPods             MetricConfig `mapstructure:"k8s.statefulset.ready_pods"`
	K8sStatefulsetUpdatedPods           MetricConfig `mapstructure:"k8s.statefulset.updated_pods"`
	OpenshiftAppliedclusterquotaLimit   MetricConfig `mapstructure:"openshift.appliedclusterquota.limit"`
	OpenshiftAppliedclusterquotaUsed    MetricConfig `mapstructure:"openshift.appliedclusterquota.used"`
	OpenshiftClusterquotaLimit          MetricConfig `mapstructure:"openshift.clusterquota.limit"`
	OpenshiftClusterquotaUsed           MetricConfig `mapstructure:"openshift.clusterquota.used"`
}

MetricsConfig provides config for k8s_cluster metrics.

func DefaultMetricsConfig added in v0.82.0

func DefaultMetricsConfig() MetricsConfig

type ResourceAttributeConfig added in v0.82.0

type ResourceAttributeConfig struct {
	Enabled bool `mapstructure:"enabled"`
	// Experimental: MetricsInclude defines a list of filters for attribute values.
	// If the list is not empty, only metrics with matching resource attribute values will be emitted.
	MetricsInclude []filter.Config `mapstructure:"metrics_include"`
	// Experimental: MetricsExclude defines a list of filters for attribute values.
	// If the list is not empty, metrics with matching resource attribute values will not be emitted.
	// MetricsInclude has higher priority than MetricsExclude.
	MetricsExclude []filter.Config `mapstructure:"metrics_exclude"`
	// contains filtered or unexported fields
}

ResourceAttributeConfig provides common config for a particular resource attribute.

func (*ResourceAttributeConfig) Unmarshal added in v0.87.0

func (rac *ResourceAttributeConfig) Unmarshal(parser *confmap.Conf) error

type ResourceAttributesConfig added in v0.82.0

type ResourceAttributesConfig struct {
	ContainerID                            ResourceAttributeConfig `mapstructure:"container.id"`
	ContainerImageName                     ResourceAttributeConfig `mapstructure:"container.image.name"`
	ContainerImageTag                      ResourceAttributeConfig `mapstructure:"container.image.tag"`
	ContainerRuntime                       ResourceAttributeConfig `mapstructure:"container.runtime"`
	ContainerRuntimeVersion                ResourceAttributeConfig `mapstructure:"container.runtime.version"`
	K8sContainerName                       ResourceAttributeConfig `mapstructure:"k8s.container.name"`
	K8sContainerStatusLastTerminatedReason ResourceAttributeConfig `mapstructure:"k8s.container.status.last_terminated_reason"`
	K8sCronjobName                         ResourceAttributeConfig `mapstructure:"k8s.cronjob.name"`
	K8sCronjobUID                          ResourceAttributeConfig `mapstructure:"k8s.cronjob.uid"`
	K8sDaemonsetName                       ResourceAttributeConfig `mapstructure:"k8s.daemonset.name"`
	K8sDaemonsetUID                        ResourceAttributeConfig `mapstructure:"k8s.daemonset.uid"`
	K8sDeploymentName                      ResourceAttributeConfig `mapstructure:"k8s.deployment.name"`
	K8sDeploymentUID                       ResourceAttributeConfig `mapstructure:"k8s.deployment.uid"`
	K8sHpaName                             ResourceAttributeConfig `mapstructure:"k8s.hpa.name"`
	K8sHpaUID                              ResourceAttributeConfig `mapstructure:"k8s.hpa.uid"`
	K8sJobName                             ResourceAttributeConfig `mapstructure:"k8s.job.name"`
	K8sJobUID                              ResourceAttributeConfig `mapstructure:"k8s.job.uid"`
	K8sKubeletVersion                      ResourceAttributeConfig `mapstructure:"k8s.kubelet.version"`
	K8sNamespaceName                       ResourceAttributeConfig `mapstructure:"k8s.namespace.name"`
	K8sNamespaceUID                        ResourceAttributeConfig `mapstructure:"k8s.namespace.uid"`
	K8sNodeName                            ResourceAttributeConfig `mapstructure:"k8s.node.name"`
	K8sNodeUID                             ResourceAttributeConfig `mapstructure:"k8s.node.uid"`
	K8sPodName                             ResourceAttributeConfig `mapstructure:"k8s.pod.name"`
	K8sPodQosClass                         ResourceAttributeConfig `mapstructure:"k8s.pod.qos_class"`
	K8sPodUID                              ResourceAttributeConfig `mapstructure:"k8s.pod.uid"`
	K8sReplicasetName                      ResourceAttributeConfig `mapstructure:"k8s.replicaset.name"`
	K8sReplicasetUID                       ResourceAttributeConfig `mapstructure:"k8s.replicaset.uid"`
	K8sReplicationcontrollerName           ResourceAttributeConfig `mapstructure:"k8s.replicationcontroller.name"`
	K8sReplicationcontrollerUID            ResourceAttributeConfig `mapstructure:"k8s.replicationcontroller.uid"`
	K8sResourcequotaName                   ResourceAttributeConfig `mapstructure:"k8s.resourcequota.name"`
	K8sResourcequotaUID                    ResourceAttributeConfig `mapstructure:"k8s.resourcequota.uid"`
	K8sStatefulsetName                     ResourceAttributeConfig `mapstructure:"k8s.statefulset.name"`
	K8sStatefulsetUID                      ResourceAttributeConfig `mapstructure:"k8s.statefulset.uid"`
	OpenshiftClusterquotaName              ResourceAttributeConfig `mapstructure:"openshift.clusterquota.name"`
	OpenshiftClusterquotaUID               ResourceAttributeConfig `mapstructure:"openshift.clusterquota.uid"`
	OsDescription                          ResourceAttributeConfig `mapstructure:"os.description"`
	OsType                                 ResourceAttributeConfig `mapstructure:"os.type"`
}

ResourceAttributesConfig provides config for k8s_cluster resource attributes.

func DefaultResourceAttributesConfig added in v0.82.0

func DefaultResourceAttributesConfig() ResourceAttributesConfig

type ResourceBuilder added in v0.82.0

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

ResourceBuilder is a helper struct to build resources predefined in metadata.yaml. The ResourceBuilder is not thread-safe and must not to be used in multiple goroutines.

func NewResourceBuilder added in v0.82.0

func NewResourceBuilder(rac ResourceAttributesConfig) *ResourceBuilder

NewResourceBuilder creates a new ResourceBuilder. This method should be called on the start of the application.

func (*ResourceBuilder) Emit added in v0.82.0

func (rb *ResourceBuilder) Emit() pcommon.Resource

Emit returns the built resource and resets the internal builder state.

func (*ResourceBuilder) SetContainerID added in v0.82.0

func (rb *ResourceBuilder) SetContainerID(val string)

SetContainerID sets provided value as "container.id" attribute.

func (*ResourceBuilder) SetContainerImageName added in v0.82.0

func (rb *ResourceBuilder) SetContainerImageName(val string)

SetContainerImageName sets provided value as "container.image.name" attribute.

func (*ResourceBuilder) SetContainerImageTag added in v0.82.0

func (rb *ResourceBuilder) SetContainerImageTag(val string)

SetContainerImageTag sets provided value as "container.image.tag" attribute.

func (*ResourceBuilder) SetContainerRuntime added in v0.93.0

func (rb *ResourceBuilder) SetContainerRuntime(val string)

SetContainerRuntime sets provided value as "container.runtime" attribute.

func (*ResourceBuilder) SetContainerRuntimeVersion added in v0.93.0

func (rb *ResourceBuilder) SetContainerRuntimeVersion(val string)

SetContainerRuntimeVersion sets provided value as "container.runtime.version" attribute.

func (*ResourceBuilder) SetK8sContainerName added in v0.82.0

func (rb *ResourceBuilder) SetK8sContainerName(val string)

SetK8sContainerName sets provided value as "k8s.container.name" attribute.

func (*ResourceBuilder) SetK8sContainerStatusLastTerminatedReason added in v0.97.0

func (rb *ResourceBuilder) SetK8sContainerStatusLastTerminatedReason(val string)

SetK8sContainerStatusLastTerminatedReason sets provided value as "k8s.container.status.last_terminated_reason" attribute.

func (*ResourceBuilder) SetK8sCronjobName added in v0.82.0

func (rb *ResourceBuilder) SetK8sCronjobName(val string)

SetK8sCronjobName sets provided value as "k8s.cronjob.name" attribute.

func (*ResourceBuilder) SetK8sCronjobUID added in v0.82.0

func (rb *ResourceBuilder) SetK8sCronjobUID(val string)

SetK8sCronjobUID sets provided value as "k8s.cronjob.uid" attribute.

func (*ResourceBuilder) SetK8sDaemonsetName added in v0.82.0

func (rb *ResourceBuilder) SetK8sDaemonsetName(val string)

SetK8sDaemonsetName sets provided value as "k8s.daemonset.name" attribute.

func (*ResourceBuilder) SetK8sDaemonsetUID added in v0.82.0

func (rb *ResourceBuilder) SetK8sDaemonsetUID(val string)

SetK8sDaemonsetUID sets provided value as "k8s.daemonset.uid" attribute.

func (*ResourceBuilder) SetK8sDeploymentName added in v0.82.0

func (rb *ResourceBuilder) SetK8sDeploymentName(val string)

SetK8sDeploymentName sets provided value as "k8s.deployment.name" attribute.

func (*ResourceBuilder) SetK8sDeploymentUID added in v0.82.0

func (rb *ResourceBuilder) SetK8sDeploymentUID(val string)

SetK8sDeploymentUID sets provided value as "k8s.deployment.uid" attribute.

func (*ResourceBuilder) SetK8sHpaName added in v0.82.0

func (rb *ResourceBuilder) SetK8sHpaName(val string)

SetK8sHpaName sets provided value as "k8s.hpa.name" attribute.

func (*ResourceBuilder) SetK8sHpaUID added in v0.82.0

func (rb *ResourceBuilder) SetK8sHpaUID(val string)

SetK8sHpaUID sets provided value as "k8s.hpa.uid" attribute.

func (*ResourceBuilder) SetK8sJobName added in v0.82.0

func (rb *ResourceBuilder) SetK8sJobName(val string)

SetK8sJobName sets provided value as "k8s.job.name" attribute.

func (*ResourceBuilder) SetK8sJobUID added in v0.82.0

func (rb *ResourceBuilder) SetK8sJobUID(val string)

SetK8sJobUID sets provided value as "k8s.job.uid" attribute.

func (*ResourceBuilder) SetK8sKubeletVersion added in v0.85.0

func (rb *ResourceBuilder) SetK8sKubeletVersion(val string)

SetK8sKubeletVersion sets provided value as "k8s.kubelet.version" attribute.

func (*ResourceBuilder) SetK8sNamespaceName added in v0.82.0

func (rb *ResourceBuilder) SetK8sNamespaceName(val string)

SetK8sNamespaceName sets provided value as "k8s.namespace.name" attribute.

func (*ResourceBuilder) SetK8sNamespaceUID added in v0.82.0

func (rb *ResourceBuilder) SetK8sNamespaceUID(val string)

SetK8sNamespaceUID sets provided value as "k8s.namespace.uid" attribute.

func (*ResourceBuilder) SetK8sNodeName added in v0.82.0

func (rb *ResourceBuilder) SetK8sNodeName(val string)

SetK8sNodeName sets provided value as "k8s.node.name" attribute.

func (*ResourceBuilder) SetK8sNodeUID added in v0.82.0

func (rb *ResourceBuilder) SetK8sNodeUID(val string)

SetK8sNodeUID sets provided value as "k8s.node.uid" attribute.

func (*ResourceBuilder) SetK8sPodName added in v0.82.0

func (rb *ResourceBuilder) SetK8sPodName(val string)

SetK8sPodName sets provided value as "k8s.pod.name" attribute.

func (*ResourceBuilder) SetK8sPodQosClass added in v0.88.0

func (rb *ResourceBuilder) SetK8sPodQosClass(val string)

SetK8sPodQosClass sets provided value as "k8s.pod.qos_class" attribute.

func (*ResourceBuilder) SetK8sPodUID added in v0.82.0

func (rb *ResourceBuilder) SetK8sPodUID(val string)

SetK8sPodUID sets provided value as "k8s.pod.uid" attribute.

func (*ResourceBuilder) SetK8sReplicasetName added in v0.82.0

func (rb *ResourceBuilder) SetK8sReplicasetName(val string)

SetK8sReplicasetName sets provided value as "k8s.replicaset.name" attribute.

func (*ResourceBuilder) SetK8sReplicasetUID added in v0.82.0

func (rb *ResourceBuilder) SetK8sReplicasetUID(val string)

SetK8sReplicasetUID sets provided value as "k8s.replicaset.uid" attribute.

func (*ResourceBuilder) SetK8sReplicationcontrollerName added in v0.82.0

func (rb *ResourceBuilder) SetK8sReplicationcontrollerName(val string)

SetK8sReplicationcontrollerName sets provided value as "k8s.replicationcontroller.name" attribute.

func (*ResourceBuilder) SetK8sReplicationcontrollerUID added in v0.82.0

func (rb *ResourceBuilder) SetK8sReplicationcontrollerUID(val string)

SetK8sReplicationcontrollerUID sets provided value as "k8s.replicationcontroller.uid" attribute.

func (*ResourceBuilder) SetK8sResourcequotaName added in v0.82.0

func (rb *ResourceBuilder) SetK8sResourcequotaName(val string)

SetK8sResourcequotaName sets provided value as "k8s.resourcequota.name" attribute.

func (*ResourceBuilder) SetK8sResourcequotaUID added in v0.82.0

func (rb *ResourceBuilder) SetK8sResourcequotaUID(val string)

SetK8sResourcequotaUID sets provided value as "k8s.resourcequota.uid" attribute.

func (*ResourceBuilder) SetK8sStatefulsetName added in v0.82.0

func (rb *ResourceBuilder) SetK8sStatefulsetName(val string)

SetK8sStatefulsetName sets provided value as "k8s.statefulset.name" attribute.

func (*ResourceBuilder) SetK8sStatefulsetUID added in v0.82.0

func (rb *ResourceBuilder) SetK8sStatefulsetUID(val string)

SetK8sStatefulsetUID sets provided value as "k8s.statefulset.uid" attribute.

func (*ResourceBuilder) SetOpenshiftClusterquotaName added in v0.82.0

func (rb *ResourceBuilder) SetOpenshiftClusterquotaName(val string)

SetOpenshiftClusterquotaName sets provided value as "openshift.clusterquota.name" attribute.

func (*ResourceBuilder) SetOpenshiftClusterquotaUID added in v0.82.0

func (rb *ResourceBuilder) SetOpenshiftClusterquotaUID(val string)

SetOpenshiftClusterquotaUID sets provided value as "openshift.clusterquota.uid" attribute.

func (*ResourceBuilder) SetOsDescription added in v0.93.0

func (rb *ResourceBuilder) SetOsDescription(val string)

SetOsDescription sets provided value as "os.description" attribute.

func (*ResourceBuilder) SetOsType added in v0.93.0

func (rb *ResourceBuilder) SetOsType(val string)

SetOsType sets provided value as "os.type" attribute.

type ResourceMetricsOption added in v0.82.0

type ResourceMetricsOption interface {
	// contains filtered or unexported methods
}

ResourceMetricsOption applies changes to provided resource metrics.

func WithResource added in v0.82.0

func WithResource(res pcommon.Resource) ResourceMetricsOption

WithResource sets the provided resource on the emitted ResourceMetrics. It's recommended to use ResourceBuilder to create the resource.

func WithStartTimeOverride added in v0.82.0

func WithStartTimeOverride(start pcommon.Timestamp) ResourceMetricsOption

WithStartTimeOverride overrides start time for all the resource metrics data points. This option should be only used if different start time has to be set on metrics coming from different resources.

type Store

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

Store keeps track of required caches exposed by informers. This store is used while collecting metadata about Pods to be able to correlate other Kubernetes objects with a Pod.

func NewStore added in v0.83.0

func NewStore() *Store

NewStore creates a new Store.

func (*Store) ForEach added in v0.83.0

func (ms *Store) ForEach(gvk schema.GroupVersionKind, f func(o any))

ForEach iterates over all objects in a given cache.Store.

func (*Store) Get added in v0.83.0

func (ms *Store) Get(gvk schema.GroupVersionKind) cache.Store

Get returns a cache.Store for a given GroupVersionKind.

func (*Store) Setup

func (ms *Store) Setup(gvk schema.GroupVersionKind, store cache.Store)

Setup tracks metadata of services, jobs and replicasets.

Jump to

Keyboard shortcuts

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