Make SpanProcessor.on_start accept parent Context#1251
Make SpanProcessor.on_start accept parent Context#1251codeboten merged 6 commits intoopen-telemetry:masterfrom
Conversation
* context from Tracer.start_span is passed through to the SpanProcessor * fix linting issue in falcon test app when linting with eachdist script * fix global error handler test as it read installed extensions * reset global Configuration object state after tests were run
|
I understand that this is in the specs but what exactly is it being used for? I don't see the behavior being defined anywhere (or where this parameter is being used) specifically for |
Which behavior do you mean? It is clearly specified what must be in there: https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/sdk.md#OnStart
This is not used in the built-in SDK, but one usage example from Dynatrace is this: We have a custom propagator that reads an additional HTTP header. We set this http header in the returned context. In a custom SpanProcessor we can copy the header from the context to a span attribute, in order to later have it exported. |
This changes the SpanProcessor interface, so it is breaking I think. |
Sorry what I meant was:
If it is not used in the built-in SDK, why define |
Because one purpose of the built-in SDK is to allow users to add custom span processors which might need this parameter 😃
(you mean on_start here, right?) |
|
Note that Dynatrace is not the only party interested in this, as evident e.g. from open-telemetry/opentelemetry-java#1811 |
Ahh I see that was the confusion. Thanks for the explanation! :) |
|
|
||
| class TestErrorHandler(TestCase): | ||
| def test_default_error_handler(self): | ||
| @patch("opentelemetry.sdk.error_handler.iter_entry_points") |
There was a problem hiding this comment.
when running the test locally with the eachdist script this test fails. The problem is that there are some entry points already setup when installing a dev environment with eachdist develop. This test however checkes the default error handler when no error handler entry points are configured.
|
codeboten
left a comment
There was a problem hiding this comment.
Thanks for the change, lgtm
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
Description
Adds optional parent
Contextparameter toSpanProcessor.on_startas per spec.Fixes #1250
Type of change
How Has This Been Tested?
Additional unit tests checking that the parent Context is passed through from tracer.start_span to SpanProcessor.on_start
Checklist: