metadata

package
v0.69.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

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.

Functions

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

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

func NewMetricsBuilder added in v0.44.0

func NewMetricsBuilder(ms MetricsSettings, 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 settings, 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) RecordPostgresqlBackendsDataPoint added in v0.44.0

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

RecordPostgresqlBackendsDataPoint adds a data point to postgresql.backends metric.

func (*MetricsBuilder) RecordPostgresqlBackendsDataPointWithoutDatabase added in v0.58.0

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

RecordPostgresqlBackendsDataPointWithoutDatabase 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, databaseAttributeValue string, tableAttributeValue string, sourceAttributeValue AttributeSource)

RecordPostgresqlBlocksReadDataPoint adds a data point to postgresql.blocks_read metric.

func (*MetricsBuilder) RecordPostgresqlBlocksReadDataPointWithoutDatabaseAndTable added in v0.58.0

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

RecordPostgresqlBlocksReadDataPointWithoutDatabaseAndTable 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, databaseAttributeValue string)

RecordPostgresqlCommitsDataPoint adds a data point to postgresql.commits metric.

func (*MetricsBuilder) RecordPostgresqlCommitsDataPointWithoutDatabase added in v0.58.0

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

RecordPostgresqlCommitsDataPointWithoutDatabase adds a data point to postgresql.commits metric without the database metric attribute

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

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

RecordPostgresqlDbSizeDataPoint adds a data point to postgresql.db_size metric.

func (*MetricsBuilder) RecordPostgresqlDbSizeDataPointWithoutDatabase added in v0.58.0

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

RecordPostgresqlDbSizeDataPointWithoutDatabase adds a data point to postgresql.db_size metric without a database metric attribute

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, databaseAttributeValue string, tableAttributeValue string, operationAttributeValue AttributeOperation)

RecordPostgresqlOperationsDataPoint adds a data point to postgresql.operations metric.

func (*MetricsBuilder) RecordPostgresqlOperationsDataPointWithoutDatabaseAndTable added in v0.58.0

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

RecordPostgresqlOperationsDataPointWithoutDatabaseAndTable adds a data point to postgresql.operations metric without the database or table metric attribute

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, databaseAttributeValue string)

RecordPostgresqlRollbacksDataPoint adds a data point to postgresql.rollbacks metric.

func (*MetricsBuilder) RecordPostgresqlRollbacksDataPointWithoutDatabase added in v0.58.0

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

RecordPostgresqlRollbacksDataPointWithoutDatabase adds a data point to postgresql.commits metric without the database metric attribute

func (*MetricsBuilder) RecordPostgresqlRowsDataPoint added in v0.44.0

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

RecordPostgresqlRowsDataPoint adds a data point to postgresql.rows metric.

func (*MetricsBuilder) RecordPostgresqlRowsDataPointWithoutDatabaseAndTable added in v0.58.0

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

RecordPostgresqlRowsDataPointWithoutDatabaseAndTable adds a data point to postgresql.rows metric without the database or table metric attribute.

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

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

MetricsSettings provides settings for postgresqlreceiver metrics.

func DefaultMetricsSettings added in v0.44.0

func DefaultMetricsSettings() MetricsSettings

type ResourceMetricsOption added in v0.52.0

type ResourceMetricsOption func(pmetric.ResourceMetrics)

ResourceMetricsOption applies changes to provided resource metrics.

func WithPostgresqlDatabaseName added in v0.58.0

func WithPostgresqlDatabaseName(val string) ResourceMetricsOption

WithPostgresqlDatabaseName sets provided value as "postgresql.database.name" attribute for current resource.

func WithPostgresqlIndexName added in v0.58.0

func WithPostgresqlIndexName(val string) ResourceMetricsOption

WithPostgresqlIndexName sets provided value as "postgresql.index.name" attribute for current resource.

func WithPostgresqlTableName added in v0.58.0

func WithPostgresqlTableName(val string) ResourceMetricsOption

WithPostgresqlTableName sets provided value as "postgresql.table.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