metadata

package
v0.99.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricsStability = component.StabilityLevelBeta
)

Variables

MapAttributeBgBufferSource is a helper map of string to AttributeBgBufferSource attribute value.

View Source
var MapAttributeBgCheckpointType = map[string]AttributeBgCheckpointType{
	"requested": AttributeBgCheckpointTypeRequested,
	"scheduled": AttributeBgCheckpointTypeScheduled,
}

MapAttributeBgCheckpointType is a helper map of string to AttributeBgCheckpointType attribute value.

View Source
var MapAttributeBgDurationType = map[string]AttributeBgDurationType{
	"sync":  AttributeBgDurationTypeSync,
	"write": AttributeBgDurationTypeWrite,
}

MapAttributeBgDurationType is a helper map of string to AttributeBgDurationType attribute value.

MapAttributeOperation is a helper map of string to AttributeOperation attribute value.

View Source
var MapAttributeSource = map[string]AttributeSource{
	"heap_read":  AttributeSourceHeapRead,
	"heap_hit":   AttributeSourceHeapHit,
	"idx_read":   AttributeSourceIdxRead,
	"idx_hit":    AttributeSourceIdxHit,
	"toast_read": AttributeSourceToastRead,
	"toast_hit":  AttributeSourceToastHit,
	"tidx_read":  AttributeSourceTidxRead,
	"tidx_hit":   AttributeSourceTidxHit,
}

MapAttributeSource is a helper map of string to AttributeSource attribute value.

View Source
var MapAttributeState = map[string]AttributeState{
	"dead": AttributeStateDead,
	"live": AttributeStateLive,
}

MapAttributeState is a helper map of string to AttributeState attribute value.

MapAttributeWalOperationLag is a helper map of string to AttributeWalOperationLag attribute value.

View Source
var (
	Type = component.MustNewType("postgresql")
)

Functions

func Meter added in v0.92.0

func Meter(settings component.TelemetrySettings) metric.Meter

func Tracer added in v0.92.0

func Tracer(settings component.TelemetrySettings) trace.Tracer

func WithStartTime added in v0.44.0

func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption

WithStartTime sets startTime on the metrics builder.

Types

type AttributeBgBufferSource added in v0.59.0

type AttributeBgBufferSource int

AttributeBgBufferSource specifies the a value bg_buffer_source attribute.

const (
	AttributeBgBufferSourceBackend AttributeBgBufferSource
	AttributeBgBufferSourceBackendFsync
	AttributeBgBufferSourceCheckpoints
	AttributeBgBufferSourceBgwriter
)

func (AttributeBgBufferSource) String added in v0.59.0

func (av AttributeBgBufferSource) String() string

String returns the string representation of the AttributeBgBufferSource.

type AttributeBgCheckpointType added in v0.59.0

type AttributeBgCheckpointType int

AttributeBgCheckpointType specifies the a value bg_checkpoint_type attribute.

const (
	AttributeBgCheckpointTypeRequested AttributeBgCheckpointType
	AttributeBgCheckpointTypeScheduled
)

func (AttributeBgCheckpointType) String added in v0.59.0

func (av AttributeBgCheckpointType) String() string

String returns the string representation of the AttributeBgCheckpointType.

type AttributeBgDurationType added in v0.59.0

type AttributeBgDurationType int

AttributeBgDurationType specifies the a value bg_duration_type attribute.

const (
	AttributeBgDurationTypeSync AttributeBgDurationType
	AttributeBgDurationTypeWrite
)

func (AttributeBgDurationType) String added in v0.59.0

func (av AttributeBgDurationType) String() string

String returns the string representation of the AttributeBgDurationType.

type AttributeOperation added in v0.41.0

type AttributeOperation int

AttributeOperation specifies the a value operation attribute.

const (
	AttributeOperationIns AttributeOperation
	AttributeOperationUpd
	AttributeOperationDel
	AttributeOperationHotUpd
)

func (AttributeOperation) String added in v0.51.0

func (av AttributeOperation) String() string

String returns the string representation of the AttributeOperation.

type AttributeSource added in v0.41.0

type AttributeSource int

AttributeSource specifies the a value source attribute.

const (
	AttributeSourceHeapRead AttributeSource
	AttributeSourceHeapHit
	AttributeSourceIdxRead
	AttributeSourceIdxHit
	AttributeSourceToastRead
	AttributeSourceToastHit
	AttributeSourceTidxRead
	AttributeSourceTidxHit
)

func (AttributeSource) String added in v0.51.0

func (av AttributeSource) String() string

String returns the string representation of the AttributeSource.

type AttributeState added in v0.41.0

type AttributeState int

AttributeState specifies the a value state attribute.

const (
	AttributeStateDead AttributeState
	AttributeStateLive
)

func (AttributeState) String added in v0.51.0

