metadata

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Overview

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

Index

Constants

View Source
const (
	MetricsStability = component.StabilityLevelBeta
	LogsStability    = component.StabilityLevelBeta
)

Variables

View Source
var (
	Type      = component.MustNewType("qc_sqlserver")
	ScopeName = "github.com/querycomment/collector"
)
View Source
var MetricsInfo = metricsInfo{
	SqlserverStmtAvgElapsedTimeMs: metricInfo{
		Name: "sqlserver.stmt.avg_elapsed_time_ms",
	},
	SqlserverStmtExecutionCount: metricInfo{
		Name: "sqlserver.stmt.execution_count",
	},
	SqlserverStmtTotalClrTimeMs: metricInfo{
		Name: "sqlserver.stmt.total_clr_time_ms",
	},
	SqlserverStmtTotalColumnstoreSegmentReads: metricInfo{
		Name: "sqlserver.stmt.total_columnstore_segment_reads",
	},
	SqlserverStmtTotalColumnstoreSegmentSkips: metricInfo{
		Name: "sqlserver.stmt.total_columnstore_segment_skips",
	},
	SqlserverStmtTotalDop: metricInfo{
		Name: "sqlserver.stmt.total_dop",
	},
	SqlserverStmtTotalElapsedTimeMs: metricInfo{
		Name: "sqlserver.stmt.total_elapsed_time_ms",
	},
	SqlserverStmtTotalGrantKb: metricInfo{
		Name: "sqlserver.stmt.total_grant_kb",
	},
	SqlserverStmtTotalIdealGrantKb: metricInfo{
		Name: "sqlserver.stmt.total_ideal_grant_kb",
	},
	SqlserverStmtTotalLogicalReads: metricInfo{
		Name: "sqlserver.stmt.total_logical_reads",
	},
	SqlserverStmtTotalLogicalWrites: metricInfo{
		Name: "sqlserver.stmt.total_logical_writes",
	},
	SqlserverStmtTotalPhysicalReads: metricInfo{
		Name: "sqlserver.stmt.total_physical_reads",
	},
	SqlserverStmtTotalReservedThreads: metricInfo{
		Name: "sqlserver.stmt.total_reserved_threads",
	},
	SqlserverStmtTotalRows: metricInfo{
		Name: "sqlserver.stmt.total_rows",
	},
	SqlserverStmtTotalSpills: metricInfo{
		Name: "sqlserver.stmt.total_spills",
	},
	SqlserverStmtTotalUsedGrantKb: metricInfo{
		Name: "sqlserver.stmt.total_used_grant_kb",
	},
	SqlserverStmtTotalUsedThreads: metricInfo{
		Name: "sqlserver.stmt.total_used_threads",
	},
	SqlserverStmtTotalWorkerTimeMs: metricInfo{
		Name: "sqlserver.stmt.total_worker_time_ms",
	},
}

Functions

This section is empty.

Types

type LogBuilderOption added in v0.1.3

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

LogBuilderOption applies changes to default logs builder.

type LogsBuilder added in v0.1.3

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

LogsBuilder provides an interface for scrapers to report logs while taking care of all the transformations required to produce log representation defined in metadata and user config.

func NewLogsBuilder added in v0.1.3

func NewLogsBuilder(settings receiver.Settings) *LogsBuilder

func (*LogsBuilder) AppendLogRecord added in v0.1.3

func (lb *LogsBuilder) AppendLogRecord(lr plog.LogRecord)

AppendLogRecord adds a log record to the logs builder.

func (*LogsBuilder) Emit added in v0.1.3

func (lb *LogsBuilder) Emit(options ...ResourceLogsOption) plog.Logs

Emit returns all the logs accumulated by the logs builder and updates the internal state to be ready for recording another set of logs. This function will be responsible for applying all the transformations required to produce logs representation defined in metadata and user config.

func (*LogsBuilder) EmitForResource added in v0.1.3

func (lb *LogsBuilder) EmitForResource(options ...ResourceLogsOption)

EmitForResource saves all the generated logs under a new resource and updates the internal state to be ready for recording another set of log records as part of another resource. This function can be helpful when one scraper needs to emit logs from several resources. Otherwise calling this function is not required, just `Emit` function can be called instead. Resource attributes should be provided as ResourceLogsOption arguments.

func (*LogsBuilder) NewResourceBuilder added in v0.1.3

func (lb *LogsBuilder) NewResourceBuilder() *ResourceBuilder

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

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) RecordSqlserverStmtAvgElapsedTimeMsDataPoint added in v0.1.2

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

RecordSqlserverStmtAvgElapsedTimeMsDataPoint adds a data point to sqlserver.stmt.avg_elapsed_time_ms metric.

func (*MetricsBuilder) RecordSqlserverStmtExecutionCountDataPoint added in v0.1.2

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

RecordSqlserverStmtExecutionCountDataPoint adds a data point to sqlserver.stmt.execution_count metric.

func (*MetricsBuilder) RecordSqlserverStmtTotalClrTimeMsDataPoint added in v0.1.2

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

RecordSqlserverStmtTotalClrTimeMsDataPoint adds a data point to sqlserver.stmt.total_clr_time_ms metric.

func (*MetricsBuilder) RecordSqlserverStmtTotalColumnstoreSegmentReadsDataPoint added in v0.1.2

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

RecordSqlserverStmtTotalColumnstoreSegmentReadsDataPoint adds a data point to sqlserver.stmt.total_columnstore_segment_reads metric.

func (*MetricsBuilder) RecordSqlserverStmtTotalColumnstoreSegmentSkipsDataPoint added in v0.1.2

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

RecordSqlserverStmtTotalColumnstoreSegmentSkipsDataPoint adds a data point to sqlserver.stmt.total_columnstore_segment_skips metric.

func (*MetricsBuilder) RecordSqlserverStmtTotalDopDataPoint added in v0.1.2

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

RecordSqlserverStmtTotalDopDataPoint adds a data point to sqlserver.stmt.total_dop metric.

func (*MetricsBuilder) RecordSqlserverStmtTotalElapsedTimeMsDataPoint added in v0.1.2

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

RecordSqlserverStmtTotalElapsedTimeMsDataPoint adds a data point to sqlserver.stmt.total_elapsed_time_ms metric.

func (*MetricsBuilder) RecordSqlserverStmtTotalGrantKbDataPoint added in v0.1.2

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

RecordSqlserverStmtTotalGrantKbDataPoint adds a data point to sqlserver.stmt.total_grant_kb metric.

func (*MetricsBuilder) RecordSqlserverStmtTotalIdealGrantKbDataPoint added in v0.1.2

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

RecordSqlserverStmtTotalIdealGrantKbDataPoint adds a data point to sqlserver.stmt.total_ideal_grant_kb metric.

func (*MetricsBuilder) RecordSqlserverStmtTotalLogicalReadsDataPoint added in v0.1.2

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

RecordSqlserverStmtTotalLogicalReadsDataPoint adds a data point to sqlserver.stmt.total_logical_reads metric.

func (*MetricsBuilder) RecordSqlserverStmtTotalLogicalWritesDataPoint added in v0.1.2

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

RecordSqlserverStmtTotalLogicalWritesDataPoint adds a data point to sqlserver.stmt.total_logical_writes metric.

func (*MetricsBuilder) RecordSqlserverStmtTotalPhysicalReadsDataPoint added in v0.1.2

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

RecordSqlserverStmtTotalPhysicalReadsDataPoint adds a data point to sqlserver.stmt.total_physical_reads metric.

func (*MetricsBuilder) RecordSqlserverStmtTotalReservedThreadsDataPoint added in v0.1.2

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

RecordSqlserverStmtTotalReservedThreadsDataPoint adds a data point to sqlserver.stmt.total_reserved_threads metric.

func (*MetricsBuilder) RecordSqlserverStmtTotalRowsDataPoint added in v0.1.2

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

RecordSqlserverStmtTotalRowsDataPoint adds a data point to sqlserver.stmt.total_rows metric.

func (*MetricsBuilder) RecordSqlserverStmtTotalSpillsDataPoint added in v0.1.2

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

RecordSqlserverStmtTotalSpillsDataPoint adds a data point to sqlserver.stmt.total_spills metric.

func (*MetricsBuilder) RecordSqlserverStmtTotalUsedGrantKbDataPoint added in v0.1.2

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

RecordSqlserverStmtTotalUsedGrantKbDataPoint adds a data point to sqlserver.stmt.total_used_grant_kb metric.

func (*MetricsBuilder) RecordSqlserverStmtTotalUsedThreadsDataPoint added in v0.1.2

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

RecordSqlserverStmtTotalUsedThreadsDataPoint adds a data point to sqlserver.stmt.total_used_threads metric.

func (*MetricsBuilder) RecordSqlserverStmtTotalWorkerTimeMsDataPoint added in v0.1.2

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

RecordSqlserverStmtTotalWorkerTimeMsDataPoint adds a data point to sqlserver.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 qc_sqlserver metrics builder.

func DefaultMetricsBuilderConfig deprecated

func DefaultMetricsBuilderConfig() MetricsBuilderConfig

Deprecated: Use NewDefaultMetricsBuilderConfig.

func NewDefaultMetricsBuilderConfig

func NewDefaultMetricsBuilderConfig() MetricsBuilderConfig

type MetricsConfig

type MetricsConfig struct {
	SqlserverStmtAvgElapsedTimeMs             MetricConfig `mapstructure:"sqlserver.stmt.avg_elapsed_time_ms"`
	SqlserverStmtExecutionCount               MetricConfig `mapstructure:"sqlserver.stmt.execution_count"`
	SqlserverStmtTotalClrTimeMs               MetricConfig `mapstructure:"sqlserver.stmt.total_clr_time_ms"`
	SqlserverStmtTotalColumnstoreSegmentReads MetricConfig `mapstructure:"sqlserver.stmt.total_columnstore_segment_reads"`
	SqlserverStmtTotalColumnstoreSegmentSkips MetricConfig `mapstructure:"sqlserver.stmt.total_columnstore_segment_skips"`
	SqlserverStmtTotalDop                     MetricConfig `mapstructure:"sqlserver.stmt.total_dop"`
	SqlserverStmtTotalElapsedTimeMs           MetricConfig `mapstructure:"sqlserver.stmt.total_elapsed_time_ms"`
	SqlserverStmtTotalGrantKb                 MetricConfig `mapstructure:"sqlserver.stmt.total_grant_kb"`
	SqlserverStmtTotalIdealGrantKb            MetricConfig `mapstructure:"sqlserver.stmt.total_ideal_grant_kb"`
	SqlserverStmtTotalLogicalReads            MetricConfig `mapstructure:"sqlserver.stmt.total_logical_reads"`
	SqlserverStmtTotalLogicalWrites           MetricConfig `mapstructure:"sqlserver.stmt.total_logical_writes"`
	SqlserverStmtTotalPhysicalReads           MetricConfig `mapstructure:"sqlserver.stmt.total_physical_reads"`
	SqlserverStmtTotalReservedThreads         MetricConfig `mapstructure:"sqlserver.stmt.total_reserved_threads"`
	SqlserverStmtTotalRows                    MetricConfig `mapstructure:"sqlserver.stmt.total_rows"`
	SqlserverStmtTotalSpills                  MetricConfig `mapstructure:"sqlserver.stmt.total_spills"`
	SqlserverStmtTotalUsedGrantKb             MetricConfig `mapstructure:"sqlserver.stmt.total_used_grant_kb"`
	SqlserverStmtTotalUsedThreads             MetricConfig `mapstructure:"sqlserver.stmt.total_used_threads"`
	SqlserverStmtTotalWorkerTimeMs            MetricConfig `mapstructure:"sqlserver.stmt.total_worker_time_ms"`
}

MetricsConfig provides config for qc_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"`
}

ResourceAttributesConfig provides config for qc_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.

type ResourceLogsOption added in v0.1.3

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

ResourceLogsOption applies changes to provided resource logs.

func WithLogsResource added in v0.1.3

func WithLogsResource(res pcommon.Resource) ResourceLogsOption

WithLogsResource sets the provided resource on the emitted ResourceLogs. It's recommended to use ResourceBuilder to create the resource.

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