Documentation ¶
Index ¶
- Variables
- func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption
- type MetricSettings
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(ro ...ResourceOption) pmetric.Metrics
- func (mb *MetricsBuilder) EmitForResource(ro ...ResourceOption)
- func (mb *MetricsBuilder) RecordMemcachedBytesDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordMemcachedCPUUsageDataPoint(ts pcommon.Timestamp, val float64, stateAttributeValue string)
- func (mb *MetricsBuilder) RecordMemcachedCommandsDataPoint(ts pcommon.Timestamp, val int64, commandAttributeValue string)
- 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 string)
- func (mb *MetricsBuilder) RecordMemcachedOperationHitRatioDataPoint(ts pcommon.Timestamp, val float64, operationAttributeValue string)
- func (mb *MetricsBuilder) RecordMemcachedOperationsDataPoint(ts pcommon.Timestamp, val int64, typeAttributeValue string, ...)
- func (mb *MetricsBuilder) RecordMemcachedThreadsDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) Reset(options ...metricBuilderOption)
- type MetricsSettings
- type ResourceOption
Constants ¶
This section is empty.
Variables ¶
var A = Attributes
A is an alias for Attributes.
var AttributeCommand = struct { Get string Set string Flush string Touch string }{ "get", "set", "flush", "touch", }
AttributeCommand are the possible values that the attribute "command" can have.
var AttributeDirection = struct { Sent string Received string }{ "sent", "received", }
AttributeDirection are the possible values that the attribute "direction" can have.
var AttributeOperation = struct { Increment string Decrement string Get string }{ "increment", "decrement", "get", }
AttributeOperation are the possible values that the attribute "operation" can have.
var AttributeState = struct { System string User string }{ "system", "user", }
AttributeState are the possible values that the attribute "state" can have.
var AttributeType = struct { Hit string Miss string }{ "hit", "miss", }
AttributeType are the possible values that the attribute "type" can have.
var Attributes = struct { // Command (The type of command.) Command string // Direction (Direction of data flow.) Direction string // Operation (The type of operation.) Operation string // State (The type of CPU usage.) State string // Type (Result of cache request.) Type string }{ "command", "direction", "operation", "state", "type", }
Attributes contains the possible metric attributes that can be used.
Functions ¶
func WithStartTime ¶ added in v0.50.0
WithStartTime sets startTime on the metrics builder.
Types ¶
type MetricSettings ¶ added in v0.50.0
type MetricSettings struct {
Enabled bool `mapstructure:"enabled"`
}
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(settings MetricsSettings, options ...metricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶ added in v0.50.0
func (mb *MetricsBuilder) Emit(ro ...ResourceOption) 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(ro ...ResourceOption)
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 ResourceOption 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 string)
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 string)
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 string)
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 string)
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 string, operationAttributeValue string)
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 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 ResourceOption ¶ added in v0.50.0
ResourceOption applies changes to provided resource.