Fix: ETW span ownership lifetime#4070
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4070 +/- ##
=======================================
Coverage 82.10% 82.10%
=======================================
Files 385 385
Lines 15989 15989
=======================================
Hits 13126 13126
Misses 2863 2863 🚀 New features to boost your workflow:
|
|
Could you please have a look here ? also @ThomsonTan It passes all tests |
|
ETW exporter is a bit different from other exporters: the tracer name maps to the ETW provider name/GUID, so creating multiple tracers for the same name is not the intended hot-path pattern. Applications should normally create one tracer per ETW provider name and reuse it for the process/component lifetime. Because of that, I’d prefer not to fix this by adding Also @ThomsonTan suggestions would be helpful, as he has more experience on this. |
Thanks for the thorough explanation, I completely agree regarding the hot-path overhead; atomic reference counting in StartSpan() is not ideal for high-throughput ETW logging. The alternative approach makes perfect sense. I will revert the shared_from_this()/shared_ptr changes on the Tracer/Span and instead have the TracerProvider retain ownership of the created Tracers (e.g., via an internal map) to ensure lifetime protection at setup/GetTracer() time. I'll push the updated implementation shortly. |
Fixes #3849
Changes