metadata

package
v0.51.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

A is an alias for Attributes.

View Source
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.

View Source
var MapAttributeCommand = map[string]AttributeCommand{
	"get":   AttributeCommandGet,
	"set":   AttributeCommandSet,
	"flush": AttributeCommandFlush,
	"touch": AttributeCommandTouch,
}

MapAttributeCommand is a helper map of string to AttributeCommand attribute value.

View Source
var MapAttributeDirection = map[string]AttributeDirection{
	"sent":     AttributeDirectionSent,
	"received": AttributeDirectionReceived,
}

MapAttributeDirection is a helper map of string to AttributeDirection attribute value.

View Source
var MapAttributeOperation = map[string]AttributeOperation{
	"increment": AttributeOperationIncrement,
	"decrement": AttributeOperationDecrement,
	"get":       AttributeOperationGet,
}

MapAttributeOperation is a helper map of string to AttributeOperation attribute value.

View Source
var MapAttributeState = map[string]AttributeState{
	"system": AttributeStateSystem,
	"user":   AttributeStateUser,
}

MapAttributeState is a helper map of string to AttributeState attribute value.

View Source
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

func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption

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"`
}

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 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 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

type ResourceOption func(pcommon.Resource)

ResourceOption applies changes to provided resource.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL