metadata

package
v0.74.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MapAttributePageOperations = map[string]AttributePageOperations{
	"read":  AttributePageOperationsRead,
	"write": AttributePageOperationsWrite,
}

MapAttributePageOperations is a helper map of string to AttributePageOperations attribute value.

Functions

func WithStartTime

func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption

WithStartTime sets startTime on the metrics builder.

Types

type AttributePageOperations

type AttributePageOperations int

AttributePageOperations specifies the a value page.operations attribute.

const (
	AttributePageOperationsRead AttributePageOperations
	AttributePageOperationsWrite
)

func (AttributePageOperations) String added in v0.51.0

func (av AttributePageOperations) String() string

String returns the string representation of the AttributePageOperations.

type MetricSettings

type MetricSettings struct {
	Enabled bool `mapstructure:"enabled"`
	// contains filtered or unexported fields
}

MetricSettings provides common settings for a particular metric.

func (*MetricSettings) Unmarshal added in v0.63.0

func (ms *MetricSettings) 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 settings.

func NewMetricsBuilder

func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.CreateSettings, 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

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

func (mb *MetricsBuilder) RecordSqlserverBatchRequestRateDataPoint(ts pcommon.Timestamp, val float64)

RecordSqlserverBatchRequestRateDataPoint adds a data point to sqlserver.batch.request.rate metric.

func (*MetricsBuilder) RecordSqlserverBatchSQLCompilationRateDataPoint

func (mb *MetricsBuilder) RecordSqlserverBatchSQLCompilationRateDataPoint(ts pcommon.Timestamp, val float64)

RecordSqlserverBatchSQLCompilationRateDataPoint adds a data point to sqlserver.batch.sql_compilation.rate metric.

func (*MetricsBuilder) RecordSqlserverBatchSQLRecompilationRateDataPoint

func (mb *MetricsBuilder) RecordSqlserverBatchSQLRecompilationRateDataPoint(ts pcommon.Timestamp, val float64)

RecordSqlserverBatchSQLRecompilationRateDataPoint adds a data point to sqlserver.batch.sql_recompilation.rate metric.

func (*MetricsBuilder) RecordSqlserverLockWaitRateDataPoint

func (mb *MetricsBuilder) RecordSqlserverLockWaitRateDataPoint(ts pcommon.Timestamp, val float64)

RecordSqlserverLockWaitRateDataPoint adds a data point to sqlserver.lock.wait.rate metric.

func (*MetricsBuilder) RecordSqlserverLockWaitTimeAvgDataPoint

func (mb *MetricsBuilder) RecordSqlserverLockWaitTimeAvgDataPoint(ts pcommon.Timestamp, val float64)

RecordSqlserverLockWaitTimeAvgDataPoint adds a data point to sqlserver.lock.wait_time.avg metric.

func (*MetricsBuilder) RecordSqlserverPageBufferCacheHitRatioDataPoint

func (mb *MetricsBuilder) RecordSqlserverPageBufferCacheHitRatioDataPoint(ts pcommon.Timestamp, val float64)

RecordSqlserverPageBufferCacheHitRatioDataPoint adds a data point to sqlserver.page.buffer_cache.hit_ratio metric.

func (*MetricsBuilder) RecordSqlserverPageCheckpointFlushRateDataPoint

func (mb *MetricsBuilder) RecordSqlserverPageCheckpointFlushRateDataPoint(ts pcommon.Timestamp, val float64)

RecordSqlserverPageCheckpointFlushRateDataPoint adds a data point to sqlserver.page.checkpoint.flush.rate metric.

func (*MetricsBuilder) RecordSqlserverPageLazyWriteRateDataPoint

func (mb *MetricsBuilder) RecordSqlserverPageLazyWriteRateDataPoint(ts pcommon.Timestamp, val float64)

RecordSqlserverPageLazyWriteRateDataPoint adds a data point to sqlserver.page.lazy_write.rate metric.

func (*MetricsBuilder) RecordSqlserverPageLifeExpectancyDataPoint

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

RecordSqlserverPageLifeExpectancyDataPoint adds a data point to sqlserver.page.life_expectancy metric.

func (*MetricsBuilder) RecordSqlserverPageOperationRateDataPoint

func (mb *MetricsBuilder) RecordSqlserverPageOperationRateDataPoint(ts pcommon.Timestamp, val float64, pageOperationsAttributeValue AttributePageOperations)

RecordSqlserverPageOperationRateDataPoint adds a data point to sqlserver.page.operation.rate metric.

func (*MetricsBuilder) RecordSqlserverPageSplitRateDataPoint

func (mb *MetricsBuilder) RecordSqlserverPageSplitRateDataPoint(ts pcommon.Timestamp, val float64)

RecordSqlserverPageSplitRateDataPoint adds a data point to sqlserver.page.split.rate metric.

func (*MetricsBuilder) RecordSqlserverTransactionLogFlushDataRateDataPoint

func (mb *MetricsBuilder) RecordSqlserverTransactionLogFlushDataRateDataPoint(ts pcommon.Timestamp, val float64)

RecordSqlserverTransactionLogFlushDataRateDataPoint adds a data point to sqlserver.transaction_log.flush.data.rate metric.

func (*MetricsBuilder) RecordSqlserverTransactionLogFlushRateDataPoint

func (mb *MetricsBuilder) RecordSqlserverTransactionLogFlushRateDataPoint(ts pcommon.Timestamp, val float64)

RecordSqlserverTransactionLogFlushRateDataPoint adds a data point to sqlserver.transaction_log.flush.rate metric.

func (*MetricsBuilder) RecordSqlserverTransactionLogFlushWaitRateDataPoint

func (mb *MetricsBuilder) RecordSqlserverTransactionLogFlushWaitRateDataPoint(ts pcommon.Timestamp, val float64)

RecordSqlserverTransactionLogFlushWaitRateDataPoint adds a data point to sqlserver.transaction_log.flush.wait.rate metric.

func (*MetricsBuilder) RecordSqlserverTransactionLogGrowthCountDataPoint

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

RecordSqlserverTransactionLogGrowthCountDataPoint adds a data point to sqlserver.transaction_log.growth.count metric.

func (*MetricsBuilder) RecordSqlserverTransactionLogShrinkCountDataPoint

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

RecordSqlserverTransactionLogShrinkCountDataPoint adds a data point to sqlserver.transaction_log.shrink.count metric.

func (*MetricsBuilder) RecordSqlserverTransactionLogUsageDataPoint

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

RecordSqlserverTransactionLogUsageDataPoint adds a data point to sqlserver.transaction_log.usage metric.

func (*MetricsBuilder) RecordSqlserverTransactionRateDataPoint

func (mb *MetricsBuilder) RecordSqlserverTransactionRateDataPoint(ts pcommon.Timestamp, val float64)

RecordSqlserverTransactionRateDataPoint adds a data point to sqlserver.transaction.rate metric.

func (*MetricsBuilder) RecordSqlserverTransactionWriteRateDataPoint

func (mb *MetricsBuilder) RecordSqlserverTransactionWriteRateDataPoint(ts pcommon.Timestamp, val float64)

RecordSqlserverTransactionWriteRateDataPoint adds a data point to sqlserver.transaction.write.rate metric.

func (*MetricsBuilder) RecordSqlserverUserConnectionCountDataPoint

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

RecordSqlserverUserConnectionCountDataPoint adds a data point to sqlserver.user.connection.count 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            MetricsSettings            `mapstructure:"metrics"`
	ResourceAttributes ResourceAttributesSettings `mapstructure:"resource_attributes"`
}

MetricsBuilderConfig is a structural subset of an otherwise 1-1 copy of metadata.yaml

func DefaultMetricsBuilderConfig added in v0.73.0

func DefaultMetricsBuilderConfig() MetricsBuilderConfig

func NewMetricsBuilderConfig added in v0.73.0

func NewMetricsBuilderConfig(ms MetricsSettings, ras ResourceAttributesSettings) MetricsBuilderConfig

type MetricsSettings

type MetricsSettings struct {
	SqlserverBatchRequestRate            MetricSettings `mapstructure:"sqlserver.batch.request.rate"`
	SqlserverBatchSQLCompilationRate     MetricSettings `mapstructure:"sqlserver.batch.sql_compilation.rate"`
	SqlserverBatchSQLRecompilationRate   MetricSettings `mapstructure:"sqlserver.batch.sql_recompilation.rate"`
	SqlserverLockWaitRate                MetricSettings `mapstructure:"sqlserver.lock.wait.rate"`
	SqlserverLockWaitTimeAvg             MetricSettings `mapstructure:"sqlserver.lock.wait_time.avg"`
	SqlserverPageBufferCacheHitRatio     MetricSettings `mapstructure:"sqlserver.page.buffer_cache.hit_ratio"`
	SqlserverPageCheckpointFlushRate     MetricSettings `mapstructure:"sqlserver.page.checkpoint.flush.rate"`
	SqlserverPageLazyWriteRate           MetricSettings `mapstructure:"sqlserver.page.lazy_write.rate"`
	SqlserverPageLifeExpectancy          MetricSettings `mapstructure:"sqlserver.page.life_expectancy"`
	SqlserverPageOperationRate           MetricSettings `mapstructure:"sqlserver.page.operation.rate"`
	SqlserverPageSplitRate               MetricSettings `mapstructure:"sqlserver.page.split.rate"`
	SqlserverTransactionRate             MetricSettings `mapstructure:"sqlserver.transaction.rate"`
	SqlserverTransactionWriteRate        MetricSettings `mapstructure:"sqlserver.transaction.write.rate"`
	SqlserverTransactionLogFlushDataRate MetricSettings `mapstructure:"sqlserver.transaction_log.flush.data.rate"`
	SqlserverTransactionLogFlushRate     MetricSettings `mapstructure:"sqlserver.transaction_log.flush.rate"`
	SqlserverTransactionLogFlushWaitRate MetricSettings `mapstructure:"sqlserver.transaction_log.flush.wait.rate"`
	SqlserverTransactionLogGrowthCount   MetricSettings `mapstructure:"sqlserver.transaction_log.growth.count"`
	SqlserverTransactionLogShrinkCount   MetricSettings `mapstructure:"sqlserver.transaction_log.shrink.count"`
	SqlserverTransactionLogUsage         MetricSettings `mapstructure:"sqlserver.transaction_log.usage"`
	SqlserverUserConnectionCount         MetricSettings `mapstructure:"sqlserver.user.connection.count"`
}

MetricsSettings provides settings for sqlserverreceiver metrics.

func DefaultMetricsSettings

func DefaultMetricsSettings() MetricsSettings

type ResourceAttributeSettings added in v0.70.0

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

ResourceAttributeSettings provides common settings for a particular metric.

type ResourceAttributesSettings added in v0.70.0

type ResourceAttributesSettings struct {
	SqlserverDatabaseName ResourceAttributeSettings `mapstructure:"sqlserver.database.name"`
}

ResourceAttributesSettings provides settings for sqlserverreceiver metrics.

func DefaultResourceAttributesSettings added in v0.70.0

func DefaultResourceAttributesSettings() ResourceAttributesSettings

type ResourceMetricsOption added in v0.52.0

type ResourceMetricsOption func(ResourceAttributesSettings, pmetric.ResourceMetrics)

ResourceMetricsOption applies changes to provided resource metrics.

func WithSqlserverDatabaseName

func WithSqlserverDatabaseName(val string) ResourceMetricsOption

WithSqlserverDatabaseName sets provided value as "sqlserver.database.name" 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