-
Type:
New Feature
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Component/s: Observability
-
Needed
Amend the OpenTelemetry specification to add a metrics signal, following the OpenTelemetry database client semantic conventions (v1.45.0):
- db.client.operation.duration (MUST): one histogram sample per command attempt, value = command monitoring duration, attributes as on the command span.
- Connection pool metrics db.client.connection.* (SHOULD): count, limit, idle.min, pending_requests, timeouts, create_time, wait_time, use_time, derived from CMAP events.
- Enablement independent of tracing: metrics.enabled client option and OTEL_<LANG>_INSTRUMENTATION_MONGODB_METRICS_ENABLED; the existing tracing switch is unchanged.
- db.mongodb.client.name = appName on every metric, to tell several MongoClient instances apart.
- Exemplars: each measurement is recorded while its covering span (command span or operation span) is current, so the SDK links metrics to traces; drivers never construct exemplars.
- Implementation guardrails (instruments created once per Meter, pre-built attributes, cleanup on close) and prose tests.
Design doc: specifications repo, branch nh/otel/metrics-design, docs/superpowers/specs/2026-12-04-otel-metrics-design.md.