Skip to content

fix(otel): convert connection count metric to UpDownCounter - #6

Merged
PavelPashov merged 1 commit into
feat/add-opentelemetry-metricsfrom
feat/add-opentelemetry-metrics-up-and-down-counters
Mar 25, 2026
Merged

PavelPashov merged 1 commit into
feat/add-opentelemetry-metricsfrom
feat/add-opentelemetry-metrics-up-and-down-counters

Conversation

@PavelPashov

@PavelPashov PavelPashov commented Mar 23, 2026 •

Copy link
Copy Markdown
Owner

Description

This PR updates the Redis OTel instrumentation to use the instrument types required by the OpenTelemetry database semantic conventions. Connection pool metrics are modeled as UpDownCounters rather than ObservableGauges, so db.client.connection.count and db.client.connection.pending_requests need to be updated.


Checklist

  • Does npm test pass with this change (including linting)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

@PavelPashov
PavelPashov merged commit 8957026 into feat/add-opentelemetry-metrics Mar 25, 2026
@PavelPashov
PavelPashov deleted the feat/add-opentelemetry-metrics-up-and-down-counters branch March 25, 2026 09:14
PavelPashov added a commit that referenced this pull request Mar 27, 2026
* wip: add OpenTelemetry metrics instrumentation

* add noop metrics

* fix: check if metrics are initilized in sendCommand

* fix(otel): optimize metrics tracking by eliminating promise chaining overhead

* refactor(otel): organize metrics into specialized metric groups

* fix(otel): revert metrics to be tracked in the sendCommand method

* perf(metrics): optimize command metrics with factory pattern and inline attributes

* feat: Add new OTEL_ATTRIBUTES constants

* feat: Add client-side-caching metric group with 4 new metric names

* feat: Create error categorization stub function

* feat: Add pool name formatting utility function

* feat: Refactor recordConnectionCreateTime to use closure pattern

* feat: Rename redis.client.errors.handled to redis.client.errors

* feat: Update IOTelResiliencyMetrics interface with internal flag and error attributes

* feat: Add redis.client.connection.notification attribute to maintenance metrics

* feat: Add db.response.status_code attribute extraction for Redis errors

* feat: Wire redis.client.connection.closed metric with close reason attribute

* feat: Add db.client.connection.wait_time method with closure pattern

* feat: Add db.client.connection.use_time method with closure pattern

* feat: Integrate wait_time and use_time metrics into connection pool

* feat: Add CSC metric instruments to registerInstruments

* feat: Create IOTelClientSideCacheMetrics interface and implementation class

* feat: Wire redis.client.csc.requests metric to cache hit/miss detection

* feat: Wire redis.client.csc.items metric to track cache size changes

* feat: Wire redis.client.csc.evictions metric with eviction reason

* feat: Wire redis.client.csc.network_saved metric to estimate bytes saved on cache hit

* refactor: Add count parameter to recordCacheEviction to batch eviction recording

* fix: typo

* feat: Implement redis.client.pubsub.messages metric for pub/sub publish and receive paths

* feat: Implement redis.client.stream.produce.messages metric for stream producers

* refactor: move pub/sub and stream metrics recording to command wrapper

* refactor: align metric groups with instrumentation spec

* feat: add error classification helper and enrich metrics attributes

* refactor: replace command wrapper with onSuccess hook for metrics

* feat(client): add client identity tracking for OpenTelemetry metrics

* feat(otel): convert metrics to observable gauges with client registry

* feat(otel): refine metrics coverage and remove connection use_time instrument

* refactor(otel): resolve metric attributes via clientId registry lookup

* refactor(otel): propagate clientId through runtime metrics paths

* test(otel): expand metrics coverage and add test utilities

* test(otel): fix flaky test

* feat(otel): align metric attributes/config and expand observability coverage

* test(otel): add maintenance metrics e2e scenario with standalone FI config

* refactor(otel): use instrumentation scope name and stop injecting resource attrs

* fix(opentelemetry): rename stream bucket config

* docs(opentelemetry): add metrics docs/examples

* fix(otel): scope redirection error dedupe to cluster retry path

* fix(opentelemetry): normalize db.namespace and server.port to strings in command and CSC metrics

* fix(otel): disable recordNetworkBytesSaved for CSC

* refactor(otel): remove command.onSuccess

* feat(otel): convert connection count metric to UpDownCounter (#6)

* fix: keep registry identity in sync after _setIdentity
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.

2 participants