Documentation ¶
Index ¶
- Variables
- func WithStartTime(startTime pdata.Timestamp) metricBuilderOption
- type MetricSettings
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(metrics pdata.MetricSlice)
- func (mb *MetricsBuilder) NewMetricData() pdata.Metrics
- func (mb *MetricsBuilder) RecordPostgresqlBackendsDataPoint(ts pdata.Timestamp, val int64, databaseAttributeValue string)
- func (mb *MetricsBuilder) RecordPostgresqlBlocksReadDataPoint(ts pdata.Timestamp, val int64, databaseAttributeValue string, ...)
- func (mb *MetricsBuilder) RecordPostgresqlCommitsDataPoint(ts pdata.Timestamp, val int64, databaseAttributeValue string)
- func (mb *MetricsBuilder) RecordPostgresqlDbSizeDataPoint(ts pdata.Timestamp, val int64, databaseAttributeValue string)
- func (mb *MetricsBuilder) RecordPostgresqlOperationsDataPoint(ts pdata.Timestamp, val int64, databaseAttributeValue string, ...)
- func (mb *MetricsBuilder) RecordPostgresqlRollbacksDataPoint(ts pdata.Timestamp, val int64, databaseAttributeValue string)
- func (mb *MetricsBuilder) RecordPostgresqlRowsDataPoint(ts pdata.Timestamp, val int64, databaseAttributeValue string, ...)
- func (mb *MetricsBuilder) Reset(options ...metricBuilderOption)
- type MetricsSettings
Constants ¶
This section is empty.
Variables ¶
var A = Attributes
A is an alias for Attributes.
var AttributeOperation = struct { Ins string Upd string Del string HotUpd string }{ "ins", "upd", "del", "hot_upd", }
AttributeOperation are the possible values that the attribute "operation" can have.
var AttributeSource = struct { HeapRead string HeapHit string IdxRead string IdxHit string ToastRead string ToastHit string TidxRead string TidxHit string }{ "heap_read", "heap_hit", "idx_read", "idx_hit", "toast_read", "toast_hit", "tidx_read", "tidx_hit", }
AttributeSource are the possible values that the attribute "source" can have.
var AttributeState = struct { Dead string Live string }{ "dead", "live", }
AttributeState are the possible values that the attribute "state" can have.
var Attributes = struct { // Database (The name of the database.) Database string // Operation (The database operation.) Operation string // Source (The block read source type.) Source string // State (The tuple (row) state.) State string // Table (The schema name followed by the table name.) Table string }{ "database", "operation", "source", "state", "table", }
Attributes contains the possible metric attributes that can be used.
Functions ¶
func WithStartTime ¶ added in v0.44.0
WithStartTime sets startTime on the metrics builder.
Types ¶
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, options ...metricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶ added in v0.44.0
func (mb *MetricsBuilder) Emit(metrics pdata.MetricSlice)
Emit appends generated metrics to a pdata.MetricsSlice and updates the internal state to be ready for recording another set of data points. This function will be doing all transformations required to produce metric representation defined in metadata and user settings, e.g. delta/cumulative translation.
func (*MetricsBuilder) NewMetricData ¶ added in v0.47.0
func (mb *MetricsBuilder) NewMetricData() pdata.Metrics
NewMetricData creates new pdata.Metrics and sets the InstrumentationLibrary name on the ResourceMetrics.
func (*MetricsBuilder) RecordPostgresqlBackendsDataPoint ¶ added in v0.44.0
func (mb *MetricsBuilder) RecordPostgresqlBackendsDataPoint(ts pdata.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 pdata.Timestamp, val int64, databaseAttributeValue string, tableAttributeValue string, sourceAttributeValue string)
RecordPostgresqlBlocksReadDataPoint adds a data point to postgresql.blocks_read metric.
func (*MetricsBuilder) RecordPostgresqlCommitsDataPoint ¶ added in v0.44.0
func (mb *MetricsBuilder) RecordPostgresqlCommitsDataPoint(ts pdata.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 pdata.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 pdata.Timestamp, val int64, databaseAttributeValue string, tableAttributeValue string, operationAttributeValue string)
RecordPostgresqlOperationsDataPoint adds a data point to postgresql.operations metric.
func (*MetricsBuilder) RecordPostgresqlRollbacksDataPoint ¶ added in v0.44.0
func (mb *MetricsBuilder) RecordPostgresqlRollbacksDataPoint(ts pdata.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 pdata.Timestamp, val int64, databaseAttributeValue string, tableAttributeValue string, stateAttributeValue string)
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