Documentation ¶
Index ¶
- Variables
- func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption
- type AttributeCommand
- type AttributeDirection
- type AttributeOperation
- type AttributeState
- type AttributeType
- type MetricSettings
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(rmo ...ResourceMetricsOption) pmetric.Metrics
- func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption)
- func (mb *MetricsBuilder) RecordMemcachedBytesDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordMemcachedCPUUsageDataPoint(ts pcommon.Timestamp, val float64, stateAttributeValue AttributeState)
- func (mb *MetricsBuilder) RecordMemcachedCommandsDataPoint(ts pcommon.Timestamp, val int64, commandAttributeValue AttributeCommand)
- func (mb *MetricsBuilder) RecordMemcachedConnectionsCurrentDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordMemcachedConnectionsTotalDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordMemcachedCurrentItemsDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordMemcachedEvictionsDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordMemcachedNetworkDataPoint(ts pcommon.Timestamp, val int64, directionAttributeValue AttributeDirection)
- func (mb *MetricsBuilder) RecordMemcachedOperationHitRatioDataPoint(ts pcommon.Timestamp, val float64, operationAttributeValue AttributeOperation)
- func (mb *MetricsBuilder) RecordMemcachedOperationsDataPoint(ts pcommon.Timestamp, val int64, typeAttributeValue AttributeType, ...)
- func (mb *MetricsBuilder) RecordMemcachedThreadsDataPoint(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 MapAttributeCommand = map[string]AttributeCommand{ "get": AttributeCommandGet, "set": AttributeCommandSet, "flush": AttributeCommandFlush, "touch": AttributeCommandTouch, }
MapAttributeCommand is a helper map of string to AttributeCommand attribute value.
var MapAttributeDirection = map[string]AttributeDirection{ "sent": AttributeDirectionSent, "received": AttributeDirectionReceived, }
MapAttributeDirection is a helper map of string to AttributeDirection attribute value.
var MapAttributeOperation = map[string]AttributeOperation{ "increment": AttributeOperationIncrement, "decrement": AttributeOperationDecrement, "get": AttributeOperationGet, }
MapAttributeOperation is a helper map of string to AttributeOperation attribute value.
var MapAttributeState = map[string]AttributeState{ "system": AttributeStateSystem, "user": AttributeStateUser, }
MapAttributeState is a helper map of string to AttributeState attribute value.
var MapAttributeType = map[string]AttributeType{ "hit": AttributeTypeHit, "miss": AttributeTypeMiss, }
MapAttributeType is a helper map of string to AttributeType attribute value.
Functions ¶
func WithStartTime ¶ added in v0.50.0
WithStartTime sets startTime on the metrics builder.
Types ¶
type AttributeCommand ¶ added in v0.40.0
type AttributeCommand int
AttributeCommand specifies the a value command attribute.
const ( AttributeCommandGet AttributeCommand AttributeCommandSet AttributeCommandFlush AttributeCommandTouch )
func (AttributeCommand) String ¶ added in v0.51.0
func (av AttributeCommand) String() string
String returns the string representation of the AttributeCommand.
type AttributeDirection ¶ added in v0.40.0
type AttributeDirection int
AttributeDirection specifies the a value direction attribute.
const ( AttributeDirectionSent AttributeDirection AttributeDirectionReceived )
func (AttributeDirection) String ¶ added in v0.51.0
func (av AttributeDirection) String() string
String returns the string representation of the AttributeDirection.
type AttributeOperation ¶ added in v0.40.0
type AttributeOperation int
AttributeOperation specifies the a value operation attribute.
const ( AttributeOperationIncrement AttributeOperation AttributeOperationDecrement AttributeOperationGet )
func (AttributeOperation) String ¶ added in v0.51.0
func (av AttributeOperation) String() string
String returns the string representation of the AttributeOperation.
type AttributeState ¶ added in v0.40.0
type AttributeState int
AttributeState specifies the a value state attribute.
const ( AttributeStateSystem AttributeState AttributeStateUser )
func (AttributeState) String ¶ added in v0.51.0
func (av AttributeState) String() string
String returns the string representation of the AttributeState.
type AttributeType ¶ added in v0.40.0
type AttributeType int
AttributeType specifies the a value type attribute.
const ( AttributeTypeHit AttributeType AttributeTypeMiss )
func (AttributeType) String ¶ added in v0.51.0
func (av AttributeType) String() string
String returns the string representation of the AttributeType.
type MetricSettings ¶ added in v0.50.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.50.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.50.0
func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.CreateSettings, options ...metricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶ added in v0.50.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.50.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) RecordMemcachedBytesDataPoint ¶ added in v0.50.0
func (mb *MetricsBuilder) RecordMemcachedBytesDataPoint(ts pcommon.Timestamp, val int64)
RecordMemcachedBytesDataPoint adds a data point to memcached.bytes metric.
func (*MetricsBuilder) RecordMemcachedCPUUsageDataPoint ¶ added in v0.50.0
func (mb *MetricsBuilder) RecordMemcachedCPUUsageDataPoint(ts pcommon.Timestamp, val float64, stateAttributeValue AttributeState)
RecordMemcachedCPUUsageDataPoint adds a data point to memcached.cpu.usage metric.
func (*MetricsBuilder) RecordMemcachedCommandsDataPoint ¶ added in v0.50.0
func (mb *MetricsBuilder) RecordMemcachedCommandsDataPoint(ts pcommon.Timestamp, val int64, commandAttributeValue AttributeCommand)
RecordMemcachedCommandsDataPoint adds a data point to memcached.commands metric.
func (*MetricsBuilder) RecordMemcachedConnectionsCurrentDataPoint ¶ added in v0.50.0
func (mb *MetricsBuilder) RecordMemcachedConnectionsCurrentDataPoint(ts pcommon.Timestamp, val int64)
RecordMemcachedConnectionsCurrentDataPoint adds a data point to memcached.connections.current metric.
func (*MetricsBuilder) RecordMemcachedConnectionsTotalDataPoint ¶ added in v0.50.0
func (mb *MetricsBuilder) RecordMemcachedConnectionsTotalDataPoint(ts pcommon.Timestamp, val int64)
RecordMemcachedConnectionsTotalDataPoint adds a data point to memcached.connections.total metric.
func (*MetricsBuilder) RecordMemcachedCurrentItemsDataPoint ¶ added in v0.50.0
func (mb *MetricsBuilder) RecordMemcachedCurrentItemsDataPoint(ts pcommon.Timestamp, val int64)
RecordMemcachedCurrentItemsDataPoint adds a data point to memcached.current_items metric.
func (*MetricsBuilder) RecordMemcachedEvictionsDataPoint ¶ added in v0.50.0
func (mb *MetricsBuilder) RecordMemcachedEvictionsDataPoint(ts pcommon.Timestamp, val int64)
RecordMemcachedEvictionsDataPoint adds a data point to memcached.evictions metric.
func (*MetricsBuilder) RecordMemcachedNetworkDataPoint ¶ added in v0.50.0
func (mb *MetricsBuilder) RecordMemcachedNetworkDataPoint(ts pcommon.Timestamp, val int64, directionAttributeValue AttributeDirection)
RecordMemcachedNetworkDataPoint adds a data point to memcached.network metric.
func (*MetricsBuilder) RecordMemcachedOperationHitRatioDataPoint ¶ added in v0.50.0
func (mb *MetricsBuilder) RecordMemcachedOperationHitRatioDataPoint(ts pcommon.Timestamp, val float64, operationAttributeValue AttributeOperation)
RecordMemcachedOperationHitRatioDataPoint adds a data point to memcached.operation_hit_ratio metric.
func (*MetricsBuilder) RecordMemcachedOperationsDataPoint ¶ added in v0.50.0
func (mb *MetricsBuilder) RecordMemcachedOperationsDataPoint(ts pcommon.Timestamp, val int64, typeAttributeValue AttributeType, operationAttributeValue AttributeOperation)
RecordMemcachedOperationsDataPoint adds a data point to memcached.operations metric.
func (*MetricsBuilder) RecordMemcachedThreadsDataPoint ¶ added in v0.50.0
func (mb *MetricsBuilder) RecordMemcachedThreadsDataPoint(ts pcommon.Timestamp, val int64)
RecordMemcachedThreadsDataPoint adds a data point to memcached.threads metric.
func (*MetricsBuilder) Reset ¶ added in v0.50.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.50.0
type MetricsSettings struct { MemcachedBytes MetricSettings `mapstructure:"memcached.bytes"` MemcachedCommands MetricSettings `mapstructure:"memcached.commands"` MemcachedConnectionsCurrent MetricSettings `mapstructure:"memcached.connections.current"` MemcachedConnectionsTotal MetricSettings `mapstructure:"memcached.connections.total"` MemcachedCPUUsage MetricSettings `mapstructure:"memcached.cpu.usage"` MemcachedCurrentItems MetricSettings `mapstructure:"memcached.current_items"` MemcachedEvictions MetricSettings `mapstructure:"memcached.evictions"` MemcachedNetwork MetricSettings `mapstructure:"memcached.network"` MemcachedOperationHitRatio MetricSettings `mapstructure:"memcached.operation_hit_ratio"` MemcachedOperations MetricSettings `mapstructure:"memcached.operations"` MemcachedThreads MetricSettings `mapstructure:"memcached.threads"` }
MetricsSettings provides settings for memcachedreceiver metrics.
func DefaultMetricsSettings ¶ added in v0.50.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 memcachedreceiver 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.