Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
Fix counter metrics names, add _total suffix.
Browse files Browse the repository at this point in the history
  • Loading branch information
lesovsky committed May 24, 2021
1 parent a0b6af1 commit fedf358
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion internal/collector/postgres_bgwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func NewPostgresBgwriterCollector(constLabels prometheus.Labels, _ model.Collect
},
"stats_age_seconds": {
desc: prometheus.NewDesc(
prometheus.BuildFQName("postgres", "bgwriter", "stats_age_seconds"),
prometheus.BuildFQName("postgres", "bgwriter", "stats_age_seconds_total"),
"The age of the background writer activity statistics, in seconds.",
nil, constLabels,
), valueType: prometheus.CounterValue,
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/postgres_bgwriter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestPostgresBgwriterCollector_Update(t *testing.T) {
"postgres_bgwriter_maxwritten_clean_total",
"postgres_backends_fsync_total",
"postgres_backends_allocated_bytes_total",
"postgres_bgwriter_stats_age_seconds",
"postgres_bgwriter_stats_age_seconds_total",
},
collector: NewPostgresBgwriterCollector,
service: model.ServiceTypePostgresql,
Expand Down
8 changes: 4 additions & 4 deletions internal/collector/postgres_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ func NewPostgresDatabasesCollector(constLabels prometheus.Labels, _ model.Collec
},
blockstime: typedDesc{
desc: prometheus.NewDesc(
prometheus.BuildFQName("postgres", "database", "blk_time_seconds"),
"Time spent accessing data file blocks by backends in this database in each access type, in seconds.",
prometheus.BuildFQName("postgres", "database", "blk_time_seconds_total"),
"Total time spent accessing data blocks by backends in this database in each access type, in seconds.",
[]string{"database", "type"}, constLabels,
), valueType: prometheus.CounterValue, factor: .001,
},
Expand All @@ -117,8 +117,8 @@ func NewPostgresDatabasesCollector(constLabels prometheus.Labels, _ model.Collec
},
statsage: typedDesc{
desc: prometheus.NewDesc(
prometheus.BuildFQName("postgres", "database", "stats_age_seconds"),
"The age of the activity statistics, in seconds.",
prometheus.BuildFQName("postgres", "database", "stats_age_seconds_total"),
"The age of the databases activity statistics, in seconds.",
labels, constLabels,
), valueType: prometheus.CounterValue,
},
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/postgres_database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ func TestPostgresDatabasesCollector_Update(t *testing.T) {
"postgres_database_tuples_total",
"postgres_database_temp_bytes_total",
"postgres_database_temp_files_total",
"postgres_database_blk_time_seconds",
"postgres_database_blk_time_seconds_total",
"postgres_database_size_bytes",
"postgres_database_stats_age_seconds",
"postgres_database_stats_age_seconds_total",
"postgres_xacts_left_before_wraparound",
},
collector: NewPostgresDatabasesCollector,
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/postgres_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ func NewPostgresFunctionsCollector(constLabels prometheus.Labels, _ model.Collec
},
totaltime: typedDesc{
desc: prometheus.NewDesc(
prometheus.BuildFQName("postgres", "function", "total_time_seconds"),
prometheus.BuildFQName("postgres", "function", "total_time_seconds_total"),
"Total time spent in function and all other functions called by it, in seconds.",
labelNames, constLabels,
), valueType: prometheus.CounterValue, factor: .001,
},
selftime: typedDesc{
desc: prometheus.NewDesc(
prometheus.BuildFQName("postgres", "function", "self_time_seconds"),
prometheus.BuildFQName("postgres", "function", "self_time_seconds_total"),
"Total time spent in function itself, not including other functions called by it, in seconds.",
labelNames, constLabels,
), valueType: prometheus.CounterValue, factor: .001,
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/postgres_functions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ func TestPostgresFunctionsCollector_Update(t *testing.T) {
var input = pipelineInput{
required: []string{
"postgres_function_calls_total",
"postgres_function_total_time_seconds",
"postgres_function_self_time_seconds",
"postgres_function_total_time_seconds_total",
"postgres_function_self_time_seconds_total",
},
collector: NewPostgresFunctionsCollector,
service: model.ServiceTypePostgresql,
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/postgres_replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ func NewPostgresReplicationCollector(constLabels prometheus.Labels, _ model.Coll
},
lagtotalbytes: typedDesc{
desc: prometheus.NewDesc(
prometheus.BuildFQName("postgres", "replication", "lag_total_bytes"),
prometheus.BuildFQName("postgres", "replication", "lag_all_bytes"),
"Number of bytes standby is behind than primary including all phases.",
[]string{"client_addr", "user", "application_name", "state"}, constLabels,
), valueType: prometheus.GaugeValue,
},
lagtotalseconds: typedDesc{
desc: prometheus.NewDesc(
prometheus.BuildFQName("postgres", "replication", "lag_total_seconds"),
prometheus.BuildFQName("postgres", "replication", "lag_all_seconds"),
"Number of seconds standby is behind than primary including all phases.",
[]string{"client_addr", "user", "application_name", "state"}, constLabels,
), valueType: prometheus.GaugeValue,
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/postgres_replication_slots.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type postgresReplicationSlotCollector struct {
labelNames []string
}

// NewPostgresReplicationSlotCollector returns a new Collector exposing postgres replication slots stats.
// NewPostgresReplicationSlotsCollector returns a new Collector exposing postgres replication slots stats.
// For details see https://www.postgresql.org/docs/current/view-pg-replication-slots.html
func NewPostgresReplicationSlotsCollector(constLabels prometheus.Labels, _ model.CollectorSettings) (Collector, error) {
var labelNames = []string{"database", "slot_name", "slot_type", "active"}
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/postgres_replication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ func TestPostgresReplicationCollector_Update(t *testing.T) {
"postgres_recovery_info",
"postgres_wal_written_bytes_total",
"postgres_replication_lag_bytes",
"postgres_replication_lag_all_bytes",
"postgres_replication_lag_seconds",
"postgres_replication_lag_total_bytes",
"postgres_replication_lag_total_seconds",
"postgres_replication_lag_all_seconds",
},
optional: []string{},
collector: NewPostgresReplicationCollector,
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/postgres_tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ func NewPostgresTablesCollector(constLabels prometheus.Labels, _ model.Collector
},
maintLastVacuum: typedDesc{
desc: prometheus.NewDesc(
prometheus.BuildFQName("postgres", "table", "last_vacuum_seconds"),
prometheus.BuildFQName("postgres", "table", "since_last_vacuum_seconds_total"),
"Total time since table was vacuumed manually or automatically (not counting VACUUM FULL), in seconds.",
labels, constLabels,
),
valueType: prometheus.CounterValue,
},
maintLastAnalyze: typedDesc{
desc: prometheus.NewDesc(
prometheus.BuildFQName("postgres", "table", "last_analyze_seconds"),
prometheus.BuildFQName("postgres", "table", "since_last_analyze_seconds_total"),
"Total time since table was analyzed manually or automatically, in seconds.",
labels, constLabels,
),
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/postgres_tables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ func TestPostgresTablesCollector_Update(t *testing.T) {
"postgres_table_tuples_live_total",
"postgres_table_tuples_dead_total",
"postgres_table_tuples_modified_total",
"postgres_table_last_vacuum_seconds",
"postgres_table_last_analyze_seconds",
"postgres_table_since_last_vacuum_seconds_total",
"postgres_table_since_last_analyze_seconds_total",
"postgres_table_maintenance_total",
"postgres_table_size_bytes",
},
Expand Down

0 comments on commit fedf358

Please sign in to comment.