metadata

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package metadata contains the autogenerated telemetry and build information for the receiver/sqlserver component.

Index

Constants

View Source
const (
	MetricsStability = component.StabilityLevelBeta
)

Variables

View Source
var (
	Type      = component.MustNewType("sqlserver")
	ScopeName = "github.com/querycomment/collector"
)
View Source
var MetricsInfo = metricsInfo{
	AzuresqlStmtAvgElapsedTimeMs: metricInfo{
		Name: "azuresql.stmt.avg_elapsed_time_ms",
	},
	AzuresqlStmtExecutionCount: metricInfo{
		Name: "azuresql.stmt.execution_count",
	},
	AzuresqlStmtTotalClrTimeMs: metricInfo{
		Name: "azuresql.stmt.total_clr_time_ms",
	},
	AzuresqlStmtTotalColumnstoreSegmentReads: metricInfo{
		Name: "azuresql.stmt.total_columnstore_segment_reads",
	},
	AzuresqlStmtTotalColumnstoreSegmentSkips: metricInfo{
		Name: "azuresql.stmt.total_columnstore_segment_skips",
	},
	AzuresqlStmtTotalDop: metricInfo{
		Name: "azuresql.stmt.total_dop",
	},
	AzuresqlStmtTotalElapsedTimeMs: metricInfo{
		Name: "azuresql.stmt.total_elapsed_time_ms",
	},
	AzuresqlStmtTotalGrantKb: metricInfo{
		Name: "azuresql.stmt.total_grant_kb",
	},
	AzuresqlStmtTotalIdealGrantKb: metricInfo{
		Name: "azuresql.stmt.total_ideal_grant_kb",
	},
	AzuresqlStmtTotalLogicalReads: metricInfo{
		Name: "azuresql.stmt.total_logical_reads",
	},
	AzuresqlStmtTotalLogicalWrites: metricInfo{
		Name: "azuresql.stmt.total_logical_writes",
	},
	AzuresqlStmtTotalPhysicalReads: metricInfo{
		Name: "azuresql.stmt.total_physical_reads",
	},
	AzuresqlStmtTotalReservedThreads: metricInfo{
		Name: "azuresql.stmt.total_reserved_threads",
	},
	AzuresqlStmtTotalRows: metricInfo{
		Name: "azuresql.stmt.total_rows",
	},
	AzuresqlStmtTotalSpills: metricInfo{
		Name: "azuresql.stmt.total_spills",
	},
	AzuresqlStmtTotalUsedGrantKb: metricInfo{
		Name: "azuresql.stmt.total_used_grant_kb",
	},
	AzuresqlStmtTotalUsedThreads: metricInfo{
		Name: "azuresql.stmt.total_used_threads",
	},
	AzuresqlStmtTotalWorkerTimeMs: metricInfo{
		Name: "azuresql.stmt.total_worker_time_ms",
	},
}

Functions

This section is empty.

Types

type MetricBuilderOption

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

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

MetricConfig provides common config for a particular metric.

func (*MetricConfig) Unmarshal

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

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

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

func (mb *MetricsBuilder) RecordAzuresqlStmtAvgElapsedTimeMsDataPoint(ts pcommon.Timestamp, val float64, queryIDAttributeValue string, queryHashAttributeValue string, queryPlanHashAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string)

RecordAzuresqlStmtAvgElapsedTimeMsDataPoint adds a data point to azuresql.stmt.avg_elapsed_time_ms metric.

func (*MetricsBuilder) RecordAzuresqlStmtExecutionCountDataPoint

func (mb *MetricsBuilder) RecordAzuresqlStmtExecutionCountDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryHashAttributeValue string, queryPlanHashAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string)

RecordAzuresqlStmtExecutionCountDataPoint adds a data point to azuresql.stmt.execution_count metric.

func (*MetricsBuilder) RecordAzuresqlStmtTotalClrTimeMsDataPoint

func (mb *MetricsBuilder) RecordAzuresqlStmtTotalClrTimeMsDataPoint(ts pcommon.Timestamp, val float64, queryIDAttributeValue string, queryHashAttributeValue string, queryPlanHashAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string)

RecordAzuresqlStmtTotalClrTimeMsDataPoint adds a data point to azuresql.stmt.total_clr_time_ms metric.

func (*MetricsBuilder) RecordAzuresqlStmtTotalColumnstoreSegmentReadsDataPoint

func (mb *MetricsBuilder) RecordAzuresqlStmtTotalColumnstoreSegmentReadsDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryHashAttributeValue string, queryPlanHashAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string)

RecordAzuresqlStmtTotalColumnstoreSegmentReadsDataPoint adds a data point to azuresql.stmt.total_columnstore_segment_reads metric.

func (*MetricsBuilder) RecordAzuresqlStmtTotalColumnstoreSegmentSkipsDataPoint

