metadata

package
v0.100.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MapAttributeState = map[string]AttributeState{
	"idle":      AttributeStateIdle,
	"interrupt": AttributeStateInterrupt,
	"nice":      AttributeStateNice,
	"softirq":   AttributeStateSoftirq,
	"steal":     AttributeStateSteal,
	"system":    AttributeStateSystem,
	"user":      AttributeStateUser,
	"wait":      AttributeStateWait,
}

MapAttributeState is a helper map of string to AttributeState attribute value.

Functions

func WithStartTime added in v0.41.0

func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption

WithStartTime sets startTime on the metrics builder.

Types

type AttributeState added in v0.39.0

type AttributeState int

AttributeState specifies the a value state attribute.

const (
	AttributeStateIdle AttributeState
	AttributeStateInterrupt
	AttributeStateNice
	AttributeStateSoftirq
	AttributeStateSteal
	AttributeStateSystem
	AttributeStateUser
	AttributeStateWait
)

func (AttributeState) String added in v0.51.0

func (av AttributeState) String() string

String returns the string representation of the AttributeState.

type MetricConfig added in v0.77.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.77.0

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

type MetricsBuilder added in v0.41.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.41.0

func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.CreateSettings, options ...metricBuilderOption) *MetricsBuilder

func (*MetricsBuilder) Emit added in v0.41.0

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.48.0

func (mb *MetricsBuilder) EmitForResource(rmo ...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) RecordSystemCPUFrequencyDataPoint added in v0.89.0

func (mb *MetricsBuilder) RecordSystemCPUFrequencyDataPoint(ts pcommon.Timestamp, val float64, cpuAttributeValue string)

RecordSystemCPUFrequencyDataPoint adds a data point to system.cpu.frequency metric.

func (*MetricsBuilder) RecordSystemCPULogicalCountDataPoint added in v0.83.0

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

RecordSystemCPULogicalCountDataPoint adds a data point to system.cpu.logical.count metric.

func (*MetricsBuilder) RecordSystemCPUPhysicalCountDataPoint added in v0.83.0

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

RecordSystemCPUPhysicalCountDataPoint adds a data point to system.cpu.physical.count metric.

func (*MetricsBuilder) RecordSystemCPUTimeDataPoint added in v0.41.0

func (mb *MetricsBuilder) RecordSystemCPUTimeDataPoint(ts pcommon.Timestamp, val float64, cpuAttributeValue string, stateAttributeValue AttributeState)

RecordSystemCPUTimeDataPoint adds a data point to system.cpu.time metric.

func (*MetricsBuilder) RecordSystemCPUUtilizationDataPoint added in v0.47.0

func (mb *MetricsBuilder) RecordSystemCPUUtilizationDataPoint(ts pcommon.Timestamp, val float64, cpuAttributeValue string, stateAttributeValue AttributeState)

RecordSystemCPUUtilizationDataPoint adds a data point to system.cpu.utilization metric.

func (*MetricsBuilder) Reset added in v0.42.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.73.0

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

MetricsBuilderConfig is a configuration for hostmetricsreceiver/cpu metrics builder.

func DefaultMetricsBuilderConfig added in v0.73.0

func DefaultMetricsBuilderConfig() MetricsBuilderConfig

type MetricsConfig added in v0.77.0

type MetricsConfig struct {
	SystemCPUFrequency     MetricConfig `mapstructure:"system.cpu.frequency"`
	SystemCPULogicalCount  MetricConfig `mapstructure:"system.cpu.logical.count"`
	SystemCPUPhysicalCount MetricConfig `mapstructure:"system.cpu.physical.count"`
	SystemCPUTime          MetricConfig `mapstructure:"system.cpu.time"`
	SystemCPUUtilization   MetricConfig `mapstructure:"system.cpu.utilization"`
}

MetricsConfig provides config for hostmetricsreceiver/cpu metrics.

func DefaultMetricsConfig added in v0.77.0

func DefaultMetricsConfig() MetricsConfig

type ResourceMetricsOption added in v0.52.0

type ResourceMetricsOption func(pmetric.ResourceMetrics)

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.52.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.

Jump to

Keyboard shortcuts

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