prometheus-community / prometheus-community/postgres_exporter

add client_addr to pg_stat_activity_max_tx_duration metric

Open
#985 0 comments 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

Add the client_addr field from pg_stat_activity as a label to the metric pg_stat_activity_max_tx_duration.

use case

My company runs the postgres_exporter for production PostgreSQL instances. Often the application (postgres client) is running on multiple hosts, sharing a common username. When one application instance blocks others by keeping an idle transaction open for too long, we need the client_addr information to figure out which application host is causing that.
By adding the client_addr field to the metrics, we would enable the application admins to determine the malfunctioning host without needing to ask a DBA (someone with privileges to query pg_stat_activity directly).

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 by locating the metric definition and PostgreSQL query or collection entry point for pg_stat_activity_max_tx_duration. Add client_addr as a label sourced from pg_stat_activity, then verify that the metric exposes the address for the application host causing the long-running idle transaction.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql, prometheus
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.