prometheus-community / prometheus-community/postgres_exporter

stat_activity_autovacuum: collected metric was collected before with the same name and label values

Open
#953 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
3.6k
Forks
835
Avg merge
2d 4h
Merged PRs (30d)
10

Description

What did you do?

Investigated scrape failures.

What did you expect to see?

No scrape failures.

What did you see instead? Under which circumstances?

$ curl http://localhost:9187/metrics
collected metric "pg_stat_activity_autovacuum_timestamp_seconds" { label:{name:"relname"  value:"datacdr"}  gauge:{value:1.699456188197915e+09}} was collected before with the same name and label values

Given this output it seems likely the stat_activity_autovacuum collector neglects to put the schema name into labels.

  • System information:
$ uname -srm
Linux 4.19.0-25-amd64 x86_64
$ lsb_release -a
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster
  • postgres_exporter version:
$ /usr/local/bin/postgres_exporter --version
postgres_exporter, version 0.15.0 (branch: HEAD, revision: 68c176b8833b7580bf847cecf60f8e0ad5923f9a)
  build user:       root@88f74f2c2888
  build date:       20231027-14:38:56
  go version:       go1.21.3
  platform:         linux/amd64
  tags:             unknown
  • postgres_exporter flags:
--collector.stat_statements --collector.stat_wal_receiver --collector.stat_activity_autovacuum --collector.long_running_transactions --collector.database_wraparound
  • PostgreSQL version:
# show server_version;
         server_version
--------------------------------
 15.4 (Debian 15.4-2.pgdg100+1)
  • Logs:

I didn't see any relevant logs for this.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the stat_activity_autovacuum collector entry point and reproduce the duplicate metric through the /metrics endpoint with the reported PostgreSQL setup. Check how relname and schema are represented in the collected labels; done means the collector emits unique metric label sets without scrape failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
databases, observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.