Add messaging v1.43 shared metrics#19267
Conversation
Pull request dashboard statusStatus last refreshed: 2026-07-22 16:49:29 UTC.
This automated status or its linked feedback items may be incorrect. If something looks wrong, please report it with the result you expected. |
5067183 to
70bb800
Compare
70bb800 to
3bb0980
Compare
There was a problem hiding this comment.
Pull request overview
Adds shared v1.43 messaging metrics behind semantic-convention selection while preserving legacy and dual-emission modes.
Changes:
- Adds current producer, consumer, and processing metrics.
- Filters high-cardinality destination names and applies metric attribute advice.
- Tests batch counts, failures, filtering, and selection modes.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
MessagingConsumerMetrics.java |
Adds current consumer metrics and batch-aware counting. |
MessagingMetricsAdvice.java |
Defines attribute advice and destination filtering. |
MessagingProcessMetrics.java |
Adds processing-duration metrics. |
MessagingProducerMetrics.java |
Adds current producer metrics and selection logic. |
MessagingConsumerMetricsTest.java |
Tests consumer metrics across modes. |
MessagingMetricsAdviceTest.java |
Tests high-cardinality filtering. |
MessagingProcessMetricsTest.java |
Tests processing-duration emission. |
MessagingProducerMetricsTest.java |
Tests producer metrics across modes. |
3bb0980 to
2577c18
Compare
2577c18 to
cc2702c
Compare
3f84ab9 to
1ee151a
Compare
1e0eb17 to
d547025
Compare
e2cb4ee to
9351d08
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 27 out of 27 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingProducerMetrics.java:54
- [General] The typed entry point also supports
CREATE, but in default and dual modeemitOldSemconvis true, so this legacy histogram is built and then unconditionally recordsmessaging.publish.durationfor message creation. No publish/send occurred, and the new CREATE test only checks the stable instruments, so this incorrect legacy point is currently accepted. Gate legacy publish-duration recording to thepublish/SEND operation for typed listeners while preserving the unconditional behavior of legacyget(), and assert its absence for CREATE in default/dual mode.
publishDurationHistogram = emitOldSemconv ? buildPublishDuration(meter) : null;
instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingConsumerMetrics.java:98
- [General] For typed
PROCESSandSETTLEoperations in default or dual mode, the legacy instruments are enabled and this unconditional path recordsmessaging.receive.duration; the analogous unconditional counter path also recordsmessaging.receive.messages. These operations did not receive messages, and the parameterized test only filters the stable metric names, so the bogus legacy points go unnoticed. Gate both legacy receive instruments to RECEIVE for typed listeners while retaining legacyget()behavior, and verify that PROCESS/SETTLE produce nomessaging.receive.*metrics.
if (receiveDurationHistogram != null) {
receiveDurationHistogram.record(duration, attributes, context);
}
9351d08 to
7c21537
Compare
7c21537 to
3e64403
Compare
3e64403 to
7d5ee42
Compare
7d5ee42 to
25afce5
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 27 out of 27 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingConsumerMetrics.java:150
- [General] Suppress non-positive legacy receive updates for typed listeners too. In default and dual modes,
getForOperationType()reaches this branch and callsadd(0, ...)for a zero-sized batch (creating an empty series), while a negative update is invalid for a monotonic counter. This is the remaining typed counter path that bypasses the PR's non-positive guard; preserve the legacyget()behavior if needed, but skip these updates for typed listeners.
if (receiveMessageCount != null && recordsLegacyReceive) {
receiveMessageCount.add(
batchMessageCount == null ? 1 : batchMessageCount, attributes, context);
25afce5 to
eca7771
Compare
eca7771 to
71cd7a7
Compare
Depends on #19266.
Dependency baseline:
653c0b1d622f3fb3b9be44a0c205d3d37dcd2214.Review only:
653c0b1d622f3fb3b9be44a0c205d3d37dcd2214..71cd7a78a22054d7e337169311c2d60c48b52c6d.Exactly one shared-metrics commit. Typed metrics gate instruments by operation type and suppress non-positive updates; stable advice follows the pinned v1.43 metric model.
Validated: complete producer/consumer suites in default/stable/dual modes plus Spotless.