Skip to content

Conversation

@PrathameshKalekar
Copy link

Fix issue #3612: Change db.client.connections.timeouts, waits, hits, and misses from Int64ObservableUpDownCounter to Int64ObservableCounter to comply with OpenTelemetry conventions.

According to OpenTelemetry semantic conventions, these metrics represent cumulative counts that only increase, so they should be Counters, not UpDownCounters. This allows proper use of rate() functions in Prometheus and other metric exporters.

Changed metrics:

  • db.client.connections.timeouts
  • db.client.connections.waits
  • db.client.connections.hits
  • db.client.connections.misses

This is a breaking change for users relying on the previous metric type, but it aligns with OpenTelemetry best practices and enables proper metric aggregation and rate calculations.

Fix issue #3612: Change db.client.connections.timeouts, waits, hits, and misses
from Int64ObservableUpDownCounter to Int64ObservableCounter to comply with
OpenTelemetry conventions.

According to OpenTelemetry semantic conventions, these metrics represent
cumulative counts that only increase, so they should be Counters, not
UpDownCounters. This allows proper use of rate() functions in Prometheus
and other metric exporters.

Changed metrics:
- db.client.connections.timeouts
- db.client.connections.waits
- db.client.connections.hits
- db.client.connections.misses

This is a breaking change for users relying on the previous metric type,
but it aligns with OpenTelemetry best practices and enables proper metric
aggregation and rate calculations.
@jit-ci
Copy link

jit-ci bot commented Dec 13, 2025

Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset.

In case there are security findings, they will be communicated to you as a comment inside the PR.

Hope you’ll enjoy using Jit.

Questions? Comments? Want to learn more? Get in touch with us.

Prathmesh Kalekar added 2 commits December 13, 2025 16:59
Fix issue #3612: Change db.client.connections.timeouts, waits, hits, and misses
from Int64ObservableUpDownCounter to Int64ObservableCounter to comply with
OpenTelemetry conventions.

According to OpenTelemetry semantic conventions, these metrics represent
cumulative counts that only increase, so they should be Counters, not
UpDownCounters. This allows proper use of rate() functions in Prometheus
and other metric exporters.

Changes:
- Changed 4 metrics from Int64ObservableUpDownCounter to Int64ObservableCounter:
  * db.client.connections.timeouts
  * db.client.connections.waits
  * db.client.connections.hits
  * db.client.connections.misses
- Added inline comments explaining why these are counters (monotonic)
- Fixed spacing bug in statusAttr function (double space before err)
- Added TestMetricTypes_CodeReview test to document expected metric types
- All existing tests pass

This is a breaking change for users relying on the previous metric type,
but it aligns with OpenTelemetry best practices and enables proper metric
aggregation and rate calculations.
Fix issue #3612: Change db.client.connections.timeouts, waits, hits, and misses
from Int64ObservableUpDownCounter to Int64ObservableCounter to comply with
OpenTelemetry conventions.

According to OpenTelemetry semantic conventions, these metrics represent
cumulative counts that only increase, so they should be Counters, not
UpDownCounters. This allows proper use of rate() functions in Prometheus
and other metric exporters.

Changes:
- Changed 4 metrics from Int64ObservableUpDownCounter to Int64ObservableCounter:
  * db.client.connections.timeouts
  * db.client.connections.waits
  * db.client.connections.hits
  * db.client.connections.misses
- Fixed spacing bug in statusAttr function (double space before err)
- Added TestMetricTypes_CodeReview test to document expected metric types
- All existing tests pass

This is a breaking change for users relying on the previous metric type,
but it aligns with OpenTelemetry best practices and enables proper metric
aggregation and rate calculations.
@PrathameshKalekar PrathameshKalekar closed this by deleting the head repository Dec 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant