Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poolstats: support pgxpool metrics from two pools #1328

Merged
merged 1 commit into from
May 13, 2024

Conversation

frostmar
Copy link
Contributor

Fixes #1326

Support publishing pxgpool stats from two different pools as Prometheus metrics with different application_name labels.

A clair running in combo mode after:

$ curl -s localhost:6061/metrics | grep pgxpool

# HELP pgxpool_acquire_count Cumulative count of successful acquires from the pool.
# TYPE pgxpool_acquire_count counter
pgxpool_acquire_count{application_name="libindex"} 22
pgxpool_acquire_count{application_name="libvuln"} 2
# HELP pgxpool_acquire_duration_seconds_total Total duration of all successful acquires from the pool in nanoseconds.
# TYPE pgxpool_acquire_duration_seconds_total counter
pgxpool_acquire_duration_seconds_total{application_name="libindex"} 0.044675038
pgxpool_acquire_duration_seconds_total{application_name="libvuln"} 0.0325225
# HELP pgxpool_acquired_conns Number of currently acquired connections in the pool.
# TYPE pgxpool_acquired_conns gauge
pgxpool_acquired_conns{application_name="libindex"} 1
pgxpool_acquired_conns{application_name="libvuln"} 1
# HELP pgxpool_canceled_acquire_count Cumulative count of acquires from the pool that were canceled by a context.
# TYPE pgxpool_canceled_acquire_count counter
pgxpool_canceled_acquire_count{application_name="libindex"} 0
pgxpool_canceled_acquire_count{application_name="libvuln"} 0
# HELP pgxpool_constructing_conns Number of conns with construction in progress in the pool.
# TYPE pgxpool_constructing_conns gauge
pgxpool_constructing_conns{application_name="libindex"} 0
pgxpool_constructing_conns{application_name="libvuln"} 0
# HELP pgxpool_empty_acquire Cumulative count of successful acquires from the pool that waited for a resource to be released or constructed because the pool was empty.
# TYPE pgxpool_empty_acquire counter
pgxpool_empty_acquire{application_name="libindex"} 2
pgxpool_empty_acquire{application_name="libvuln"} 1
# HELP pgxpool_idle_conns Number of currently idle conns in the pool.
# TYPE pgxpool_idle_conns gauge
pgxpool_idle_conns{application_name="libindex"} 1
pgxpool_idle_conns{application_name="libvuln"} 0
# HELP pgxpool_max_conns Maximum size of the pool.
# TYPE pgxpool_max_conns gauge
pgxpool_max_conns{application_name="libindex"} 10
pgxpool_max_conns{application_name="libvuln"} 10
# HELP pgxpool_total_conns Total number of resources currently in the pool. The value is the sum of ConstructingConns, AcquiredConns, and IdleConns.
# TYPE pgxpool_total_conns gauge
pgxpool_total_conns{application_name="libindex"} 2
pgxpool_total_conns{application_name="libvuln"} 1

@frostmar frostmar requested a review from a team as a code owner April 24, 2024 17:23
@frostmar frostmar requested review from hdonnay and removed request for a team April 24, 2024 17:23
Copy link

codecov bot commented Apr 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.24%. Comparing base (473f247) to head (4c5aa9e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1328      +/-   ##
==========================================
- Coverage   56.29%   56.24%   -0.06%     
==========================================
  Files         266      266              
  Lines       16846    16838       -8     
==========================================
- Hits         9484     9471      -13     
- Misses       6398     6402       +4     
- Partials      964      965       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@frostmar
Copy link
Contributor Author

frostmar commented May 1, 2024

bump - any chance of this being mergeable?

@crozzy
Copy link
Contributor

crozzy commented May 10, 2024

Good find, I guess combo mode is getting slightly neglected these days

@crozzy
Copy link
Contributor

crozzy commented May 13, 2024

Curious, do you run Clair in combo mode in production @frostmar?

Signed-off-by: Mark Frost <frostmar@uk.ibm.com>
@crozzy crozzy force-pushed the 1326-pgxpool-prom-metrics branch from ebf4613 to 4c5aa9e Compare May 13, 2024 15:58
@crozzy crozzy self-requested a review May 13, 2024 16:12
@crozzy
Copy link
Contributor

crozzy commented May 13, 2024

/fast-forward

@github-actions github-actions bot merged commit 4c5aa9e into quay:main May 13, 2024
8 checks passed
@frostmar
Copy link
Contributor Author

Curious, do you run Clair in combo mode ...

No, but we have a liveness probe added for the Postgres DB, which was recently updated to use a separate connpool, and I found it wasn't possible to see stats from more than one connpool! The combo mode made a nice recreate without needing anything outside the clair codebase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

datastore/postgres: cannot export prometheus metrics from both libvuln and libindex
2 participants