Documentation ¶
Index ¶
- Constants
- Variables
- type AttributeCommand
- type AttributeDirection
- type AttributeOperation
- type AttributeState
- type AttributeType
- type MetricBuilderOption
- type MetricConfig
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(options ...ResourceMetricsOption) pmetric.Metrics
- func (mb *MetricsBuilder) EmitForResource(options ...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 MetricsConfig
- type ResourceMetricsOption
Constants ¶
const (
MetricsStability = component.StabilityLevelBeta
)
Variables ¶
var ( Type = component.MustNewType("memcached") ScopeName = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/memcachedreceiver" )
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 ¶
This section is empty.
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 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.50.0
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.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 config.
func NewMetricsBuilder ¶ added in v0.50.0
func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.Settings, options ...MetricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶ added in v0.50.0
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.50.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) 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 MetricsConfig `mapstructure:"metrics"`
}
MetricsBuilderConfig is a configuration for memcached metrics builder.
func DefaultMetricsBuilderConfig ¶ added in v0.73.0
func DefaultMetricsBuilderConfig() MetricsBuilderConfig
type MetricsConfig ¶ added in v0.77.0
type MetricsConfig struct { MemcachedBytes MetricConfig `mapstructure:"memcached.bytes"` MemcachedCommands MetricConfig `mapstructure:"memcached.commands"` MemcachedConnectionsCurrent MetricConfig `mapstructure:"memcached.connections.current"` MemcachedConnectionsTotal MetricConfig `mapstructure:"memcached.connections.total"` MemcachedCPUUsage MetricConfig `mapstructure:"memcached.cpu.usage"` MemcachedCurrentItems MetricConfig `mapstructure:"memcached.current_items"` MemcachedEvictions MetricConfig `mapstructure:"memcached.evictions"` MemcachedNetwork MetricConfig `mapstructure:"memcached.network"` MemcachedOperationHitRatio MetricConfig `mapstructure:"memcached.operation_hit_ratio"` MemcachedOperations MetricConfig `mapstructure:"memcached.operations"` MemcachedThreads MetricConfig `mapstructure:"memcached.threads"` }
MetricsConfig provides config for memcached metrics.
func DefaultMetricsConfig ¶ added in v0.77.0
func DefaultMetricsConfig() MetricsConfig
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.