-
Notifications
You must be signed in to change notification settings - Fork 439
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
contrib/jackc/pgx.v5: publish pgxpool stats to statsd client #2692
Conversation
contrib/jackc/pgx.v5/pgxpool.go
Outdated
if err != nil { | ||
return nil, err | ||
} | ||
if tracer.cfg.poolStats { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if tracer.cfg.poolStats { | |
if tracer.cfg.poolStats && tracer.cfg.statsdClient != nil { |
If we failed to generate a statsd client, we don't want to attempt to submit metrics on it.
See this PR for more context/motivation: #2682
contrib/jackc/pgx.v5/metrics.go
Outdated
if pool == nil { | ||
log.Debug("No traced pool connection found; cannot pull pool stats.") | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove lines 38 - 41 as they essentially duplicate the err != nil
check done by the caller, NewPoolWithConfig
(Note: We also removed a similar check in the database/sql DB Stats feature in more recent versions , PR)
Co-authored-by: Mikayla Toffler <[email protected]>
This PR is stale because it has been open 20 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
@rarguelloF @zarirhamza This looks good. Can you review it, please? |
Fixes #2680
What does this PR do?
Adds a new option to contrib/jackc/pgx.v5 to enable polling and submission of pgxpool stats as metrics to Datadog
Ref: https://pkg.go.dev/github.com/jackc/pgx/v5/pgxpool#Stat
Motivation
Reviewer's Checklist
Unsure? Have a question? Request a review!