metadata

package
v0.116.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricsStability = component.StabilityLevelBeta
)

Variables

View Source
var (
	Type      = component.MustNewType("mongodb")
	ScopeName = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mongodbreceiver"
)

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

View Source
var MapAttributeLockMode = map[string]AttributeLockMode{
	"shared":           AttributeLockModeShared,
	"exclusive":        AttributeLockModeExclusive,
	"intent_shared":    AttributeLockModeIntentShared,
	"intent_exclusive": AttributeLockModeIntentExclusive,
}

MapAttributeLockMode is a helper map of string to AttributeLockMode attribute value.

View Source
var MapAttributeLockType = map[string]AttributeLockType{
	"parallel_batch_write_mode":    AttributeLockTypeParallelBatchWriteMode,
	"replication_state_transition": AttributeLockTypeReplicationStateTransition,
	"global":                       AttributeLockTypeGlobal,
	"database":                     AttributeLockTypeDatabase,
	"collection":                   AttributeLockTypeCollection,
	"mutex":                        AttributeLockTypeMutex,
	"metadata":                     AttributeLockTypeMetadata,
	"oplog":                        AttributeLockTypeOplog,
}

MapAttributeLockType is a helper map of string to AttributeLockType 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.

MapAttributeOperationLatency is a helper map of string to AttributeOperationLatency 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

This section is empty.

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 AttributeLockMode added in v0.65.0

type AttributeLockMode int

AttributeLockMode specifies the a value lock_mode attribute.

const (
	AttributeLockModeShared AttributeLockMode
	AttributeLockModeExclusive
	AttributeLockModeIntentShared
	AttributeLockModeIntentExclusive
)

func (AttributeLockMode) String added in v0.65.0

func (av AttributeLockMode) String() string

String returns the string representation of the AttributeLockMode.

type AttributeLockType added in v0.65.0

type AttributeLockType int

AttributeLockType specifies the a value lock_type attribute.

const (
	AttributeLockTypeParallelBatchWriteMode AttributeLockType
	AttributeLockTypeReplicationStateTransition
	AttributeLockTypeGlobal
	AttributeLockTypeDatabase
	AttributeLockTypeCollection
	AttributeLockTypeMutex
	AttributeLockTypeMetadata
	AttributeLockTypeOplog
)

func (AttributeLockType) String added in v0.65.0

func (av AttributeLockType) String() string

String returns the string representation of the AttributeLockType.

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 AttributeOperationLatency added in v0.68.0

type AttributeOperationLatency int

AttributeOperationLatency specifies the a value operation_latency attribute.

const (
	AttributeOperationLatencyRead AttributeOperationLatency
	AttributeOperationLatencyWrite
	AttributeOperationLatencyCommand
)

func (AttributeOperationLatency) String added in v0.68.0

func (av AttributeOperationLatency) String() string

String returns the string representation of the AttributeOperationLatency.

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 MetricBuilderOption added in v0.110.0

type MetricBuilderOption interface {
	// contains filtered or unexported methods
}

MetricBuilderOption applies changes to default metrics builder.

func WithStartTime

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.

func (*MetricConfig) Unmarshal added in v0.77.0

func (ms *MetricConfig) Unmarshal(parser *confmap.Conf) error

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

func NewMetricsBuilder

func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.Settings, options ...MetricBuilderOption) *MetricsBuilder

func (*MetricsBuilder) Emit

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.48.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) NewResourceBuilder added in v0.83.0

func (mb *MetricsBuilder) NewResourceBuilder() *ResourceBuilder

NewResourceBuilder returns a new resource builder that should be used to build a resource associated with for the emitted metrics.

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)

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

func (*MetricsBuilder) RecordMongodbConnectionCountDataPoint

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

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

func (*MetricsBuilder) RecordMongodbCursorCountDataPoint added in v0.57.2

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

RecordMongodbCursorCountDataPoint adds a data point to mongodb.cursor.count metric.

func (*MetricsBuilder) RecordMongodbCursorTimeoutCountDataPoint added in v0.57.2

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

RecordMongodbCursorTimeoutCountDataPoint adds a data point to mongodb.cursor.timeout.count metric.

func (*MetricsBuilder) RecordMongodbDataSizeDataPoint

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

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

func (*MetricsBuilder) RecordMongodbDatabaseCountDataPoint added in v0.57.2

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

RecordMongodbDatabaseCountDataPoint adds a data point to mongodb.database.count metric.

func (*MetricsBuilder) RecordMongodbDocumentOperationCountDataPoint added in v0.57.2

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

RecordMongodbDocumentOperationCountDataPoint adds a data point to mongodb.document.operation.count metric.

func (*MetricsBuilder) RecordMongodbExtentCountDataPoint

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

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) RecordMongodbHealthDataPoint added in v0.70.0

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

RecordMongodbHealthDataPoint adds a data point to mongodb.health metric.

func (*MetricsBuilder) RecordMongodbIndexAccessCountDataPoint added in v0.57.2

func (mb *MetricsBuilder) RecordMongodbIndexAccessCountDataPoint(ts pcommon.Timestamp, val int64, collectionAttributeValue string)

RecordMongodbIndexAccessCountDataPoint adds a data point to mongodb.index.access.count metric.

func (*MetricsBuilder) RecordMongodbIndexCountDataPoint

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

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

func (*MetricsBuilder) RecordMongodbIndexSizeDataPoint

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

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

func (*MetricsBuilder) RecordMongodbLockAcquireCountDataPoint added in v0.65.0

func (mb *MetricsBuilder) RecordMongodbLockAcquireCountDataPoint(ts pcommon.Timestamp, val int64, lockTypeAttributeValue AttributeLockType, lockModeAttributeValue AttributeLockMode)

RecordMongodbLockAcquireCountDataPoint adds a data point to mongodb.lock.acquire.count metric.

func (*MetricsBuilder) RecordMongodbLockAcquireTimeDataPoint added in v0.65.0

func (mb *MetricsBuilder) RecordMongodbLockAcquireTimeDataPoint(ts pcommon.Timestamp, val int64, lockTypeAttributeValue AttributeLockType, lockModeAttributeValue AttributeLockMode)

RecordMongodbLockAcquireTimeDataPoint adds a data point to mongodb.lock.acquire.time metric.

func (*MetricsBuilder) RecordMongodbLockAcquireWaitCountDataPoint added in v0.65.0

func (mb *MetricsBuilder) RecordMongodbLockAcquireWaitCountDataPoint(ts pcommon.Timestamp, val int64, lockTypeAttributeValue AttributeLockType, lockModeAttributeValue AttributeLockMode)

RecordMongodbLockAcquireWaitCountDataPoint adds a data point to mongodb.lock.acquire.wait_count metric.

func (*MetricsBuilder) RecordMongodbLockDeadlockCountDataPoint added in v0.65.0

func (mb *MetricsBuilder) RecordMongodbLockDeadlockCountDataPoint(ts pcommon.Timestamp, val int64, lockTypeAttributeValue AttributeLockType, lockModeAttributeValue AttributeLockMode)

RecordMongodbLockDeadlockCountDataPoint adds a data point to mongodb.lock.deadlock.count metric.

func (*MetricsBuilder) RecordMongodbMemoryUsageDataPoint

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

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

func (*MetricsBuilder) RecordMongodbNetworkIoReceiveDataPoint added in v0.57.2

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

RecordMongodbNetworkIoReceiveDataPoint adds a data point to mongodb.network.io.receive metric.

func (*MetricsBuilder) RecordMongodbNetworkIoTransmitDataPoint added in v0.57.2

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

RecordMongodbNetworkIoTransmitDataPoint adds a data point to mongodb.network.io.transmit metric.

func (*MetricsBuilder) RecordMongodbNetworkRequestCountDataPoint added in v0.57.2

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

RecordMongodbNetworkRequestCountDataPoint adds a data point to mongodb.network.request.count metric.

