Documentation ¶
Index ¶
- Constants
- Variables
- type AttributeLeapStatus
- type MetricBuilderOption
- type MetricConfig
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(options ...ResourceMetricsOption) pmetric.Metrics
- func (mb *MetricsBuilder) EmitForResource(options ...ResourceMetricsOption)
- func (mb *MetricsBuilder) RecordNtpFrequencyOffsetDataPoint(ts pcommon.Timestamp, val float64, ...)
- func (mb *MetricsBuilder) RecordNtpSkewDataPoint(ts pcommon.Timestamp, val float64)
- func (mb *MetricsBuilder) RecordNtpStratumDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordNtpTimeCorrectionDataPoint(ts pcommon.Timestamp, val float64, ...)
- func (mb *MetricsBuilder) RecordNtpTimeLastOffsetDataPoint(ts pcommon.Timestamp, val float64, ...)
- func (mb *MetricsBuilder) RecordNtpTimeRmsOffsetDataPoint(ts pcommon.Timestamp, val float64, ...)
- func (mb *MetricsBuilder) RecordNtpTimeRootDelayDataPoint(ts pcommon.Timestamp, val float64, ...)
- func (mb *MetricsBuilder) Reset(options ...MetricBuilderOption)
- type MetricsBuilderConfig
- type MetricsConfig
- type ResourceMetricsOption
Constants ¶
const (
MetricsStability = component.StabilityLevelBeta
)
Variables ¶
var ( Type = component.MustNewType("chrony") ScopeName = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/chronyreceiver" )
var MapAttributeLeapStatus = map[string]AttributeLeapStatus{ "normal": AttributeLeapStatusNormal, "insert_second": AttributeLeapStatusInsertSecond, "delete_second": AttributeLeapStatusDeleteSecond, "unsynchronised": AttributeLeapStatusUnsynchronised, }
MapAttributeLeapStatus is a helper map of string to AttributeLeapStatus attribute value.
Functions ¶
This section is empty.
Types ¶
type AttributeLeapStatus ¶
type AttributeLeapStatus int
AttributeLeapStatus specifies the a value leap.status attribute.
const ( AttributeLeapStatusNormal AttributeLeapStatus AttributeLeapStatusInsertSecond AttributeLeapStatusDeleteSecond AttributeLeapStatusUnsynchronised )
func (AttributeLeapStatus) String ¶
func (av AttributeLeapStatus) String() string
String returns the string representation of the AttributeLeapStatus.
type MetricBuilderOption ¶ added in v0.110.0
type MetricBuilderOption interface {
// contains filtered or unexported methods
}
MetricBuilderOption applies changes to default metrics builder.
func WithStartTime ¶
func WithStartTime(startTime pcommon.Timestamp) MetricBuilderOption
WithStartTime sets startTime on the metrics builder.
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.
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 config.
func NewMetricsBuilder ¶
func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.Settings, options ...MetricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶
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 ¶
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) RecordNtpFrequencyOffsetDataPoint ¶
func (mb *MetricsBuilder) RecordNtpFrequencyOffsetDataPoint(ts pcommon.Timestamp, val float64, leapStatusAttributeValue AttributeLeapStatus)
RecordNtpFrequencyOffsetDataPoint adds a data point to ntp.frequency.offset metric.
func (*MetricsBuilder) RecordNtpSkewDataPoint ¶
func (mb *MetricsBuilder) RecordNtpSkewDataPoint(ts pcommon.Timestamp, val float64)
RecordNtpSkewDataPoint adds a data point to ntp.skew metric.
func (*MetricsBuilder) RecordNtpStratumDataPoint ¶
func (mb *MetricsBuilder) RecordNtpStratumDataPoint(ts pcommon.Timestamp, val int64)
RecordNtpStratumDataPoint adds a data point to ntp.stratum metric.
func (*MetricsBuilder) RecordNtpTimeCorrectionDataPoint ¶
func (mb *MetricsBuilder) RecordNtpTimeCorrectionDataPoint(ts pcommon.Timestamp, val float64, leapStatusAttributeValue AttributeLeapStatus)
RecordNtpTimeCorrectionDataPoint adds a data point to ntp.time.correction metric.
func (*MetricsBuilder) RecordNtpTimeLastOffsetDataPoint ¶
func (mb *MetricsBuilder) RecordNtpTimeLastOffsetDataPoint(ts pcommon.Timestamp, val float64, leapStatusAttributeValue AttributeLeapStatus)
RecordNtpTimeLastOffsetDataPoint adds a data point to ntp.time.last_offset metric.
func (*MetricsBuilder) RecordNtpTimeRmsOffsetDataPoint ¶
func (mb *MetricsBuilder) RecordNtpTimeRmsOffsetDataPoint(ts pcommon.Timestamp, val float64, leapStatusAttributeValue AttributeLeapStatus)
RecordNtpTimeRmsOffsetDataPoint adds a data point to ntp.time.rms_offset metric.
func (*MetricsBuilder) RecordNtpTimeRootDelayDataPoint ¶
func (mb *MetricsBuilder) RecordNtpTimeRootDelayDataPoint(ts pcommon.Timestamp, val float64, leapStatusAttributeValue AttributeLeapStatus)
RecordNtpTimeRootDelayDataPoint adds a data point to ntp.time.root_delay 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 MetricsConfig `mapstructure:"metrics"`
}
MetricsBuilderConfig is a configuration for chrony metrics builder.
func DefaultMetricsBuilderConfig ¶ added in v0.73.0
func DefaultMetricsBuilderConfig() MetricsBuilderConfig
type MetricsConfig ¶ added in v0.77.0
type MetricsConfig struct { NtpFrequencyOffset MetricConfig `mapstructure:"ntp.frequency.offset"` NtpSkew MetricConfig `mapstructure:"ntp.skew"` NtpStratum MetricConfig `mapstructure:"ntp.stratum"` NtpTimeCorrection MetricConfig `mapstructure:"ntp.time.correction"` NtpTimeLastOffset MetricConfig `mapstructure:"ntp.time.last_offset"` NtpTimeRmsOffset MetricConfig `mapstructure:"ntp.time.rms_offset"` NtpTimeRootDelay MetricConfig `mapstructure:"ntp.time.root_delay"` }
MetricsConfig provides config for chrony metrics.
func DefaultMetricsConfig ¶ added in v0.77.0
func DefaultMetricsConfig() MetricsConfig
type ResourceMetricsOption ¶
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 ¶
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.