func (av AttributeState) String() string

String returns the string representation of the AttributeState.

type AttributeWalOperationLag added in v0.59.0

type AttributeWalOperationLag int

AttributeWalOperationLag specifies the a value wal_operation_lag attribute.

const (
	AttributeWalOperationLagFlush AttributeWalOperationLag
	AttributeWalOperationLagReplay
	AttributeWalOperationLagWrite
)

func (AttributeWalOperationLag) String added in v0.59.0

func (av AttributeWalOperationLag) String() string

String returns the string representation of the AttributeWalOperationLag.

type MetricConfig added in v0.77.0

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

MetricConfig provides common config for a particular metric.

func (*MetricConfig) Unmarshal added in v0.77.0

func (ms *MetricConfig) Unmarshal(parser *confmap.Conf) error

type MetricsBuilder added in v0.44.0

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

func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.CreateSettings, options ...metricBuilderOption) *MetricsBuilder

func (*MetricsBuilder) Emit added in v0.44.0

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

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) NewResourceBuilder added in v0.83.0

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) RecordPostgresqlBackendsDataPoint added in v0.44.0

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

RecordPostgresqlBackendsDataPoint adds a data point to postgresql.backends metric.

func (*MetricsBuilder) RecordPostgresqlBgwriterBuffersAllocatedDataPoint added in v0.59.0

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

RecordPostgresqlBgwriterBuffersAllocatedDataPoint adds a data point to postgresql.bgwriter.buffers.allocated metric.

func (*MetricsBuilder) RecordPostgresqlBgwriterBuffersWritesDataPoint added in v0.59.0

func (mb *MetricsBuilder) RecordPostgresqlBgwriterBuffersWritesDataPoint(ts pcommon.Timestamp, val int64, bgBufferSourceAttributeValue AttributeBgBufferSource)

RecordPostgresqlBgwriterBuffersWritesDataPoint adds a data point to postgresql.bgwriter.buffers.writes metric.

func (*MetricsBuilder) RecordPostgresqlBgwriterCheckpointCountDataPoint added in v0.59.0

func (mb *MetricsBuilder) RecordPostgresqlBgwriterCheckpointCountDataPoint(ts pcommon.Timestamp, val int64, bgCheckpointTypeAttributeValue AttributeBgCheckpointType)

RecordPostgresqlBgwriterCheckpointCountDataPoint adds a data point to postgresql.bgwriter.checkpoint.count metric.

func (*MetricsBuilder) RecordPostgresqlBgwriterDurationDataPoint added in v0.59.0

func (mb *MetricsBuilder) RecordPostgresqlBgwriterDurationDataPoint(ts pcommon.Timestamp, val float64, bgDurationTypeAttributeValue AttributeBgDurationType)

RecordPostgresqlBgwriterDurationDataPoint adds a data point to postgresql.bgwriter.duration metric.

func (*MetricsBuilder) RecordPostgresqlBgwriterMaxwrittenDataPoint added in v0.59.0

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

RecordPostgresqlBgwriterMaxwrittenDataPoint adds a data point to postgresql.bgwriter.maxwritten metric.

func (*MetricsBuilder) RecordPostgresqlBlocksReadDataPoint added in v0.44.0

func (mb *MetricsBuilder) RecordPostgresqlBlocksReadDataPoint(ts pcommon.Timestamp, val int64, sourceAttributeValue AttributeSource)

RecordPostgresqlBlocksReadDataPoint adds a data point to postgresql.blocks_read metric.

func (*MetricsBuilder) RecordPostgresqlCommitsDataPoint added in v0.44.0

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

RecordPostgresqlCommitsDataPoint adds a data point to postgresql.commits metric.

func (*MetricsBuilder) RecordPostgresqlConnectionMaxDataPoint added in v0.59.0

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

RecordPostgresqlConnectionMaxDataPoint adds a data point to postgresql.connection.max metric.

func (*MetricsBuilder) RecordPostgresqlDatabaseCountDataPoint added in v0.59.0

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

RecordPostgresqlDatabaseCountDataPoint adds a data point to postgresql.database.count metric.

func (*MetricsBuilder) RecordPostgresqlDatabaseLocksDataPoint added in v0.85.0

func (mb *MetricsBuilder) RecordPostgresqlDatabaseLocksDataPoint(ts pcommon.Timestamp, val int64, relationAttributeValue string, modeAttributeValue string, lockTypeAttributeValue string)

RecordPostgresqlDatabaseLocksDataPoint adds a data point to postgresql.database.locks metric.

func (*MetricsBuilder) RecordPostgresqlDbSizeDataPoint added in v0.44.0

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

RecordPostgresqlDbSizeDataPoint adds a data point to postgresql.db_size metric.

func (*MetricsBuilder) RecordPostgresqlDeadlocksDataPoint added in v0.84.0

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

RecordPostgresqlDeadlocksDataPoint adds a data point to postgresql.deadlocks metric.

func (*MetricsBuilder) RecordPostgresqlIndexScansDataPoint added in v0.58.0

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

RecordPostgresqlIndexScansDataPoint adds a data point to postgresql.index.scans metric.

func (*MetricsBuilder) RecordPostgresqlIndexSizeDataPoint added in v0.58.0

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

RecordPostgresqlIndexSizeDataPoint adds a data point to postgresql.index.size metric.

func (*MetricsBuilder) RecordPostgresqlOperationsDataPoint added in v0.44.0

func (mb *MetricsBuilder) RecordPostgresqlOperationsDataPoint(ts pcommon.Timestamp, val int64, operationAttributeValue AttributeOperation)

RecordPostgresqlOperationsDataPoint adds a data point to postgresql.operations metric.

func (*MetricsBuilder) RecordPostgresqlReplicationDataDelayDataPoint added in v0.59.0

func (mb *MetricsBuilder) RecordPostgresqlReplicationDataDelayDataPoint(ts pcommon.Timestamp, val int64, replicationClientAttributeValue string)

RecordPostgresqlReplicationDataDelayDataPoint adds a data point to postgresql.replication.data_delay metric.

func (*MetricsBuilder) RecordPostgresqlRollbacksDataPoint added in v0.44.0

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

RecordPostgresqlRollbacksDataPoint adds a data point to postgresql.rollbacks metric.

func (*MetricsBuilder) RecordPostgresqlRowsDataPoint added in v0.44.0

func (mb *MetricsBuilder) RecordPostgresqlRowsDataPoint(ts pcommon.Timestamp, val int64, stateAttributeValue AttributeState)

RecordPostgresqlRowsDataPoint adds a data point to postgresql.rows metric.

func (*MetricsBuilder) RecordPostgresqlSequentialScansDataPoint added in v0.84.0

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

RecordPostgresqlSequentialScansDataPoint adds a data point to postgresql.sequential_scans metric.

func (*MetricsBuilder) RecordPostgresqlTableCountDataPoint added in v0.59.0

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

RecordPostgresqlTableCountDataPoint adds a data point to postgresql.table.count metric.

func (*MetricsBuilder) RecordPostgresqlTableSizeDataPoint added in v0.59.0

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

RecordPostgresqlTableSizeDataPoint adds a data point to postgresql.table.size metric.

func (*MetricsBuilder) RecordPostgresqlTableVacuumCountDataPoint added in v0.59.0

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

RecordPostgresqlTableVacuumCountDataPoint adds a data point to postgresql.table.vacuum.count metric.

func (*MetricsBuilder) RecordPostgresqlTempFilesDataPoint added in v0.84.0

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

RecordPostgresqlTempFilesDataPoint adds a data point to postgresql.temp_files metric.

func (*MetricsBuilder) RecordPostgresqlWalAgeDataPoint added in v0.59.0

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

RecordPostgresqlWalAgeDataPoint adds a data point to postgresql.wal.age metric.

func (*MetricsBuilder) RecordPostgresqlWalDelayDataPoint added in v0.89.0

func (mb *MetricsBuilder) RecordPostgresqlWalDelayDataPoint(ts pcommon.Timestamp, val float64, walOperationLagAttributeValue AttributeWalOperationLag, replicationClientAttributeValue string)

RecordPostgresqlWalDelayDataPoint adds a data point to postgresql.wal.delay metric.

func (*MetricsBuilder) RecordPostgresqlWalLagDataPoint added in v0.59.0

func (mb *MetricsBuilder) RecordPostgresqlWalLagDataPoint(ts pcommon.Timestamp, val int64, walOperationLagAttributeValue AttributeWalOperationLag, replicationClientAttributeValue string)

RecordPostgresqlWalLagDataPoint adds a data point to postgresql.wal.lag metric.

func (*MetricsBuilder) Reset added in v0.44.0

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            MetricsConfig            `mapstructure:"metrics"`
	ResourceAttributes ResourceAttributesConfig `mapstructure:"resource_attributes"`
}

MetricsBuilderConfig is a configuration for postgresql metrics builder.

func DefaultMetricsBuilderConfig added in v0.73.0

func DefaultMetricsBuilderConfig() MetricsBuilderConfig

type MetricsConfig added in v0.77.0

type MetricsConfig struct {
	PostgresqlBackends                 MetricConfig `mapstructure:"postgresql.backends"`
	PostgresqlBgwriterBuffersAllocated MetricConfig `mapstructure:"postgresql.bgwriter.buffers.allocated"`
	PostgresqlBgwriterBuffersWrites    MetricConfig `mapstructure:"postgresql.bgwriter.buffers.writes"`
	PostgresqlBgwriterCheckpointCount  MetricConfig `mapstructure:"postgresql.bgwriter.checkpoint.count"`
	PostgresqlBgwriterDuration         MetricConfig `mapstructure:"postgresql.bgwriter.duration"`
	PostgresqlBgwriterMaxwritten       MetricConfig `mapstructure:"postgresql.bgwriter.maxwritten"`
	PostgresqlBlocksRead               MetricConfig `mapstructure:"postgresql.blocks_read"`
	PostgresqlCommits                  MetricConfig `mapstructure:"postgresql.commits"`
	PostgresqlConnectionMax            MetricConfig `mapstructure:"postgresql.connection.max"`
	PostgresqlDatabaseCount            MetricConfig `mapstructure:"postgresql.database.count"`
	PostgresqlDatabaseLocks            MetricConfig `mapstructure:"postgresql.database.locks"`
	PostgresqlDbSize                   MetricConfig `mapstructure:"postgresql.db_size"`
	PostgresqlDeadlocks                MetricConfig `mapstructure:"postgresql.deadlocks"`
	PostgresqlIndexScans               MetricConfig `mapstructure:"postgresql.index.scans"`
	PostgresqlIndexSize                MetricConfig `mapstructure:"postgresql.index.size"`
	PostgresqlOperations               MetricConfig `mapstructure:"postgresql.operations"`
	PostgresqlReplicationDataDelay     MetricConfig `mapstructure:"postgresql.replication.data_delay"`
	PostgresqlRollbacks                MetricConfig `mapstructure:"postgresql.rollbacks"`
	PostgresqlRows                     MetricConfig `mapstructure:"postgresql.rows"`
	PostgresqlSequentialScans          MetricConfig `mapstructure:"postgresql.sequential_scans"`
	PostgresqlTableCount               MetricConfig `mapstructure:"postgresql.table.count"`
	PostgresqlTableSize                MetricConfig `mapstructure:"postgresql.table.size"`
	PostgresqlTableVacuumCount         MetricConfig `mapstructure:"postgresql.table.vacuum.count"`
	PostgresqlTempFiles                MetricConfig `mapstructure:"postgresql.temp_files"`
	PostgresqlWalAge                   MetricConfig `mapstructure:"postgresql.wal.age"`
	PostgresqlWalDelay                 MetricConfig `mapstructure:"postgresql.wal.delay"`
	PostgresqlWalLag                   MetricConfig `mapstructure:"postgresql.wal.lag"`
}

MetricsConfig provides config for postgresql metrics.

func DefaultMetricsConfig added in v0.77.0

func DefaultMetricsConfig() MetricsConfig

type ResourceAttributeConfig added in v0.77.0

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

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

type ResourceAttributesConfig added in v0.77.0

type ResourceAttributesConfig struct {
	PostgresqlDatabaseName ResourceAttributeConfig `mapstructure:"postgresql.database.name"`
	PostgresqlIndexName    ResourceAttributeConfig `mapstructure:"postgresql.index.name"`
	PostgresqlSchemaName   ResourceAttributeConfig `mapstructure:"postgresql.schema.name"`
	PostgresqlTableName    ResourceAttributeConfig `mapstructure:"postgresql.table.name"`
}

ResourceAttributesConfig provides config for postgresql resource attributes.

func DefaultResourceAttributesConfig added in v0.77.0

func DefaultResourceAttributesConfig() ResourceAttributesConfig

type ResourceBuilder added in v0.82.0

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

func NewResourceBuilder(rac ResourceAttributesConfig) *ResourceBuilder

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

func (*ResourceBuilder) Emit added in v0.82.0

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

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

func (*ResourceBuilder) SetPostgresqlDatabaseName added in v0.82.0

func (rb *ResourceBuilder) SetPostgresqlDatabaseName(val string)

SetPostgresqlDatabaseName sets provided value as "postgresql.database.name" attribute.

func (*ResourceBuilder) SetPostgresqlIndexName added in v0.82.0

func (rb *ResourceBuilder) SetPostgresqlIndexName(val string)

SetPostgresqlIndexName sets provided value as "postgresql.index.name" attribute.

func (*ResourceBuilder) SetPostgresqlSchemaName added in v0.93.0

func (rb *ResourceBuilder) SetPostgresqlSchemaName(val string)

SetPostgresqlSchemaName sets provided value as "postgresql.schema.name" attribute.

func (*ResourceBuilder) SetPostgresqlTableName added in v0.82.0

func (rb *ResourceBuilder) SetPostgresqlTableName(val string)

SetPostgresqlTableName sets provided value as "postgresql.table.name" attribute.

type ResourceMetricsOption added in v0.52.0

type ResourceMetricsOption func(pmetric.ResourceMetrics)

ResourceMetricsOption applies changes to provided resource metrics.

func WithResource added in v0.82.0

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