func (mb *MetricsBuilder) RecordAzuresqlStmtTotalColumnstoreSegmentSkipsDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryHashAttributeValue string, queryPlanHashAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string)

RecordAzuresqlStmtTotalColumnstoreSegmentSkipsDataPoint adds a data point to azuresql.stmt.total_columnstore_segment_skips metric.

func (*MetricsBuilder) RecordAzuresqlStmtTotalDopDataPoint

func (mb *MetricsBuilder) RecordAzuresqlStmtTotalDopDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryHashAttributeValue string, queryPlanHashAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string)

RecordAzuresqlStmtTotalDopDataPoint adds a data point to azuresql.stmt.total_dop metric.

func (*MetricsBuilder) RecordAzuresqlStmtTotalElapsedTimeMsDataPoint

func (mb *MetricsBuilder) RecordAzuresqlStmtTotalElapsedTimeMsDataPoint(ts pcommon.Timestamp, val float64, queryIDAttributeValue string, queryHashAttributeValue string, queryPlanHashAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string)

RecordAzuresqlStmtTotalElapsedTimeMsDataPoint adds a data point to azuresql.stmt.total_elapsed_time_ms metric.

func (*MetricsBuilder) RecordAzuresqlStmtTotalGrantKbDataPoint

func (mb *MetricsBuilder) RecordAzuresqlStmtTotalGrantKbDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryHashAttributeValue string, queryPlanHashAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string)

RecordAzuresqlStmtTotalGrantKbDataPoint adds a data point to azuresql.stmt.total_grant_kb metric.

func (*MetricsBuilder) RecordAzuresqlStmtTotalIdealGrantKbDataPoint

func (mb *MetricsBuilder) RecordAzuresqlStmtTotalIdealGrantKbDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryHashAttributeValue string, queryPlanHashAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string)

RecordAzuresqlStmtTotalIdealGrantKbDataPoint adds a data point to azuresql.stmt.total_ideal_grant_kb metric.

func (*MetricsBuilder) RecordAzuresqlStmtTotalLogicalReadsDataPoint

func (mb *MetricsBuilder) RecordAzuresqlStmtTotalLogicalReadsDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryHashAttributeValue string, queryPlanHashAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string)

RecordAzuresqlStmtTotalLogicalReadsDataPoint adds a data point to azuresql.stmt.total_logical_reads metric.

func (*MetricsBuilder) RecordAzuresqlStmtTotalLogicalWritesDataPoint

func (mb *MetricsBuilder) RecordAzuresqlStmtTotalLogicalWritesDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryHashAttributeValue string, queryPlanHashAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string)

RecordAzuresqlStmtTotalLogicalWritesDataPoint adds a data point to azuresql.stmt.total_logical_writes metric.

func (*MetricsBuilder) RecordAzuresqlStmtTotalPhysicalReadsDataPoint

func (mb *MetricsBuilder) RecordAzuresqlStmtTotalPhysicalReadsDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryHashAttributeValue string, queryPlanHashAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string)

RecordAzuresqlStmtTotalPhysicalReadsDataPoint adds a data point to azuresql.stmt.total_physical_reads metric.

func (*MetricsBuilder) RecordAzuresqlStmtTotalReservedThreadsDataPoint

func (mb *MetricsBuilder) RecordAzuresqlStmtTotalReservedThreadsDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryHashAttributeValue string, queryPlanHashAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string)

RecordAzuresqlStmtTotalReservedThreadsDataPoint adds a data point to azuresql.stmt.total_reserved_threads metric.

func (*MetricsBuilder) RecordAzuresqlStmtTotalRowsDataPoint

func (mb *MetricsBuilder) RecordAzuresqlStmtTotalRowsDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryHashAttributeValue string, queryPlanHashAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string)

RecordAzuresqlStmtTotalRowsDataPoint adds a data point to azuresql.stmt.total_rows metric.

func (*MetricsBuilder) RecordAzuresqlStmtTotalSpillsDataPoint

func (mb *MetricsBuilder) RecordAzuresqlStmtTotalSpillsDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryHashAttributeValue string, queryPlanHashAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string)

RecordAzuresqlStmtTotalSpillsDataPoint adds a data point to azuresql.stmt.total_spills metric.

func (*MetricsBuilder) RecordAzuresqlStmtTotalUsedGrantKbDataPoint

func (mb *MetricsBuilder) RecordAzuresqlStmtTotalUsedGrantKbDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryHashAttributeValue string, queryPlanHashAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string)

RecordAzuresqlStmtTotalUsedGrantKbDataPoint adds a data point to azuresql.stmt.total_used_grant_kb metric.

func (*MetricsBuilder) RecordAzuresqlStmtTotalUsedThreadsDataPoint

func (mb *MetricsBuilder) RecordAzuresqlStmtTotalUsedThreadsDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryHashAttributeValue string, queryPlanHashAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string)

RecordAzuresqlStmtTotalUsedThreadsDataPoint adds a data point to azuresql.stmt.total_used_threads metric.

func (*MetricsBuilder) RecordAzuresqlStmtTotalWorkerTimeMsDataPoint

func (mb *MetricsBuilder) RecordAzuresqlStmtTotalWorkerTimeMsDataPoint(ts pcommon.Timestamp, val float64, queryIDAttributeValue string, queryHashAttributeValue string, queryPlanHashAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string)

RecordAzuresqlStmtTotalWorkerTimeMsDataPoint adds a data point to azuresql.stmt.total_worker_time_ms 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

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

MetricsBuilderConfig is a configuration for sqlserver metrics builder.

func DefaultMetricsBuilderConfig deprecated

func DefaultMetricsBuilderConfig() MetricsBuilderConfig

Deprecated: Use NewDefaultMetricsBuilderConfig.

func NewDefaultMetricsBuilderConfig

func NewDefaultMetricsBuilderConfig() MetricsBuilderConfig

type MetricsConfig

type MetricsConfig struct {
	AzuresqlStmtAvgElapsedTimeMs             MetricConfig `mapstructure:"azuresql.stmt.avg_elapsed_time_ms"`
	AzuresqlStmtExecutionCount               MetricConfig `mapstructure:"azuresql.stmt.execution_count"`
	AzuresqlStmtTotalClrTimeMs               MetricConfig `mapstructure:"azuresql.stmt.total_clr_time_ms"`
	AzuresqlStmtTotalColumnstoreSegmentReads MetricConfig `mapstructure:"azuresql.stmt.total_columnstore_segment_reads"`
	AzuresqlStmtTotalColumnstoreSegmentSkips MetricConfig `mapstructure:"azuresql.stmt.total_columnstore_segment_skips"`
	AzuresqlStmtTotalDop                     MetricConfig `mapstructure:"azuresql.stmt.total_dop"`
	AzuresqlStmtTotalElapsedTimeMs           MetricConfig `mapstructure:"azuresql.stmt.total_elapsed_time_ms"`
	AzuresqlStmtTotalGrantKb                 MetricConfig `mapstructure:"azuresql.stmt.total_grant_kb"`
	AzuresqlStmtTotalIdealGrantKb            MetricConfig `mapstructure:"azuresql.stmt.total_ideal_grant_kb"`
	AzuresqlStmtTotalLogicalReads            MetricConfig `mapstructure:"azuresql.stmt.total_logical_reads"`
	AzuresqlStmtTotalLogicalWrites           MetricConfig `mapstructure:"azuresql.stmt.total_logical_writes"`
	AzuresqlStmtTotalPhysicalReads           MetricConfig `mapstructure:"azuresql.stmt.total_physical_reads"`
	AzuresqlStmtTotalReservedThreads         MetricConfig `mapstructure:"azuresql.stmt.total_reserved_threads"`
	AzuresqlStmtTotalRows                    MetricConfig `mapstructure:"azuresql.stmt.total_rows"`
	AzuresqlStmtTotalSpills                  MetricConfig `mapstructure:"azuresql.stmt.total_spills"`
	AzuresqlStmtTotalUsedGrantKb             MetricConfig `mapstructure:"azuresql.stmt.total_used_grant_kb"`
	AzuresqlStmtTotalUsedThreads             MetricConfig `mapstructure:"azuresql.stmt.total_used_threads"`
	AzuresqlStmtTotalWorkerTimeMs            MetricConfig `mapstructure:"azuresql.stmt.total_worker_time_ms"`
}

MetricsConfig provides config for sqlserver metrics.

func DefaultMetricsConfig

func DefaultMetricsConfig() MetricsConfig

type ResourceAttributeConfig

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

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

type ResourceAttributesConfig

type ResourceAttributesConfig struct {
	DbSystem     ResourceAttributeConfig `mapstructure:"db.system"`
	DbSystemName ResourceAttributeConfig `mapstructure:"db.system.name"`
}

ResourceAttributesConfig provides config for sqlserver resource attributes.

func DefaultResourceAttributesConfig

func DefaultResourceAttributesConfig() ResourceAttributesConfig

type ResourceBuilder

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

func NewResourceBuilder(rac ResourceAttributesConfig) *ResourceBuilder

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

func (*ResourceBuilder) Emit

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

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

func (*ResourceBuilder) SetDbSystem

func (rb *ResourceBuilder) SetDbSystem(val string)

SetDbSystem sets provided value as "db.system" attribute.

func (*ResourceBuilder) SetDbSystemName

func (rb *ResourceBuilder) SetDbSystemName(val string)

SetDbSystemName sets provided value as "db.system.name" attribute.

type ResourceMetricsOption

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

ResourceMetricsOption applies changes to provided resource metrics.

func WithResource

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

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