metadata

package
v0.76.2 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Type      = "httpcheckreceiver"
	Stability = component.StabilityLevelDevelopment
)

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"`
	// contains filtered or unexported fields
}

MetricSettings provides common settings for a particular metric.

func (*MetricSettings) Unmarshal

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

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(mbc MetricsBuilderConfig, settings receiver.CreateSettings, 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) RecordHttpcheckDurationDataPoint

func (mb *MetricsBuilder) RecordHttpcheckDurationDataPoint(ts pcommon.Timestamp, val int64, httpURLAttributeValue string)

RecordHttpcheckDurationDataPoint adds a data point to httpcheck.duration metric.

func (*MetricsBuilder) RecordHttpcheckErrorDataPoint

func (mb *MetricsBuilder) RecordHttpcheckErrorDataPoint(ts pcommon.Timestamp, val int64, httpURLAttributeValue string, errorMessageAttributeValue string)

RecordHttpcheckErrorDataPoint adds a data point to httpcheck.error metric.

func (*MetricsBuilder) RecordHttpcheckStatusDataPoint

func (mb *MetricsBuilder) RecordHttpcheckStatusDataPoint(ts pcommon.Timestamp, val int64, httpURLAttributeValue string, httpStatusCodeAttributeValue int64, httpMethodAttributeValue string, httpStatusClassAttributeValue string)

RecordHttpcheckStatusDataPoint adds a data point to httpcheck.status 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 MetricsBuilderConfig added in v0.73.0

type MetricsBuilderConfig struct {
	Metrics            MetricsSettings            `mapstructure:"metrics"`
	ResourceAttributes ResourceAttributesSettings `mapstructure:"resource_attributes"`
}

MetricsBuilderConfig is a structural subset of an otherwise 1-1 copy of metadata.yaml

func DefaultMetricsBuilderConfig added in v0.73.0

func DefaultMetricsBuilderConfig() MetricsBuilderConfig

func NewMetricsBuilderConfig added in v0.73.0

func NewMetricsBuilderConfig(ms MetricsSettings, ras ResourceAttributesSettings) MetricsBuilderConfig

type MetricsSettings

type MetricsSettings struct {
	HttpcheckDuration MetricSettings `mapstructure:"httpcheck.duration"`
	HttpcheckError    MetricSettings `mapstructure:"httpcheck.error"`
	HttpcheckStatus   MetricSettings `mapstructure:"httpcheck.status"`
}

MetricsSettings provides settings for httpcheckreceiver metrics.

func DefaultMetricsSettings

func DefaultMetricsSettings() MetricsSettings

type ResourceAttributeSettings added in v0.70.0

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

ResourceAttributeSettings provides common settings for a particular metric.

type ResourceAttributesSettings added in v0.70.0

type ResourceAttributesSettings struct {
}

ResourceAttributesSettings provides settings for httpcheckreceiver metrics.

func DefaultResourceAttributesSettings added in v0.70.0

func DefaultResourceAttributesSettings() ResourceAttributesSettings

type ResourceMetricsOption

type ResourceMetricsOption func(ResourceAttributesSettings, 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