metadata

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

MapAttributeConnectionType is a helper map of string to AttributeConnectionType attribute value.

View Source
var MapAttributeMemoryType = map[string]AttributeMemoryType{
	"resident": AttributeMemoryTypeResident,
	"virtual":  AttributeMemoryTypeVirtual,
}

MapAttributeMemoryType is a helper map of string to AttributeMemoryType attribute value.

MapAttributeOperation is a helper map of string to AttributeOperation 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

func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption

WithStartTime sets startTime on the metrics builder.

Types

type AttributeConnectionType

type AttributeConnectionType int

AttributeConnectionType specifies the a value connection_type attribute.

const (
	AttributeConnectionTypeActive AttributeConnectionType
	AttributeConnectionTypeAvailable
	AttributeConnectionTypeCurrent
)

func (AttributeConnectionType) String added in v0.51.0

func (av AttributeConnectionType) String() string

String returns the string representation of the AttributeConnectionType.

type AttributeMemoryType

type AttributeMemoryType int

AttributeMemoryType specifies the a value memory_type attribute.

const (
	AttributeMemoryTypeResident AttributeMemoryType
	AttributeMemoryTypeVirtual
)

func (AttributeMemoryType) String added in v0.51.0

func (av AttributeMemoryType) String() string

String returns the string representation of the AttributeMemoryType.

type AttributeOperation

type AttributeOperation int

AttributeOperation specifies the a value operation attribute.

const (
	AttributeOperationInsert AttributeOperation
	AttributeOperationQuery
	AttributeOperationUpdate
	AttributeOperationDelete
	AttributeOperationGetmore
	AttributeOperationCommand
)

func (AttributeOperation) String added in v0.51.0

func (av AttributeOperation) String() string

String returns the string representation of the AttributeOperation.

type AttributeType

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

type MetricSettings struct {
	Enabled bool `mapstructure:"enabled"`
}

MetricSettings provides common settings for a particular metric.

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(settings MetricsSettings, buildInfo component.BuildInfo, options ...metricBuilderOption) *MetricsBuilder

func (*MetricsBuilder) Emit

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.48.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) RecordMongodbCacheOperationsDataPoint

func (mb *MetricsBuilder) RecordMongodbCacheOperationsDataPoint(ts pcommon.Timestamp, val int64, typeAttributeValue AttributeType)

RecordMongodbCacheOperationsDataPoint adds a data point to mongodb.cache.operations metric.

func (*MetricsBuilder) RecordMongodbCollectionCountDataPoint

func (mb *MetricsBuilder) RecordMongodbCollectionCountDataPoint(ts pcommon.Timestamp, val int64, databaseAttributeValue string)

RecordMongodbCollectionCountDataPoint adds a data point to mongodb.collection.count metric.

func (*MetricsBuilder) RecordMongodbConnectionCountDataPoint

func (mb *MetricsBuilder) RecordMongodbConnectionCountDataPoint(ts pcommon.Timestamp, val int64, databaseAttributeValue string, connectionTypeAttributeValue AttributeConnectionType)

RecordMongodbConnectionCountDataPoint adds a data point to mongodb.connection.count metric.

func (*MetricsBuilder) RecordMongodbDataSizeDataPoint

func (mb *MetricsBuilder) RecordMongodbDataSizeDataPoint(ts pcommon.Timestamp, val int64, databaseAttributeValue string)

RecordMongodbDataSizeDataPoint adds a data point to mongodb.data.size metric.

func (*MetricsBuilder) RecordMongodbExtentCountDataPoint

func (mb *MetricsBuilder) RecordMongodbExtentCountDataPoint(ts pcommon.Timestamp, val int64, databaseAttributeValue string)

RecordMongodbExtentCountDataPoint adds a data point to mongodb.extent.count metric.

func (*MetricsBuilder) RecordMongodbGlobalLockTimeDataPoint

func (mb *MetricsBuilder) RecordMongodbGlobalLockTimeDataPoint(ts pcommon.Timestamp, val int64)

RecordMongodbGlobalLockTimeDataPoint adds a data point to mongodb.global_lock.time metric.

func (*MetricsBuilder) RecordMongodbIndexCountDataPoint

func (mb *MetricsBuilder) RecordMongodbIndexCountDataPoint(ts pcommon.Timestamp, val int64, databaseAttributeValue string)

RecordMongodbIndexCountDataPoint adds a data point to mongodb.index.count metric.

func (*MetricsBuilder) RecordMongodbIndexSizeDataPoint

func (mb *MetricsBuilder) RecordMongodbIndexSizeDataPoint(ts pcommon.Timestamp, val int64, databaseAttributeValue string)

RecordMongodbIndexSizeDataPoint adds a data point to mongodb.index.size metric.

func (*MetricsBuilder) RecordMongodbMemoryUsageDataPoint

func (mb *MetricsBuilder) RecordMongodbMemoryUsageDataPoint(ts pcommon.Timestamp, val int64, databaseAttributeValue string, memoryTypeAttributeValue AttributeMemoryType)

RecordMongodbMemoryUsageDataPoint adds a data point to mongodb.memory.usage metric.

func (*MetricsBuilder) RecordMongodbObjectCountDataPoint

func (mb *MetricsBuilder) RecordMongodbObjectCountDataPoint(ts pcommon.Timestamp, val int64, databaseAttributeValue string)

RecordMongodbObjectCountDataPoint adds a data point to mongodb.object.count metric.

func (*MetricsBuilder) RecordMongodbOperationCountDataPoint

func (mb *MetricsBuilder) RecordMongodbOperationCountDataPoint(ts pcommon.Timestamp, val int64, operationAttributeValue AttributeOperation)

RecordMongodbOperationCountDataPoint adds a data point to mongodb.operation.count metric.

func (*MetricsBuilder) RecordMongodbStorageSizeDataPoint

func (mb *MetricsBuilder) RecordMongodbStorageSizeDataPoint(ts pcommon.Timestamp, val int64, databaseAttributeValue string)

RecordMongodbStorageSizeDataPoint adds a data point to mongodb.storage.size 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 {
	MongodbCacheOperations MetricSettings `mapstructure:"mongodb.cache.operations"`
	MongodbCollectionCount MetricSettings `mapstructure:"mongodb.collection.count"`
	MongodbConnectionCount MetricSettings `mapstructure:"mongodb.connection.count"`
	MongodbDataSize        MetricSettings `mapstructure:"mongodb.data.size"`
	MongodbExtentCount     MetricSettings `mapstructure:"mongodb.extent.count"`
	MongodbGlobalLockTime  MetricSettings `mapstructure:"mongodb.global_lock.time"`
	MongodbIndexCount      MetricSettings `mapstructure:"mongodb.index.count"`
	MongodbIndexSize       MetricSettings `mapstructure:"mongodb.index.size"`
	MongodbMemoryUsage     MetricSettings `mapstructure:"mongodb.memory.usage"`
	MongodbObjectCount     MetricSettings `mapstructure:"mongodb.object.count"`
	MongodbOperationCount  MetricSettings `mapstructure:"mongodb.operation.count"`
	MongodbStorageSize     MetricSettings `mapstructure:"mongodb.storage.size"`
}

MetricsSettings provides settings for mongodbreceiver 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 WithDatabase added in v0.51.0

func WithDatabase(val string) ResourceMetricsOption

WithDatabase sets provided value as "database" 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.

Jump to

Keyboard shortcuts

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