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_postgresql component.

Index

Constants

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

Variables

View Source
var (
	Type      = component.MustNewType("qc_postgresql")
	ScopeName = "github.com/querycomment/collector"
)
View Source
var MetricsInfo = metricsInfo{
	PostgresqlStmtBlkReadTime: metricInfo{
		Name: "postgresql.stmt.blk_read_time",
	},
	PostgresqlStmtBlkWriteTime: metricInfo{
		Name: "postgresql.stmt.blk_write_time",
	},
	PostgresqlStmtCalls: metricInfo{
		Name: "postgresql.stmt.calls",
	},
	PostgresqlStmtMaxExecTime: metricInfo{
		Name: "postgresql.stmt.max_exec_time",
	},
	PostgresqlStmtMeanExecTime: metricInfo{
		Name: "postgresql.stmt.mean_exec_time",
	},
	PostgresqlStmtMinExecTime: metricInfo{
		Name: "postgresql.stmt.min_exec_time",
	},
	PostgresqlStmtRows: metricInfo{
		Name: "postgresql.stmt.rows",
	},
	PostgresqlStmtSharedBlksDirtied: metricInfo{
		Name: "postgresql.stmt.shared_blks_dirtied",
	},
	PostgresqlStmtSharedBlksHit: metricInfo{
		Name: "postgresql.stmt.shared_blks_hit",
	},
	PostgresqlStmtSharedBlksRead: metricInfo{
		Name: "postgresql.stmt.shared_blks_read",
	},
	PostgresqlStmtSharedBlksWritten: metricInfo{
		Name: "postgresql.stmt.shared_blks_written",
	},
	PostgresqlStmtStddevExecTime: metricInfo{
		Name: "postgresql.stmt.stddev_exec_time",
	},
	PostgresqlStmtTempBlksRead: metricInfo{
		Name: "postgresql.stmt.temp_blks_read",
	},
	PostgresqlStmtTempBlksWritten: metricInfo{
		Name: "postgresql.stmt.temp_blks_written",
	},
	PostgresqlStmtTotalExecTime: metricInfo{
		Name: "postgresql.stmt.total_exec_time",
	},
	PostgresqlStmtWalBytes: metricInfo{
		Name: "postgresql.stmt.wal_bytes",
	},
	PostgresqlStmtWalRecords: metricInfo{
		Name: "postgresql.stmt.wal_records",
	},
}

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

func (mb *MetricsBuilder) RecordPostgresqlStmtBlkReadTimeDataPoint(ts pcommon.Timestamp, val float64, queryIDAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string, roleNameAttributeValue string)

RecordPostgresqlStmtBlkReadTimeDataPoint adds a data point to postgresql.stmt.blk_read_time metric.

func (*MetricsBuilder) RecordPostgresqlStmtBlkWriteTimeDataPoint

func (mb *MetricsBuilder) RecordPostgresqlStmtBlkWriteTimeDataPoint(ts pcommon.Timestamp, val float64, queryIDAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string, roleNameAttributeValue string)

RecordPostgresqlStmtBlkWriteTimeDataPoint adds a data point to postgresql.stmt.blk_write_time metric.

func (*MetricsBuilder) RecordPostgresqlStmtCallsDataPoint

func (mb *MetricsBuilder) RecordPostgresqlStmtCallsDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string, roleNameAttributeValue string)

RecordPostgresqlStmtCallsDataPoint adds a data point to postgresql.stmt.calls metric.

func (*MetricsBuilder) RecordPostgresqlStmtMaxExecTimeDataPoint

func (mb *MetricsBuilder) RecordPostgresqlStmtMaxExecTimeDataPoint(ts pcommon.Timestamp, val float64, queryIDAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string, roleNameAttributeValue string)

RecordPostgresqlStmtMaxExecTimeDataPoint adds a data point to postgresql.stmt.max_exec_time metric.

func (*MetricsBuilder) RecordPostgresqlStmtMeanExecTimeDataPoint

func (mb *MetricsBuilder) RecordPostgresqlStmtMeanExecTimeDataPoint(ts pcommon.Timestamp, val float64, queryIDAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string, roleNameAttributeValue string)

RecordPostgresqlStmtMeanExecTimeDataPoint adds a data point to postgresql.stmt.mean_exec_time metric.

func (*MetricsBuilder) RecordPostgresqlStmtMinExecTimeDataPoint

func (mb *MetricsBuilder) RecordPostgresqlStmtMinExecTimeDataPoint(ts pcommon.Timestamp, val float64, queryIDAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string, roleNameAttributeValue string)

RecordPostgresqlStmtMinExecTimeDataPoint adds a data point to postgresql.stmt.min_exec_time metric.

func (*MetricsBuilder) RecordPostgresqlStmtRowsDataPoint

func (mb *MetricsBuilder) RecordPostgresqlStmtRowsDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string, roleNameAttributeValue string)

RecordPostgresqlStmtRowsDataPoint adds a data point to postgresql.stmt.rows metric.

func (*MetricsBuilder) RecordPostgresqlStmtSharedBlksDirtiedDataPoint

func (mb *MetricsBuilder) RecordPostgresqlStmtSharedBlksDirtiedDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string, roleNameAttributeValue string)

RecordPostgresqlStmtSharedBlksDirtiedDataPoint adds a data point to postgresql.stmt.shared_blks_dirtied metric.

func (*MetricsBuilder) RecordPostgresqlStmtSharedBlksHitDataPoint

func (mb *MetricsBuilder) RecordPostgresqlStmtSharedBlksHitDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string, roleNameAttributeValue string)

RecordPostgresqlStmtSharedBlksHitDataPoint adds a data point to postgresql.stmt.shared_blks_hit metric.

func (*MetricsBuilder) RecordPostgresqlStmtSharedBlksReadDataPoint

func (mb *MetricsBuilder) RecordPostgresqlStmtSharedBlksReadDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string, roleNameAttributeValue string)

RecordPostgresqlStmtSharedBlksReadDataPoint adds a data point to postgresql.stmt.shared_blks_read metric.

func (*MetricsBuilder) RecordPostgresqlStmtSharedBlksWrittenDataPoint

func (mb *MetricsBuilder) RecordPostgresqlStmtSharedBlksWrittenDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string, roleNameAttributeValue string)

RecordPostgresqlStmtSharedBlksWrittenDataPoint adds a data point to postgresql.stmt.shared_blks_written metric.

func (*MetricsBuilder) RecordPostgresqlStmtStddevExecTimeDataPoint

func (mb *MetricsBuilder) RecordPostgresqlStmtStddevExecTimeDataPoint(ts pcommon.Timestamp, val float64, queryIDAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string, roleNameAttributeValue string)

RecordPostgresqlStmtStddevExecTimeDataPoint adds a data point to postgresql.stmt.stddev_exec_time metric.

func (*MetricsBuilder) RecordPostgresqlStmtTempBlksReadDataPoint

func (mb *MetricsBuilder) RecordPostgresqlStmtTempBlksReadDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string, roleNameAttributeValue string)

RecordPostgresqlStmtTempBlksReadDataPoint adds a data point to postgresql.stmt.temp_blks_read metric.

func (*MetricsBuilder) RecordPostgresqlStmtTempBlksWrittenDataPoint

func (mb *MetricsBuilder) RecordPostgresqlStmtTempBlksWrittenDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string, roleNameAttributeValue string)

RecordPostgresqlStmtTempBlksWrittenDataPoint adds a data point to postgresql.stmt.temp_blks_written metric.

func (*MetricsBuilder) RecordPostgresqlStmtTotalExecTimeDataPoint

func (mb *MetricsBuilder) RecordPostgresqlStmtTotalExecTimeDataPoint(ts pcommon.Timestamp, val float64, queryIDAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string, roleNameAttributeValue string)

RecordPostgresqlStmtTotalExecTimeDataPoint adds a data point to postgresql.stmt.total_exec_time metric.

func (*MetricsBuilder) RecordPostgresqlStmtWalBytesDataPoint

func (mb *MetricsBuilder) RecordPostgresqlStmtWalBytesDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string, roleNameAttributeValue string)

RecordPostgresqlStmtWalBytesDataPoint adds a data point to postgresql.stmt.wal_bytes metric.

func (*MetricsBuilder) RecordPostgresqlStmtWalRecordsDataPoint

func (mb *MetricsBuilder) RecordPostgresqlStmtWalRecordsDataPoint(ts pcommon.Timestamp, val int64, queryIDAttributeValue string, queryTextAttributeValue string, databaseNameAttributeValue string, roleNameAttributeValue string)

RecordPostgresqlStmtWalRecordsDataPoint adds a data point to postgresql.stmt.wal_records 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_postgresql metrics builder.

func DefaultMetricsBuilderConfig deprecated

func DefaultMetricsBuilderConfig() MetricsBuilderConfig

Deprecated: Use NewDefaultMetricsBuilderConfig.

func NewDefaultMetricsBuilderConfig

func NewDefaultMetricsBuilderConfig() MetricsBuilderConfig

type MetricsConfig

type MetricsConfig struct {
	PostgresqlStmtBlkReadTime       MetricConfig `mapstructure:"postgresql.stmt.blk_read_time"`
	PostgresqlStmtBlkWriteTime      MetricConfig `mapstructure:"postgresql.stmt.blk_write_time"`
	PostgresqlStmtCalls             MetricConfig `mapstructure:"postgresql.stmt.calls"`
	PostgresqlStmtMaxExecTime       MetricConfig `mapstructure:"postgresql.stmt.max_exec_time"`
	PostgresqlStmtMeanExecTime      MetricConfig `mapstructure:"postgresql.stmt.mean_exec_time"`
	PostgresqlStmtMinExecTime       MetricConfig `mapstructure:"postgresql.stmt.min_exec_time"`
	PostgresqlStmtRows              MetricConfig `mapstructure:"postgresql.stmt.rows"`
	PostgresqlStmtSharedBlksDirtied MetricConfig `mapstructure:"postgresql.stmt.shared_blks_dirtied"`
	PostgresqlStmtSharedBlksHit     MetricConfig `mapstructure:"postgresql.stmt.shared_blks_hit"`
	PostgresqlStmtSharedBlksRead    MetricConfig `mapstructure:"postgresql.stmt.shared_blks_read"`
	PostgresqlStmtSharedBlksWritten MetricConfig `mapstructure:"postgresql.stmt.shared_blks_written"`
	PostgresqlStmtStddevExecTime    MetricConfig `mapstructure:"postgresql.stmt.stddev_exec_time"`
	PostgresqlStmtTempBlksRead      MetricConfig `mapstructure:"postgresql.stmt.temp_blks_read"`
	PostgresqlStmtTempBlksWritten   MetricConfig `mapstructure:"postgresql.stmt.temp_blks_written"`
	PostgresqlStmtTotalExecTime     MetricConfig `mapstructure:"postgresql.stmt.total_exec_time"`
	PostgresqlStmtWalBytes          MetricConfig `mapstructure:"postgresql.stmt.wal_bytes"`
	PostgresqlStmtWalRecords        MetricConfig `mapstructure:"postgresql.stmt.wal_records"`
}

MetricsConfig provides config for qc_postgresql 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_postgresql 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