Closed alexmojaki closed 3 weeks ago
All modified and coverable lines are covered by tests :white_check_mark:
:loudspeaker: Thoughts on this report? Let us know!
I just want to confirm that none of the behaviour actually changes with this PR?
No, the behaviour does actually change. We can have a deprecation period (1 week?) if you want but I'm not sure it's worth it.
Latest commit: |
172a742
|
Status: | ✅ Deploy successful! |
Preview URL: | https://d34b3a64.logfire-docs.pages.dev |
Branch Preview URL: | https://alex-no-auto-configure.logfire-docs.pages.dev |
Closes https://github.com/pydantic/logfire/issues/194
Step 2 there isn't done but I realize now that it's not really a blocker, and there's strong demand for this change.
The implementation here is simple but not ideal. In particular
logfire.span
etc will still do a lot of processing which will slow things down and maybe even raise errors, it's just that the actual OTEL span will be a no-op. But makinglogfire.span
a proper no-op is nontrivial since it still needs to return a context manager with methods, and that work overlaps with https://github.com/pydantic/logfire/pull/146. Optimizing this can be done later, and the same strategy can also be applied to checking if the span/log will be sampled out or if instrumentation is currently suppressed.logfire.instrument_<module>
will also apply instrumentation including patching, but (1) that's necessary to allow callingconfigure
later and having it all just work and (2) that's how OTEL works anyway.