fix: distributed propagation#86
Conversation
|
Question for @monoxgas - We utilize the W3C propagator to fix this issue. Should we make this the default global propagator? My inclination is yes, and based on research it seems like that would work fine, but I'm not sure if you've run into anything regarding this issue for non distributed runs? |
| # a trace, so we'll bypass it and use the W3C propagator directly. | ||
| global_propagator = propagate.get_global_textmap() | ||
| if "NoExtract" in type(global_propagator).__name__: | ||
| w3c_propagator = TraceContextTextMapPropagator() |
There was a problem hiding this comment.
i think we can just always use this globally rather than switching it out here
There was a problem hiding this comment.
Like these changes, if I'm understanding correctly this is all a consequence of:
1 - When distributed=False on logfire, it overrides the global textmap provider to a NoExtract variant: https://github.com/pydantic/logfire/blob/e0d3fdff5ce2f2490f62529d47dd12dc58be51ff/logfire/_internal/config.py#L1126C31-L1126C49
2 - This doesn't affect the injection, so we capture context properly, but when we go to use it on the far side it doesn't actually pull out the context we need.
I like these changes, inclined to keep our override as a check for NoExtract. It's similar to how logfire does it on their end: https://github.com/pydantic/logfire/blob/e0d3fdff5ce2f2490f62529d47dd12dc58be51ff/logfire/propagate.py#L68
As an extension at some point, I think we should expose the distributed setting to the logfire.configure call in our settings object and set it to True by default.
|
yep that my understanding is aligned here. Thanks |
Bugfix for distributed propagation
Key Changes:
Generated Summary:
TraceContextTextMapPropagator.This summary was generated with ❤️ by rigging