Documentation ¶
Index ¶
- Variables
- func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption
- type AttributeOperation
- type AttributeRequest
- type MetricSettings
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(rmo ...ResourceMetricsOption) pmetric.Metrics
- func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption)
- func (mb *MetricsBuilder) RecordRiakMemoryLimitDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordRiakNodeOperationCountDataPoint(ts pcommon.Timestamp, val int64, requestAttributeValue AttributeRequest)
- func (mb *MetricsBuilder) RecordRiakNodeOperationTimeMeanDataPoint(ts pcommon.Timestamp, val int64, requestAttributeValue AttributeRequest)
- func (mb *MetricsBuilder) RecordRiakNodeReadRepairCountDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordRiakVnodeIndexOperationCountDataPoint(ts pcommon.Timestamp, val int64, operationAttributeValue AttributeOperation)
- func (mb *MetricsBuilder) RecordRiakVnodeOperationCountDataPoint(ts pcommon.Timestamp, val int64, requestAttributeValue AttributeRequest)
- func (mb *MetricsBuilder) Reset(options ...metricBuilderOption)
- type MetricsSettings
- type ResourceMetricsOption
Constants ¶
This section is empty.
Variables ¶
var MapAttributeOperation = map[string]AttributeOperation{ "read": AttributeOperationRead, "write": AttributeOperationWrite, "delete": AttributeOperationDelete, }
MapAttributeOperation is a helper map of string to AttributeOperation attribute value.
var MapAttributeRequest = map[string]AttributeRequest{ "put": AttributeRequestPut, "get": AttributeRequestGet, }
MapAttributeRequest is a helper map of string to AttributeRequest attribute value.
Functions ¶
func WithStartTime ¶
WithStartTime sets startTime on the metrics builder.
Types ¶
type AttributeOperation ¶
type AttributeOperation int
AttributeOperation specifies the a value operation attribute.
const ( AttributeOperationRead AttributeOperation AttributeOperationWrite AttributeOperationDelete )
func (AttributeOperation) String ¶ added in v0.51.0
func (av AttributeOperation) String() string
String returns the string representation of the AttributeOperation.
type AttributeRequest ¶
type AttributeRequest int
AttributeRequest specifies the a value request attribute.
const ( AttributeRequestPut AttributeRequest AttributeRequestGet )
func (AttributeRequest) String ¶ added in v0.51.0
func (av AttributeRequest) String() string
String returns the string representation of the AttributeRequest.
type MetricSettings ¶
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 ¶
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 ¶
func NewMetricsBuilder(ms MetricsSettings, settings receiver.CreateSettings, options ...metricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶
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 ¶
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) RecordRiakMemoryLimitDataPoint ¶
func (mb *MetricsBuilder) RecordRiakMemoryLimitDataPoint(ts pcommon.Timestamp, val int64)
RecordRiakMemoryLimitDataPoint adds a data point to riak.memory.limit metric.
func (*MetricsBuilder) RecordRiakNodeOperationCountDataPoint ¶
func (mb *MetricsBuilder) RecordRiakNodeOperationCountDataPoint(ts pcommon.Timestamp, val int64, requestAttributeValue AttributeRequest)
RecordRiakNodeOperationCountDataPoint adds a data point to riak.node.operation.count metric.
func (*MetricsBuilder) RecordRiakNodeOperationTimeMeanDataPoint ¶
func (mb *MetricsBuilder) RecordRiakNodeOperationTimeMeanDataPoint(ts pcommon.Timestamp, val int64, requestAttributeValue AttributeRequest)
RecordRiakNodeOperationTimeMeanDataPoint adds a data point to riak.node.operation.time.mean metric.
func (*MetricsBuilder) RecordRiakNodeReadRepairCountDataPoint ¶
func (mb *MetricsBuilder) RecordRiakNodeReadRepairCountDataPoint(ts pcommon.Timestamp, val int64)
RecordRiakNodeReadRepairCountDataPoint adds a data point to riak.node.read_repair.count metric.
func (*MetricsBuilder) RecordRiakVnodeIndexOperationCountDataPoint ¶
func (mb *MetricsBuilder) RecordRiakVnodeIndexOperationCountDataPoint(ts pcommon.Timestamp, val int64, operationAttributeValue AttributeOperation)
RecordRiakVnodeIndexOperationCountDataPoint adds a data point to riak.vnode.index.operation.count metric.
func (*MetricsBuilder) RecordRiakVnodeOperationCountDataPoint ¶
func (mb *MetricsBuilder) RecordRiakVnodeOperationCountDataPoint(ts pcommon.Timestamp, val int64, requestAttributeValue AttributeRequest)
RecordRiakVnodeOperationCountDataPoint adds a data point to riak.vnode.operation.count metric.
func (*MetricsBuilder) Reset ¶
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 ¶
type MetricsSettings struct { RiakMemoryLimit MetricSettings `mapstructure:"riak.memory.limit"` RiakNodeOperationCount MetricSettings `mapstructure:"riak.node.operation.count"` RiakNodeOperationTimeMean MetricSettings `mapstructure:"riak.node.operation.time.mean"` RiakNodeReadRepairCount MetricSettings `mapstructure:"riak.node.read_repair.count"` RiakVnodeIndexOperationCount MetricSettings `mapstructure:"riak.vnode.index.operation.count"` RiakVnodeOperationCount MetricSettings `mapstructure:"riak.vnode.operation.count"` }
MetricsSettings provides settings for riakreceiver metrics.
func DefaultMetricsSettings ¶
func DefaultMetricsSettings() MetricsSettings
type ResourceMetricsOption ¶ added in v0.52.0
type ResourceMetricsOption func(pmetric.ResourceMetrics)
ResourceMetricsOption applies changes to provided resource metrics.
func WithRiakNodeName ¶
func WithRiakNodeName(val string) ResourceMetricsOption
WithRiakNodeName sets provided value as "riak.node.name" 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.