Documentation ¶
Index ¶
- Variables
- func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption
- type AttributeStatus
- type MetricSettings
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(rmo ...ResourceMetricsOption) pmetric.Metrics
- func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption)
- func (mb *MetricsBuilder) RecordSystemProcessesCountDataPoint(ts pcommon.Timestamp, val int64, statusAttributeValue AttributeStatus)
- func (mb *MetricsBuilder) RecordSystemProcessesCreatedDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) Reset(options ...metricBuilderOption)
- type MetricsBuilderConfig
- type MetricsSettings
- type ResourceAttributeSettings
- type ResourceAttributesSettings
- type ResourceMetricsOption
Constants ¶
This section is empty.
Variables ¶
var MapAttributeStatus = map[string]AttributeStatus{ "blocked": AttributeStatusBlocked, "daemon": AttributeStatusDaemon, "detached": AttributeStatusDetached, "idle": AttributeStatusIdle, "locked": AttributeStatusLocked, "orphan": AttributeStatusOrphan, "paging": AttributeStatusPaging, "running": AttributeStatusRunning, "sleeping": AttributeStatusSleeping, "stopped": AttributeStatusStopped, "system": AttributeStatusSystem, "unknown": AttributeStatusUnknown, "zombies": AttributeStatusZombies, }
MapAttributeStatus is a helper map of string to AttributeStatus attribute value.
Functions ¶
func WithStartTime ¶ added in v0.49.0
WithStartTime sets startTime on the metrics builder.
Types ¶
type AttributeStatus ¶ added in v0.39.0
type AttributeStatus int
AttributeStatus specifies the a value status attribute.
const ( AttributeStatusBlocked AttributeStatus AttributeStatusDaemon AttributeStatusDetached AttributeStatusIdle AttributeStatusLocked AttributeStatusOrphan AttributeStatusPaging AttributeStatusRunning AttributeStatusSleeping AttributeStatusStopped AttributeStatusSystem AttributeStatusUnknown AttributeStatusZombies )
func (AttributeStatus) String ¶ added in v0.51.0
func (av AttributeStatus) String() string
String returns the string representation of the AttributeStatus.
type MetricSettings ¶ added in v0.49.0
type MetricSettings struct { Enabled bool `mapstructure:"enabled"` // contains filtered or unexported fields }
MetricSettings provides common settings for a particular metric.
type MetricsBuilder ¶ added in v0.49.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.49.0
func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.CreateSettings, options ...metricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶ added in v0.49.0
func (mb *MetricsBuilder) Emit(rmo ...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 settings, e.g. delta or cumulative.
func (*MetricsBuilder) EmitForResource ¶ added in v0.49.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) RecordSystemProcessesCountDataPoint ¶ added in v0.49.0
func (mb *MetricsBuilder) RecordSystemProcessesCountDataPoint(ts pcommon.Timestamp, val int64, statusAttributeValue AttributeStatus)
RecordSystemProcessesCountDataPoint adds a data point to system.processes.count metric.
func (*MetricsBuilder) RecordSystemProcessesCreatedDataPoint ¶ added in v0.49.0
func (mb *MetricsBuilder) RecordSystemProcessesCreatedDataPoint(ts pcommon.Timestamp, val int64)
RecordSystemProcessesCreatedDataPoint adds a data point to system.processes.created metric.
func (*MetricsBuilder) Reset ¶ added in v0.49.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 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 ¶ added in v0.49.0
type MetricsSettings struct { SystemProcessesCount MetricSettings `mapstructure:"system.processes.count"` SystemProcessesCreated MetricSettings `mapstructure:"system.processes.created"` }
MetricsSettings provides settings for hostmetricsreceiver/processes metrics.
func DefaultMetricsSettings ¶ added in v0.49.0
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 hostmetricsreceiver/processes metrics.
func DefaultResourceAttributesSettings ¶ added in v0.70.0
func DefaultResourceAttributesSettings() ResourceAttributesSettings
type ResourceMetricsOption ¶ added in v0.52.0
type ResourceMetricsOption func(ResourceAttributesSettings, pmetric.ResourceMetrics)
ResourceMetricsOption applies changes to provided resource metrics.
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.