Add OTel ack/dropped metrics and collapse inbox trace tags#1194
Conversation
Wire the SendAckAsync path so every Ack* variant records the messaging.client.operation.duration histogram with messaging.operation=ack, including error.type on failure, matching the publish/request/subscribe paths.
Emit nats.client.messages.dropped on the OnMessageDropped path under the NATS.Net meter, reusing the receive tag set so it correlates with consumed.messages. Pending channel depth stays on the MessageDropped event rather than becoming an unbounded tag value.
Inbox subjects (_INBOX.<nuid>) are unique per request, so emitting them on indexed activity tags (destination.name, destination_publish.name, nats.message.subject, reply_to) pushes unbounded cardinality into tracing backends. Collapse them to "inbox", matching SpanDestinationName; the raw subject remains reachable through the Enrich callback.
|
Claude finished @mtmk's task in 4m 46s —— View job PR Review
SummaryThe three changes (ack duration histogram, dropped-messages counter, inbox subject collapsing) are all correct and well-implemented. No bugs, no protocol issues. A few things worth the author's attention:
Inbox collapse is incomplete in the fallback branches of Both methods have an All ack variants record with
The Overall the implementation is solid. The test coverage for all three features is thorough and the OTel semantic-convention decisions are well-commented. |
|
@claude please re-review the latest commit. Addresses the two earlier review notes by documenting the intentional choices: inbox-prefix breadth in LowCardinalitySubject, and collapsing all ack-protocol kinds to one OpAck histogram. |
|
Claude finished @mtmk's task in 40s —— View job Re-review:
|
…ollowups # Conflicts: # tests/NATS.Net.OpenTelemetry.Tests/OpenTelemetryTest.cs
Three OpenTelemetry follow-ups on the 3.x metrics work: record the operation.duration histogram for JetStream acks, add a dropped-messages counter on the message-drop path, and collapse inbox subjects to a constant on the high-cardinality trace tags so backends don't index a unique value per request. The raw subject stays reachable through the Enrich callback.
Fixes #1158, #1162, #1157.