Documentation ¶
Index ¶
- Variables
- func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption
- type MetricSettings
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(ro ...ResourceOption) pmetric.Metrics
- func (mb *MetricsBuilder) EmitForResource(ro ...ResourceOption)
- func (mb *MetricsBuilder) RecordSystemCPULoadAverage15mDataPoint(ts pcommon.Timestamp, val float64)
- func (mb *MetricsBuilder) RecordSystemCPULoadAverage1mDataPoint(ts pcommon.Timestamp, val float64)
- func (mb *MetricsBuilder) RecordSystemCPULoadAverage5mDataPoint(ts pcommon.Timestamp, val float64)
- func (mb *MetricsBuilder) Reset(options ...metricBuilderOption)
- type MetricsSettings
- type ResourceOption
Constants ¶
This section is empty.
Variables ¶
var A = Attributes
A is an alias for Attributes.
var Attributes = struct {
}{}
Attributes contains the possible metric attributes that can be used.
Functions ¶
func WithStartTime ¶ added in v0.44.0
WithStartTime sets startTime on the metrics builder.
Types ¶
type MetricSettings ¶ added in v0.44.0
type MetricSettings struct {
Enabled bool `mapstructure:"enabled"`
}
MetricSettings provides common settings for a particular metric.
type MetricsBuilder ¶ added in v0.44.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 settings.
func NewMetricsBuilder ¶ added in v0.44.0
func NewMetricsBuilder(settings MetricsSettings, options ...metricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶ added in v0.44.0
func (mb *MetricsBuilder) Emit(ro ...ResourceOption) 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 settings, e.g. delta or cumulative.
func (*MetricsBuilder) EmitForResource ¶ added in v0.48.0
func (mb *MetricsBuilder) EmitForResource(ro ...ResourceOption)
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 ResourceOption arguments.
func (*MetricsBuilder) RecordSystemCPULoadAverage15mDataPoint ¶ added in v0.44.0
func (mb *MetricsBuilder) RecordSystemCPULoadAverage15mDataPoint(ts pcommon.Timestamp, val float64)
RecordSystemCPULoadAverage15mDataPoint adds a data point to system.cpu.load_average.15m metric.
func (*MetricsBuilder) RecordSystemCPULoadAverage1mDataPoint ¶ added in v0.44.0
func (mb *MetricsBuilder) RecordSystemCPULoadAverage1mDataPoint(ts pcommon.Timestamp, val float64)
RecordSystemCPULoadAverage1mDataPoint adds a data point to system.cpu.load_average.1m metric.
func (*MetricsBuilder) RecordSystemCPULoadAverage5mDataPoint ¶ added in v0.44.0
func (mb *MetricsBuilder) RecordSystemCPULoadAverage5mDataPoint(ts pcommon.Timestamp, val float64)
RecordSystemCPULoadAverage5mDataPoint adds a data point to system.cpu.load_average.5m metric.
func (*MetricsBuilder) Reset ¶ added in v0.44.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 MetricsSettings ¶ added in v0.44.0
type MetricsSettings struct { SystemCPULoadAverage15m MetricSettings `mapstructure:"system.cpu.load_average.15m"` SystemCPULoadAverage1m MetricSettings `mapstructure:"system.cpu.load_average.1m"` SystemCPULoadAverage5m MetricSettings `mapstructure:"system.cpu.load_average.5m"` }
MetricsSettings provides settings for hostmetricsreceiver/load metrics.
func DefaultMetricsSettings ¶ added in v0.44.0
func DefaultMetricsSettings() MetricsSettings
type ResourceOption ¶ added in v0.48.0
ResourceOption applies changes to provided resource.