metadata

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 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 AttributeConnectionType = struct {
	Active    string
	Available string
	Current   string
}{
	"active",
	"available",
	"current",
}

AttributeConnectionType are the possible values that the attribute "connection_type" can have.

View Source
var AttributeMemoryType = struct {
	Resident string
	Virtual  string
}{
	"resident",
	"virtual",
}

AttributeMemoryType are the possible values that the attribute "memory_type" can have.

View Source
var AttributeOperation = struct {
	Insert  string
	Query   string
	Update  string
	Delete  string
	Getmore string
	Command string
}{
	"insert",
	"query",
	"update",
	"delete",
	"getmore",
	"command",
}

AttributeOperation are the possible values that the attribute "operation" can have.

View Source
var AttributeType = struct {
	Hit  string
	Miss string
}{
	"hit",
	"miss",
}

AttributeType are the possible values that the attribute "type" can have.

View Source
var Attributes = struct {
	// ConnectionType (The status of the connection.)
	ConnectionType string
	// Database (The name of a database.)
	Database string
	// MemoryType (The type of memory used.)
	MemoryType string
	// Operation (The MongoDB operation being counted.)
	Operation string
	// Type (The result of a cache request.)
	Type string
}{
	"type",
	"database",
	"type",
	"operation",
	"type",
}

Attributes contains the possible metric attributes that can be used.

Functions

func WithStartTime

func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption

WithStartTime sets startTime on the metrics builder.

Types

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, options ...metricBuilderOption) *MetricsBuilder

func (*MetricsBuilder) Emit

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

func (mb *MetricsBuilder) EmitAdmin(metrics pmetric.MetricSlice)

func (*MetricsBuilder) EmitDatabase

func (mb *MetricsBuilder) EmitDatabase(metrics pmetric.MetricSlice)

func (*MetricsBuilder) EmitForResource added in v0.48.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) RecordMongodbCacheOperationsDataPoint

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

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

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

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

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 ResourceOption added in v0.48.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