prometheus-community / prometheus-community/postgres_exporter

Add collector for pg_connections

Open
#969 1 comment 0 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

Proposal

We had a query to count all connections by machine, which we lost due to deprecation of the queries file. I am sure others would profit from this as well

pg_connections_by_machine:
  query: "select count(*) as count, client_hostname from pg_stat_activity where client_hostname is not null group by client_hostname ;"
  master: true
  metrics:
    - client_hostname:
        usage: "LABEL"
        description: "Name of connecting client"
    - count:
        usage: "GAUGE"
        description: "Number of Connections"

If there is another easy solution for this which I am missing right now please tell me.

Regards,
Dennis

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 with the existing PostgreSQL collector entry points and how query results become Prometheus metrics. Use the proposed pg_stat_activity query and metric descriptions as the target behavior. Done means the exporter exposes connection counts grouped by non-null client_hostname, with client_hostname as a label and count as a gauge.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.