fix: langwatch traces all api endpoints#11013
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughA single file modification to add lazy-initialized OpenTelemetry tracer provider support to LangWatchTracer, including class attribute addition, trace call enhancement, and setup method modification with OTL provider configuration. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touchesImportant Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 4 warnings)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (40.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #11013 +/- ##
==========================================
- Coverage 33.11% 33.09% -0.02%
==========================================
Files 1389 1389
Lines 65685 65699 +14
Branches 9720 9720
==========================================
- Hits 21750 21742 -8
- Misses 42821 42843 +22
Partials 1114 1114
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
53b538c to
fb8f9e2
Compare
| ) | ||
| provider = TracerProvider(resource=resource) | ||
| provider.add_span_processor(BatchSpanProcessor(exporter)) | ||
| LangWatchTracer.tracer_provider = provider |
There was a problem hiding this comment.
why not add this to the instance?
There was a problem hiding this comment.
my understanding is (bear with me i'm still unravelling how our tracing works haha), it is expensive to create the tracer_provider each time this class is instantiated, so by tying it to a class variable, subsequent (flow) runs after the first one will have faster tracing setup time for langwatch
There was a problem hiding this comment.
The tracing service SHOULD be doing that only once, if it isn't that's another bug to fix.
I guess it makes sense to make a class attribute as it gives the best of both worlds.
There was a problem hiding this comment.
i think the tracers get lazily initialized on each graph run, will look into it more deeply, this could be a nice performance improvement
31a20ed to
153cd8b
Compare
skips open telemetry setup to prevent LangWatch from picking up all instrumented traffic (e.g., api calls #9567), and creates a dedicated TracerProvider so that it continues to trace flow execution.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.