func (*MetricsBuilder) RecordMongodbObjectCountDataPoint

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

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) RecordMongodbOperationLatencyTimeDataPoint added in v0.68.0

func (mb *MetricsBuilder) RecordMongodbOperationLatencyTimeDataPoint(ts pcommon.Timestamp, val int64, operationLatencyAttributeValue AttributeOperationLatency)

RecordMongodbOperationLatencyTimeDataPoint adds a data point to mongodb.operation.latency.time metric.

func (*MetricsBuilder) RecordMongodbOperationReplCountDataPoint added in v0.68.0

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

RecordMongodbOperationReplCountDataPoint adds a data point to mongodb.operation.repl.count metric.

func (*MetricsBuilder) RecordMongodbOperationTimeDataPoint added in v0.57.2

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

RecordMongodbOperationTimeDataPoint adds a data point to mongodb.operation.time metric.

func (*MetricsBuilder) RecordMongodbSessionCountDataPoint added in v0.57.2

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

RecordMongodbSessionCountDataPoint adds a data point to mongodb.session.count metric.

func (*MetricsBuilder) RecordMongodbStorageSizeDataPoint

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

RecordMongodbStorageSizeDataPoint adds a data point to mongodb.storage.size metric.

func (*MetricsBuilder) RecordMongodbUptimeDataPoint added in v0.70.0

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

RecordMongodbUptimeDataPoint adds a data point to mongodb.uptime 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 MetricsBuilderConfig added in v0.73.0

type MetricsBuilderConfig struct {
	Metrics            MetricsConfig            `mapstructure:"metrics"`
	ResourceAttributes ResourceAttributesConfig `mapstructure:"resource_attributes"`
}

MetricsBuilderConfig is a configuration for mongodb metrics builder.

func DefaultMetricsBuilderConfig added in v0.73.0

func DefaultMetricsBuilderConfig() MetricsBuilderConfig

type MetricsConfig added in v0.77.0

type MetricsConfig struct {
	MongodbCacheOperations        MetricConfig `mapstructure:"mongodb.cache.operations"`
	MongodbCollectionCount        MetricConfig `mapstructure:"mongodb.collection.count"`
	MongodbConnectionCount        MetricConfig `mapstructure:"mongodb.connection.count"`
	MongodbCursorCount            MetricConfig `mapstructure:"mongodb.cursor.count"`
	MongodbCursorTimeoutCount     MetricConfig `mapstructure:"mongodb.cursor.timeout.count"`
	MongodbDataSize               MetricConfig `mapstructure:"mongodb.data.size"`
	MongodbDatabaseCount          MetricConfig `mapstructure:"mongodb.database.count"`
	MongodbDocumentOperationCount MetricConfig `mapstructure:"mongodb.document.operation.count"`
	MongodbExtentCount            MetricConfig `mapstructure:"mongodb.extent.count"`
	MongodbGlobalLockTime         MetricConfig `mapstructure:"mongodb.global_lock.time"`
	MongodbHealth                 MetricConfig `mapstructure:"mongodb.health"`
	MongodbIndexAccessCount       MetricConfig `mapstructure:"mongodb.index.access.count"`
	MongodbIndexCount             MetricConfig `mapstructure:"mongodb.index.count"`
	MongodbIndexSize              MetricConfig `mapstructure:"mongodb.index.size"`
	MongodbLockAcquireCount       MetricConfig `mapstructure:"mongodb.lock.acquire.count"`
	MongodbLockAcquireTime        MetricConfig `mapstructure:"mongodb.lock.acquire.time"`
	MongodbLockAcquireWaitCount   MetricConfig `mapstructure:"mongodb.lock.acquire.wait_count"`
	MongodbLockDeadlockCount      MetricConfig `mapstructure:"mongodb.lock.deadlock.count"`
	MongodbMemoryUsage            MetricConfig `mapstructure:"mongodb.memory.usage"`
	MongodbNetworkIoReceive       MetricConfig `mapstructure:"mongodb.network.io.receive"`
	MongodbNetworkIoTransmit      MetricConfig `mapstructure:"mongodb.network.io.transmit"`
	MongodbNetworkRequestCount    MetricConfig `mapstructure:"mongodb.network.request.count"`
	MongodbObjectCount            MetricConfig `mapstructure:"mongodb.object.count"`
	MongodbOperationCount         MetricConfig `mapstructure:"mongodb.operation.count"`
	MongodbOperationLatencyTime   MetricConfig `mapstructure:"mongodb.operation.latency.time"`
	MongodbOperationReplCount     MetricConfig `mapstructure:"mongodb.operation.repl.count"`
	MongodbOperationTime          MetricConfig `mapstructure:"mongodb.operation.time"`
	MongodbSessionCount           MetricConfig `mapstructure:"mongodb.session.count"`
	MongodbStorageSize            MetricConfig `mapstructure:"mongodb.storage.size"`
	MongodbUptime                 MetricConfig `mapstructure:"mongodb.uptime"`
}

