fix(collector): honor custom Postgres and PgBouncer ports in OTel metrics configs - #4535
fix(collector): honor custom Postgres and PgBouncer ports in OTel metrics configs#4535andrewlecuyer wants to merge 1 commit into
Conversation
…rics configs Replaces hardcoded `port=5432` in the generated OpenTelemetry collector receivers with the actual configured ports from the cluster spec for both Postgres and PgBouncer metrics. Also updates the `server` static attribute in Postgres metric queries to reflect the configured Postgres port, and adds tests covering custom ports.
|
Nice, focused fix. The four hardcoded port=5432 values and the localhost:5432 in Postgres metric static_attributes.server are correctly threaded through from spec.port / spec.proxy.pgBouncer.port, and the added updateServerAttribute runs after appendToJSONArray, so the version-specific fast-metrics files get rewritten too. Tests pass locally. A few notes:
Nits: the // Sets Port to 5432 comments in tests will go stale if defaults change; and updateServerAttribute could note the port arg is spec.port. Optional follow-up: the generated JSON still ships "server": "localhost:5432", which reads misleadingly now that it's always rewritten. Could either use a placeholder or just inject the attribute in updateServerAttribute. |
Replaces hardcoded
port=5432in the generated OpenTelemetry collector receivers with the actual configured ports from the cluster spec for both Postgres and PgBouncer metrics. Also updates theserverstatic attribute in Postgres metric queries to reflect the configured Postgres port, and adds tests covering custom ports.Checklist:
Type of Changes:
What is the current behavior (link to any open issues here)?
OTel metrics collection does not honor custom PG or PgBouncer ports.
What is the new behavior (if this is a feature change)?
OTel metrics collection honors custom PG or PgBouncer ports.
Other Information: