-
Notifications
You must be signed in to change notification settings - Fork 776
opentelemetry-sdk: make it possible to customize processors configuration #4806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| exporter_args = exporter_args_map.get(exporter_class, {}) | ||
| provider.add_span_processor( | ||
| BatchSpanProcessor(exporter_class(**exporter_args)) | ||
| span_processor(exporter_class(**exporter_args)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is failing pyright check because Type[SpanProcessor] does not impose a constructor that takes an exporter as first parameter. Need to type that I guess.
| id_generator: IdGenerator | None = None, | ||
| setup_logging_handler: bool | None = None, | ||
| exporter_args_map: ExporterArgsMap | None = None, | ||
| span_processor: Type[SpanProcessor] | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same for every exporter, is it enough or we want to make it per exporter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might make the API too ugly, but we could do
span_processors: dict[str, Type[SpanProcessor] | None = None,
default_span_processor: Type[SpanProcessor] | None = None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the current code we call just one processor wrapping the exporter class, what I was asking if people with multiple exporters may want to use a different processor depending on the exporter, similar on how we handle the exporters args as exporter_args_map.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed the API to take a list of processors for poking with the spans / log records and one used to wrap the exporters.
| sampler: Sampler | None = None, | ||
| resource: Resource | None = None, | ||
| exporter_args_map: ExporterArgsMap | None = None, | ||
| processor: Type[SpanProcessor] | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now, we are supporting only one custom span processor. Are there any plans to support multiple, that is a list of span processors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do that but we also need to introduce a convention that the last one wraps the exporter or something similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've extended the api to take both a list of processors and one being the designated one for exporting the telemetry data
…tion Make it easier for distributions to override the processors set up by the sdk configurator by specifying a span processor and a log record processor.
d84b162 to
ba28759
Compare
Description
Make it easier for distributions to override the processors set up by the sdk configurator by specifying a list of span processors, a list of log record processors and the span and log record processor designated to call the exporters.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Contrib Repo Change?
Checklist: