Documentation ¶
Index ¶
- Variables
- func WithStartTime(startTime pdata.Timestamp) metricBuilderOption
- type MetricSettings
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(ro ...ResourceOption) pdata.Metrics
- func (mb *MetricsBuilder) EmitForResource(ro ...ResourceOption)
- func (mb *MetricsBuilder) RecordProcessCPUTimeDataPoint(ts pdata.Timestamp, val float64, stateAttributeValue string)
- func (mb *MetricsBuilder) RecordProcessDiskIoDataPoint(ts pdata.Timestamp, val int64, directionAttributeValue string)
- func (mb *MetricsBuilder) RecordProcessMemoryPhysicalUsageDataPoint(ts pdata.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordProcessMemoryVirtualUsageDataPoint(ts pdata.Timestamp, val int64)
- func (mb *MetricsBuilder) Reset(options ...metricBuilderOption)
- type MetricsSettings
- type ResourceOption
- func WithProcessCommand(val string) ResourceOption
- func WithProcessCommandLine(val string) ResourceOption
- func WithProcessExecutableName(val string) ResourceOption
- func WithProcessExecutablePath(val string) ResourceOption
- func WithProcessOwner(val string) ResourceOption
- func WithProcessPid(val int64) ResourceOption
Constants ¶
This section is empty.
Variables ¶
var A = Attributes
A is an alias for Attributes.
var AttributeDirection = struct { Read string Write string }{ "read", "write", }
AttributeDirection are the possible values that the attribute "direction" can have.
var AttributeState = struct { System string User string Wait string }{ "system", "user", "wait", }
AttributeState are the possible values that the attribute "state" can have.
var Attributes = struct { // Direction (Direction of flow of bytes (read or write).) Direction string // State (Breakdown of CPU usage by type.) State string }{ "direction", "state", }
Attributes contains the possible metric attributes that can be used.
Functions ¶
func WithStartTime ¶ added in v0.45.1
WithStartTime sets startTime on the metrics builder.
Types ¶
type MetricSettings ¶ added in v0.45.1
type MetricSettings struct {
Enabled bool `mapstructure:"enabled"`
}
MetricSettings provides common settings for a particular metric.
type MetricsBuilder ¶ added in v0.45.1
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.45.1
func NewMetricsBuilder(settings MetricsSettings, options ...metricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶ added in v0.45.1
func (mb *MetricsBuilder) Emit(ro ...ResourceOption) pdata.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) RecordProcessCPUTimeDataPoint ¶ added in v0.45.1
func (mb *MetricsBuilder) RecordProcessCPUTimeDataPoint(ts pdata.Timestamp, val float64, stateAttributeValue string)
RecordProcessCPUTimeDataPoint adds a data point to process.cpu.time metric.
func (*MetricsBuilder) RecordProcessDiskIoDataPoint ¶ added in v0.45.1
func (mb *MetricsBuilder) RecordProcessDiskIoDataPoint(ts pdata.Timestamp, val int64, directionAttributeValue string)
RecordProcessDiskIoDataPoint adds a data point to process.disk.io metric.
func (*MetricsBuilder) RecordProcessMemoryPhysicalUsageDataPoint ¶ added in v0.45.1
func (mb *MetricsBuilder) RecordProcessMemoryPhysicalUsageDataPoint(ts pdata.Timestamp, val int64)
RecordProcessMemoryPhysicalUsageDataPoint adds a data point to process.memory.physical_usage metric.
func (*MetricsBuilder) RecordProcessMemoryVirtualUsageDataPoint ¶ added in v0.45.1
func (mb *MetricsBuilder) RecordProcessMemoryVirtualUsageDataPoint(ts pdata.Timestamp, val int64)
RecordProcessMemoryVirtualUsageDataPoint adds a data point to process.memory.virtual_usage metric.
func (*MetricsBuilder) Reset ¶ added in v0.45.1
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.45.1
type MetricsSettings struct { ProcessCPUTime MetricSettings `mapstructure:"process.cpu.time"` ProcessDiskIo MetricSettings `mapstructure:"process.disk.io"` ProcessMemoryPhysicalUsage MetricSettings `mapstructure:"process.memory.physical_usage"` ProcessMemoryVirtualUsage MetricSettings `mapstructure:"process.memory.virtual_usage"` }
MetricsSettings provides settings for hostmetricsreceiver/process metrics.
func DefaultMetricsSettings ¶ added in v0.45.1
func DefaultMetricsSettings() MetricsSettings
type ResourceOption ¶ added in v0.48.0
ResourceOption applies changes to provided resource.
func WithProcessCommand ¶ added in v0.48.0
func WithProcessCommand(val string) ResourceOption
WithProcessCommand sets provided value as "process.command" attribute for current resource.
func WithProcessCommandLine ¶ added in v0.48.0
func WithProcessCommandLine(val string) ResourceOption
WithProcessCommandLine sets provided value as "process.command_line" attribute for current resource.
func WithProcessExecutableName ¶ added in v0.48.0
func WithProcessExecutableName(val string) ResourceOption
WithProcessExecutableName sets provided value as "process.executable.name" attribute for current resource.
func WithProcessExecutablePath ¶ added in v0.48.0
func WithProcessExecutablePath(val string) ResourceOption
WithProcessExecutablePath sets provided value as "process.executable.path" attribute for current resource.
func WithProcessOwner ¶ added in v0.48.0
func WithProcessOwner(val string) ResourceOption
WithProcessOwner sets provided value as "process.owner" attribute for current resource.
func WithProcessPid ¶ added in v0.48.0
func WithProcessPid(val int64) ResourceOption
WithProcessPid sets provided value as "process.pid" attribute for current resource.