Documentation ¶
Index ¶
- Variables
- func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption
- type AttributeContextSwitchType
- type AttributeDirection
- type AttributePagingFaultType
- type AttributeState
- type MetricSettings
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(rmo ...ResourceMetricsOption) pmetric.Metrics
- func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption)
- 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) RecordProcessMemoryPhysicalUsageDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordProcessMemoryUsageDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordProcessMemoryVirtualDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordProcessMemoryVirtualUsageDataPoint(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 MetricsSettings
- type ResourceMetricsOption
- func WithProcessCommand(val string) ResourceMetricsOption
- func WithProcessCommandLine(val string) ResourceMetricsOption
- func WithProcessExecutableName(val string) ResourceMetricsOption
- func WithProcessExecutablePath(val string) ResourceMetricsOption
- func WithProcessOwner(val string) ResourceMetricsOption
- func WithProcessParentPid(val int64) ResourceMetricsOption
- func WithProcessPid(val int64) ResourceMetricsOption
- func WithStartTimeOverride(start pcommon.Timestamp) 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 ¶
func WithStartTime ¶ added in v0.45.1
WithStartTime sets startTime on the metrics builder.
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 MetricSettings ¶ added in v0.45.1
type MetricSettings struct { Enabled bool `mapstructure:"enabled"` // contains filtered or unexported fields }
MetricSettings provides common settings for a particular metric.
func (*MetricSettings) IsEnabledProvidedByUser ¶ added in v0.63.0
func (ms *MetricSettings) IsEnabledProvidedByUser() bool
IsEnabledProvidedByUser returns true if `enabled` option is explicitly set in user settings to any value.
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(ms MetricsSettings, settings receiver.CreateSettings, options ...metricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶ added in v0.45.1
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.48.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) 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) RecordProcessMemoryPhysicalUsageDataPoint ¶ added in v0.45.1
func (mb *MetricsBuilder) RecordProcessMemoryPhysicalUsageDataPoint(ts pcommon.Timestamp, val int64)
RecordProcessMemoryPhysicalUsageDataPoint adds a data point to process.memory.physical_usage 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) 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) RecordProcessMemoryVirtualUsageDataPoint ¶ added in v0.45.1
func (mb *MetricsBuilder) RecordProcessMemoryVirtualUsageDataPoint(ts pcommon.Timestamp, val int64)
RecordProcessMemoryVirtualUsageDataPoint adds a data point to process.memory.virtual_usage 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 MetricsSettings ¶ added in v0.45.1
type MetricsSettings struct { ProcessContextSwitches MetricSettings `mapstructure:"process.context_switches"` ProcessCPUTime MetricSettings `mapstructure:"process.cpu.time"` ProcessCPUUtilization MetricSettings `mapstructure:"process.cpu.utilization"` ProcessDiskIo MetricSettings `mapstructure:"process.disk.io"` ProcessMemoryPhysicalUsage MetricSettings `mapstructure:"process.memory.physical_usage"` ProcessMemoryUsage MetricSettings `mapstructure:"process.memory.usage"` ProcessMemoryVirtual MetricSettings `mapstructure:"process.memory.virtual"` ProcessMemoryVirtualUsage MetricSettings `mapstructure:"process.memory.virtual_usage"` ProcessOpenFileDescriptors MetricSettings `mapstructure:"process.open_file_descriptors"` ProcessPagingFaults MetricSettings `mapstructure:"process.paging.faults"` ProcessSignalsPending MetricSettings `mapstructure:"process.signals_pending"` ProcessThreads MetricSettings `mapstructure:"process.threads"` }
MetricsSettings provides settings for hostmetricsreceiver/process metrics.
func DefaultMetricsSettings ¶ added in v0.45.1
func DefaultMetricsSettings() MetricsSettings
type ResourceMetricsOption ¶ added in v0.52.0
type ResourceMetricsOption func(pmetric.ResourceMetrics)
ResourceMetricsOption applies changes to provided resource metrics.
func WithProcessCommand ¶ added in v0.48.0
func WithProcessCommand(val string) ResourceMetricsOption
WithProcessCommand sets provided value as "process.command" attribute for current resource.
func WithProcessCommandLine ¶ added in v0.48.0
func WithProcessCommandLine(val string) ResourceMetricsOption
WithProcessCommandLine sets provided value as "process.command_line" attribute for current resource.
func WithProcessExecutableName ¶ added in v0.48.0
func WithProcessExecutableName(val string) ResourceMetricsOption
WithProcessExecutableName sets provided value as "process.executable.name" attribute for current resource.
func WithProcessExecutablePath ¶ added in v0.48.0
func WithProcessExecutablePath(val string) ResourceMetricsOption
WithProcessExecutablePath sets provided value as "process.executable.path" attribute for current resource.
func WithProcessOwner ¶ added in v0.48.0
func WithProcessOwner(val string) ResourceMetricsOption
WithProcessOwner sets provided value as "process.owner" attribute for current resource.
func WithProcessParentPid ¶ added in v0.58.0
func WithProcessParentPid(val int64) ResourceMetricsOption
WithProcessParentPid sets provided value as "process.parent_pid" attribute for current resource.
func WithProcessPid ¶ added in v0.48.0
func WithProcessPid(val int64) ResourceMetricsOption
WithProcessPid sets provided value as "process.pid" attribute for current 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.