Fix OTel activity leak in Direct request mode#1047
Conversation
When using NatsRequestReplyMode.Direct, the OpenTelemetry activity stored in message headers was never disposed. SharedInbox mode handles this via ActivityEndingMsgReader, but Direct mode bypasses that path. Add explicit activity disposal after receiving the response message.
|
sorry for the long delay @aradalvand I'd appreciate it if you can check it out when you get a minute please. thanks |
|
Hi @mtmk; thank you for the effort. Did you actually test this? I say that because I remember doing something vaguely similar and it did not appear to work, so the solution may not be that simple. |
good point! i can/should write a test case for it. can you give me a rough scenario please? |
|
I think just doing a simple request and ensuring the span/activity is closed after the reply is received would suffice. It's just important to run any test you write against the previous code as well to make sure this fix is actually doing the right thing. |
Changes in this release: * Fix StreamSourceInfo.Active handle -1 correctly (#1058) * Fix NatsUri not reflecting host/port changes from OnConnectingAsync hook (#997) Chanfes from preview.2 * Fix OTel activity leak in Direct request mode (#1047) * Fix subject UTF-8 encoding (#1054) * Add SlowConsumerDetected event and warnings (#1052) * Fixed unobserved exceptions surfacing due to unobserved tcs. (#1051) Changes from preview.1 * Fix and improve build for docs ci error (#1040) * resolves: 1035 - Use ConnectTimeout when awaiting INFO signal (#1039) * Fix slow consumer blocking (#1041)
Changes in this release: * Fix StreamSourceInfo.Active handle -1 correctly (#1058) * Fix NatsUri not reflecting host/port changes from OnConnectingAsync hook (#997) Chanfes from preview.2 * Fix OTel activity leak in Direct request mode (#1047) * Fix subject UTF-8 encoding (#1054) * Add SlowConsumerDetected event and warnings (#1052) * Fixed unobserved exceptions surfacing due to unobserved tcs. (#1051) Changes from preview.1 * Fix and improve build for docs ci error (#1040) * resolves: 1035 - Use ConnectTimeout when awaiting INFO signal (#1039) * Fix slow consumer blocking (#1041)



Fix OpenTelemetry activity not being disposed when using
NatsRequestReplyMode.Direct.The activity stored in message headers is now explicitly disposed after receiving the response, matching the behavior of
SharedInboxmode which disposes viaActivityEndingMsgReader.Fixes #862