Skip to content

Conversation

@xrmx
Copy link
Contributor

@xrmx xrmx commented Nov 12, 2025

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.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

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

  • tox

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@xrmx xrmx requested a review from a team as a code owner November 12, 2025 11:09
exporter_args = exporter_args_map.get(exporter_class, {})
provider.add_span_processor(
BatchSpanProcessor(exporter_class(**exporter_args))
span_processor(exporter_class(**exporter_args))
Copy link
Contributor Author

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,
Copy link
Contributor Author

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?

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

@xrmx xrmx Dec 12, 2025

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.

@xrmx xrmx requested a review from jeremydvoss November 13, 2025 09:44
sampler: Sampler | None = None,
resource: Resource | None = None,
exporter_args_map: ExporterArgsMap | None = None,
processor: Type[SpanProcessor] | None = None,
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

@xrmx xrmx changed the title opentelemetry-sdk: make it possible to customize processors configuation opentelemetry-sdk: make it possible to customize processors configuration Nov 26, 2025
xrmx added 6 commits December 11, 2025 11:12
…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.
@xrmx xrmx force-pushed the sdk-config-custom-processors branch from d84b162 to ba28759 Compare December 12, 2025 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants