metadata

package
v0.57.2 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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.

Functions

func WithStartTime added in v0.44.0

func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption

WithStartTime sets startTime on the metrics builder.

Types

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

type MetricSettings struct {
	Enabled bool `mapstructure:"enabled"`
}

MetricSettings provides common settings for a particular metric.

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(settings MetricsSettings, buildInfo component.BuildInfo, 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) 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) 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) 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) 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) 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) 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) 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"`
	PostgresqlBlocksRead MetricSettings `mapstructure:"postgresql.blocks_read"`
	PostgresqlCommits    MetricSettings `mapstructure:"postgresql.commits"`
	PostgresqlDbSize     MetricSettings `mapstructure:"postgresql.db_size"`
	PostgresqlOperations MetricSettings `mapstructure:"postgresql.operations"`
	PostgresqlRollbacks  MetricSettings `mapstructure:"postgresql.rollbacks"`
	PostgresqlRows       MetricSettings `mapstructure:"postgresql.rows"`
}

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