MetricsConfig provides config for mongodb metrics.

func DefaultMetricsConfig added in v0.77.0

func DefaultMetricsConfig() MetricsConfig

type ResourceAttributeConfig added in v0.77.0

type ResourceAttributeConfig struct {
	Enabled bool `mapstructure:"enabled"`
	// Experimental: MetricsInclude defines a list of filters for attribute values.
	// If the list is not empty, only metrics with matching resource attribute values will be emitted.
	MetricsInclude []filter.Config `mapstructure:"metrics_include"`
	// Experimental: MetricsExclude defines a list of filters for attribute values.
	// If the list is not empty, metrics with matching resource attribute values will not be emitted.
	// MetricsInclude has higher priority than MetricsExclude.
	MetricsExclude []filter.Config `mapstructure:"metrics_exclude"`
	// contains filtered or unexported fields
}

ResourceAttributeConfig provides common config for a particular resource attribute.

func (*ResourceAttributeConfig) Unmarshal added in v0.87.0

func (rac *ResourceAttributeConfig) Unmarshal(parser *confmap.Conf) error

type ResourceAttributesConfig added in v0.77.0

type ResourceAttributesConfig struct {
	Database      ResourceAttributeConfig `mapstructure:"database"`
	ServerAddress ResourceAttributeConfig `mapstructure:"server.address"`
	ServerPort    ResourceAttributeConfig `mapstructure:"server.port"`
}

ResourceAttributesConfig provides config for mongodb resource attributes.

func DefaultResourceAttributesConfig added in v0.77.0

func DefaultResourceAttributesConfig() ResourceAttributesConfig

type ResourceBuilder added in v0.82.0

type ResourceBuilder struct {
	// contains filtered or unexported fields
}

ResourceBuilder is a helper struct to build resources predefined in metadata.yaml. The ResourceBuilder is not thread-safe and must not to be used in multiple goroutines.

func NewResourceBuilder added in v0.82.0

func NewResourceBuilder(rac ResourceAttributesConfig) *ResourceBuilder

NewResourceBuilder creates a new ResourceBuilder. This method should be called on the start of the application.

func (*ResourceBuilder) Emit added in v0.82.0

func (rb *ResourceBuilder) Emit() pcommon.Resource

Emit returns the built resource and resets the internal builder state.

func (*ResourceBuilder) SetDatabase added in v0.82.0

func (rb *ResourceBuilder) SetDatabase(val string)

SetDatabase sets provided value as "database" attribute.

func (*ResourceBuilder) SetServerAddress added in v0.104.0

func (rb *ResourceBuilder) SetServerAddress(val string)

SetServerAddress sets provided value as "server.address" attribute.

func (*ResourceBuilder) SetServerPort added in v0.104.0

func (rb *ResourceBuilder) SetServerPort(val int64)

SetServerPort sets provided value as "server.port" attribute.

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.

Jump to

Keyboard shortcuts

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