metadata

package
v0.0.0-...-0aa7a04 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithStartTime

func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption

WithStartTime sets startTime on the metrics builder.

Types

type MetricSettings

type MetricSettings struct {
	Enabled bool `mapstructure:"enabled"`
}

MetricSettings provides common settings for a particular metric.

type MetricsBuilder

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

func NewMetricsBuilder

func NewMetricsBuilder(settings MetricsSettings, buildInfo component.BuildInfo, options ...metricBuilderOption) *MetricsBuilder

func (*MetricsBuilder) Emit

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 settings, e.g. delta or cumulative.

func (*MetricsBuilder) EmitForResource

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) RecordHwFanSpeedDataPoint

func (mb *MetricsBuilder) RecordHwFanSpeedDataPoint(ts pcommon.Timestamp, val int64, idAttributeValue string, nameAttributeValue string, parentAttributeValue string)

RecordHwFanSpeedDataPoint adds a data point to hw.fan.speed metric.

func (*MetricsBuilder) RecordHwNetworkIoReceiveDataPoint

func (mb *MetricsBuilder) RecordHwNetworkIoReceiveDataPoint(ts pcommon.Timestamp, val int64, idAttributeValue string, nameAttributeValue string, parentAttributeValue string)

RecordHwNetworkIoReceiveDataPoint adds a data point to hw.network.io.receive metric.

func (*MetricsBuilder) RecordHwNetworkIoTransmitDataPoint

func (mb *MetricsBuilder) RecordHwNetworkIoTransmitDataPoint(ts pcommon.Timestamp, val int64, idAttributeValue string, nameAttributeValue string, parentAttributeValue string)

RecordHwNetworkIoTransmitDataPoint adds a data point to hw.network.io.transmit metric.

func (*MetricsBuilder) RecordHwNetworkUpDataPoint

func (mb *MetricsBuilder) RecordHwNetworkUpDataPoint(ts pcommon.Timestamp, val int64, idAttributeValue string, nameAttributeValue string, parentAttributeValue string)

RecordHwNetworkUpDataPoint adds a data point to hw.network.up metric.

func (*MetricsBuilder) RecordHwTemperatureDataPoint

func (mb *MetricsBuilder) RecordHwTemperatureDataPoint(ts pcommon.Timestamp, val float64, idAttributeValue string, nameAttributeValue string, parentAttributeValue string)

RecordHwTemperatureDataPoint adds a data point to hw.temperature metric.

func (*MetricsBuilder) Reset

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 MetricsSettings

type MetricsSettings struct {
	HwFanSpeed          MetricSettings `mapstructure:"hw.fan.speed"`
	HwNetworkIoReceive  MetricSettings `mapstructure:"hw.network.io.receive"`
	HwNetworkIoTransmit MetricSettings `mapstructure:"hw.network.io.transmit"`
	HwNetworkUp         MetricSettings `mapstructure:"hw.network.up"`
	HwTemperature       MetricSettings `mapstructure:"hw.temperature"`
}

MetricsSettings provides settings for redfishreceiver metrics.

func DefaultMetricsSettings

func DefaultMetricsSettings() MetricsSettings

type ResourceMetricsOption

type ResourceMetricsOption func(pmetric.ResourceMetrics)

ResourceMetricsOption applies changes to provided resource metrics.

func WithStartTimeOverride

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