Documentation ¶
Index ¶
- Variables
- type AttributeContextSwitchType
- type AttributeDirection
- type AttributePagingFaultType
- type AttributeState
- type MetricBuilderOption
- type MetricConfig
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(options ...ResourceMetricsOption) pmetric.Metrics
- func (mb *MetricsBuilder) EmitForResource(options ...ResourceMetricsOption)
- func (mb *MetricsBuilder) NewResourceBuilder() *ResourceBuilder
- func (mb *MetricsBuilder) RecordProcessCPUTimeDataPoint(ts pcommon.Timestamp, val float64, stateAttributeValue AttributeState)
- func (mb *MetricsBuilder) RecordProcessCPUUtilizationDataPoint(ts pcommon.Timestamp, val float64, stateAttributeValue AttributeState)
- func (mb *MetricsBuilder) RecordProcessContextSwitchesDataPoint(ts pcommon.Timestamp, val int64, ...)
- func (mb *MetricsBuilder) RecordProcessDiskIoDataPoint(ts pcommon.Timestamp, val int64, directionAttributeValue AttributeDirection)
- func (mb *MetricsBuilder) RecordProcessDiskOperationsDataPoint(ts pcommon.Timestamp, val int64, directionAttributeValue AttributeDirection)
- func (mb *MetricsBuilder) RecordProcessHandlesDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordProcessMemoryUsageDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordProcessMemoryUtilizationDataPoint(ts pcommon.Timestamp, val float64)
- func (mb *MetricsBuilder) RecordProcessMemoryVirtualDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordProcessOpenFileDescriptorsDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordProcessPagingFaultsDataPoint(ts pcommon.Timestamp, val int64, ...)
- func (mb *MetricsBuilder) RecordProcessSignalsPendingDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordProcessThreadsDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) Reset(options ...MetricBuilderOption)
- type MetricsBuilderConfig
- type MetricsConfig
- type ResourceAttributeConfig
- type ResourceAttributesConfig
- type ResourceBuilder
- func (rb *ResourceBuilder) Emit() pcommon.Resource
- func (rb *ResourceBuilder) SetProcessCgroup(val string)
- func (rb *ResourceBuilder) SetProcessCommand(val string)
- func (rb *ResourceBuilder) SetProcessCommandLine(val string)
- func (rb *ResourceBuilder) SetProcessExecutableName(val string)
- func (rb *ResourceBuilder) SetProcessExecutablePath(val string)
- func (rb *ResourceBuilder) SetProcessOwner(val string)
- func (rb *ResourceBuilder) SetProcessParentPid(val int64)
- func (rb *ResourceBuilder) SetProcessPid(val int64)
- type ResourceMetricsOption
Constants ¶
This section is empty.
Variables ¶
var MapAttributeContextSwitchType = map[string]AttributeContextSwitchType{ "involuntary": AttributeContextSwitchTypeInvoluntary, "voluntary": AttributeContextSwitchTypeVoluntary, }
MapAttributeContextSwitchType is a helper map of string to AttributeContextSwitchType attribute value.
var MapAttributeDirection = map[string]AttributeDirection{ "read": AttributeDirectionRead, "write": AttributeDirectionWrite, }
MapAttributeDirection is a helper map of string to AttributeDirection attribute value.
var MapAttributePagingFaultType = map[string]AttributePagingFaultType{ "major": AttributePagingFaultTypeMajor, "minor": AttributePagingFaultTypeMinor, }
MapAttributePagingFaultType is a helper map of string to AttributePagingFaultType attribute value.
var MapAttributeState = map[string]AttributeState{ "system": AttributeStateSystem, "user": AttributeStateUser, "wait": AttributeStateWait, }
MapAttributeState is a helper map of string to AttributeState attribute value.
Functions ¶
This section is empty.
Types ¶
type AttributeContextSwitchType ¶ added in v0.64.0
type AttributeContextSwitchType int
AttributeContextSwitchType specifies the a value context_switch_type attribute.
const ( AttributeContextSwitchTypeInvoluntary AttributeContextSwitchType AttributeContextSwitchTypeVoluntary )
func (AttributeContextSwitchType) String ¶ added in v0.64.0
func (av AttributeContextSwitchType) String() string
String returns the string representation of the AttributeContextSwitchType.
type AttributeDirection ¶ added in v0.39.0
type AttributeDirection int
AttributeDirection specifies the a value direction attribute.
const ( AttributeDirectionRead AttributeDirection AttributeDirectionWrite )
func (AttributeDirection) String ¶ added in v0.51.0
func (av AttributeDirection) String() string
String returns the string representation of the AttributeDirection.
type AttributePagingFaultType ¶ added in v0.64.0
type AttributePagingFaultType int
AttributePagingFaultType specifies the a value paging_fault_type attribute.
const ( AttributePagingFaultTypeMajor AttributePagingFaultType AttributePagingFaultTypeMinor )
func (AttributePagingFaultType) String ¶ added in v0.64.0
func (av AttributePagingFaultType) String() string
String returns the string representation of the AttributePagingFaultType.
type AttributeState ¶ added in v0.39.0
type AttributeState int
AttributeState specifies the a value state attribute.
const ( AttributeStateSystem AttributeState AttributeStateUser AttributeStateWait )
func (AttributeState) String ¶ added in v0.51.0
func (av AttributeState) String() string
String returns the string representation of the AttributeState.
type MetricBuilderOption ¶ added in v0.110.0
type MetricBuilderOption interface {
// contains filtered or unexported methods
}
MetricBuilderOption applies changes to default metrics builder.
func WithStartTime ¶ added in v0.45.1
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 ¶ 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 config.
func NewMetricsBuilder ¶ added in v0.45.1
func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.Settings, options ...MetricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶ added in v0.45.1
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 ¶ added in v0.48.0
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) NewResourceBuilder ¶ added in v0.83.0
func (mb *MetricsBuilder) NewResourceBuilder() *ResourceBuilder
NewResourceBuilder returns a new resource builder that should be used to build a resource associated with for the emitted metrics.
func (*MetricsBuilder) RecordProcessCPUTimeDataPoint ¶ added in v0.45.1
func (mb *MetricsBuilder) RecordProcessCPUTimeDataPoint(ts pcommon.Timestamp, val float64, stateAttributeValue AttributeState)
RecordProcessCPUTimeDataPoint adds a data point to process.cpu.time metric.
func (*MetricsBuilder) RecordProcessCPUUtilizationDataPoint ¶ added in v0.67.0
func (mb *MetricsBuilder) RecordProcessCPUUtilizationDataPoint(ts pcommon.Timestamp, val float64, stateAttributeValue AttributeState)
RecordProcessCPUUtilizationDataPoint adds a data point to process.cpu.utilization metric.
func (*MetricsBuilder) RecordProcessContextSwitchesDataPoint ¶ added in v0.64.0
func (mb *MetricsBuilder) RecordProcessContextSwitchesDataPoint(ts pcommon.Timestamp, val int64, contextSwitchTypeAttributeValue AttributeContextSwitchType)
RecordProcessContextSwitchesDataPoint adds a data point to process.context_switches metric.
func (*MetricsBuilder) RecordProcessDiskIoDataPoint ¶ added in v0.45.1
func (mb *MetricsBuilder) RecordProcessDiskIoDataPoint(ts pcommon.Timestamp, val int64, directionAttributeValue AttributeDirection)
RecordProcessDiskIoDataPoint adds a data point to process.disk.io metric.
func (*MetricsBuilder) RecordProcessDiskOperationsDataPoint ¶ added in v0.69.0
func (mb *MetricsBuilder) RecordProcessDiskOperationsDataPoint(ts pcommon.Timestamp, val int64, directionAttributeValue AttributeDirection)
RecordProcessDiskOperationsDataPoint adds a data point to process.disk.operations metric.
func (*MetricsBuilder) RecordProcessHandlesDataPoint ¶ added in v0.81.0
func (mb *MetricsBuilder) RecordProcessHandlesDataPoint(ts pcommon.Timestamp, val int64)
RecordProcessHandlesDataPoint adds a data point to process.handles metric.
func (*MetricsBuilder) RecordProcessMemoryUsageDataPoint ¶ added in v0.64.0
func (mb *MetricsBuilder) RecordProcessMemoryUsageDataPoint(ts pcommon.Timestamp, val int64)
RecordProcessMemoryUsageDataPoint adds a data point to process.memory.usage metric.
func (*MetricsBuilder) RecordProcessMemoryUtilizationDataPoint ¶ added in v0.68.0
func (mb *MetricsBuilder) RecordProcessMemoryUtilizationDataPoint(ts pcommon.Timestamp, val float64)
RecordProcessMemoryUtilizationDataPoint adds a data point to process.memory.utilization metric.
func (*MetricsBuilder) RecordProcessMemoryVirtualDataPoint ¶ added in v0.64.0
func (mb *MetricsBuilder) RecordProcessMemoryVirtualDataPoint(ts pcommon.Timestamp, val int64)
RecordProcessMemoryVirtualDataPoint adds a data point to process.memory.virtual metric.
func (*MetricsBuilder) RecordProcessOpenFileDescriptorsDataPoint ¶ added in v0.64.0
func (mb *MetricsBuilder) RecordProcessOpenFileDescriptorsDataPoint(ts pcommon.Timestamp, val int64)
RecordProcessOpenFileDescriptorsDataPoint adds a data point to process.open_file_descriptors metric.
func (*MetricsBuilder) RecordProcessPagingFaultsDataPoint ¶ added in v0.63.0
func (mb *MetricsBuilder) RecordProcessPagingFaultsDataPoint(ts pcommon.Timestamp, val int64, pagingFaultTypeAttributeValue AttributePagingFaultType)
RecordProcessPagingFaultsDataPoint adds a data point to process.paging.faults metric.
func (*MetricsBuilder) RecordProcessSignalsPendingDataPoint ¶ added in v0.66.0
func (mb *MetricsBuilder) RecordProcessSignalsPendingDataPoint(ts pcommon.Timestamp, val int64)
RecordProcessSignalsPendingDataPoint adds a data point to process.signals_pending metric.
func (*MetricsBuilder) RecordProcessThreadsDataPoint ¶ added in v0.59.0
func (mb *MetricsBuilder) RecordProcessThreadsDataPoint(ts pcommon.Timestamp, val int64)
RecordProcessThreadsDataPoint adds a data point to process.threads 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 MetricsBuilderConfig ¶ added in v0.73.0
type MetricsBuilderConfig struct { Metrics MetricsConfig `mapstructure:"metrics"` ResourceAttributes ResourceAttributesConfig `mapstructure:"resource_attributes"` }
MetricsBuilderConfig is a configuration for hostmetricsreceiver/process metrics builder.
func DefaultMetricsBuilderConfig ¶ added in v0.73.0
func DefaultMetricsBuilderConfig() MetricsBuilderConfig
type MetricsConfig ¶ added in v0.77.0
type MetricsConfig struct { ProcessContextSwitches MetricConfig `mapstructure:"process.context_switches"` ProcessCPUTime MetricConfig `mapstructure:"process.cpu.time"` ProcessCPUUtilization MetricConfig `mapstructure:"process.cpu.utilization"` ProcessDiskIo MetricConfig `mapstructure:"process.disk.io"` ProcessDiskOperations MetricConfig `mapstructure:"process.disk.operations"` ProcessHandles MetricConfig `mapstructure:"process.handles"` ProcessMemoryUsage MetricConfig `mapstructure:"process.memory.usage"` ProcessMemoryUtilization MetricConfig `mapstructure:"process.memory.utilization"` ProcessMemoryVirtual MetricConfig `mapstructure:"process.memory.virtual"` ProcessOpenFileDescriptors MetricConfig `mapstructure:"process.open_file_descriptors"` ProcessPagingFaults MetricConfig `mapstructure:"process.paging.faults"` ProcessSignalsPending MetricConfig `mapstructure:"process.signals_pending"` ProcessThreads MetricConfig `mapstructure:"process.threads"` }
MetricsConfig provides config for hostmetricsreceiver/process metrics.
func DefaultMetricsConfig ¶ added in v0.77.0
func DefaultMetricsConfig() MetricsConfig
type ResourceAttributeConfig ¶ added in v0.77.0
type ResourceAttributeConfig struct { Enabled bool `mapstructure:"enabled"` // Experimental: MetricsInclude defines a list of filters for attribute values. // If the list is not empty, only metrics with matching resource attribute values will be emitted. MetricsInclude []filter.Config `mapstructure:"metrics_include"` // Experimental: MetricsExclude defines a list of filters for attribute values. // If the list is not empty, metrics with matching resource attribute values will not be emitted. // MetricsInclude has higher priority than MetricsExclude. MetricsExclude []filter.Config `mapstructure:"metrics_exclude"` // contains filtered or unexported fields }
ResourceAttributeConfig provides common config for a particular resource attribute.
type ResourceAttributesConfig ¶ added in v0.77.0
type ResourceAttributesConfig struct { ProcessCgroup ResourceAttributeConfig `mapstructure:"process.cgroup"` ProcessCommand ResourceAttributeConfig `mapstructure:"process.command"` ProcessCommandLine ResourceAttributeConfig `mapstructure:"process.command_line"` ProcessExecutableName ResourceAttributeConfig `mapstructure:"process.executable.name"` ProcessExecutablePath ResourceAttributeConfig `mapstructure:"process.executable.path"` ProcessOwner ResourceAttributeConfig `mapstructure:"process.owner"` ProcessParentPid ResourceAttributeConfig `mapstructure:"process.parent_pid"` ProcessPid ResourceAttributeConfig `mapstructure:"process.pid"` }
ResourceAttributesConfig provides config for hostmetricsreceiver/process resource attributes.
func DefaultResourceAttributesConfig ¶ added in v0.77.0
func DefaultResourceAttributesConfig() ResourceAttributesConfig
type ResourceBuilder ¶ added in v0.82.0
type ResourceBuilder struct {
// contains filtered or unexported fields
}
ResourceBuilder is a helper struct to build resources predefined in metadata.yaml. The ResourceBuilder is not thread-safe and must not to be used in multiple goroutines.
func NewResourceBuilder ¶ added in v0.82.0
func NewResourceBuilder(rac ResourceAttributesConfig) *ResourceBuilder
NewResourceBuilder creates a new ResourceBuilder. This method should be called on the start of the application.
func (*ResourceBuilder) Emit ¶ added in v0.82.0
func (rb *ResourceBuilder) Emit() pcommon.Resource
Emit returns the built resource and resets the internal builder state.
func (*ResourceBuilder) SetProcessCgroup ¶ added in v0.95.0
func (rb *ResourceBuilder) SetProcessCgroup(val string)
SetProcessCgroup sets provided value as "process.cgroup" attribute.
func (*ResourceBuilder) SetProcessCommand ¶ added in v0.82.0
func (rb *ResourceBuilder) SetProcessCommand(val string)
SetProcessCommand sets provided value as "process.command" attribute.
func (*ResourceBuilder) SetProcessCommandLine ¶ added in v0.82.0
func (rb *ResourceBuilder) SetProcessCommandLine(val string)
SetProcessCommandLine sets provided value as "process.command_line" attribute.
func (*ResourceBuilder) SetProcessExecutableName ¶ added in v0.82.0
func (rb *ResourceBuilder) SetProcessExecutableName(val string)
SetProcessExecutableName sets provided value as "process.executable.name" attribute.
func (*ResourceBuilder) SetProcessExecutablePath ¶ added in v0.82.0
func (rb *ResourceBuilder) SetProcessExecutablePath(val string)
SetProcessExecutablePath sets provided value as "process.executable.path" attribute.
func (*ResourceBuilder) SetProcessOwner ¶ added in v0.82.0
func (rb *ResourceBuilder) SetProcessOwner(val string)
SetProcessOwner sets provided value as "process.owner" attribute.
func (*ResourceBuilder) SetProcessParentPid ¶ added in v0.82.0
func (rb *ResourceBuilder) SetProcessParentPid(val int64)
SetProcessParentPid sets provided value as "process.parent_pid" attribute.
func (*ResourceBuilder) SetProcessPid ¶ added in v0.82.0
func (rb *ResourceBuilder) SetProcessPid(val int64)
SetProcessPid sets provided value as "process.pid" attribute.
type ResourceMetricsOption ¶ added in v0.52.0
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 ¶ 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.