Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 4, 2025

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original prompt

This section details on the original issue you should resolve

<issue_title>Batch span processor env variables breaks C++20 aggregate initialization</issue_title>
<issue_description>@marcalff @nikhilbhatia08, this PR breaks a bunch of existing code without providing a sensible alternative.

Prior to that we were using the following syntax using C++20 aggregate initialization:

 auto processor = otel::BatchSpanProcessorFactory::Create(
            std::move(exporter),
            otel::BatchSpanProcessorOptions{
                .max_queue_size = config.batch().max_queue_size(),
                .schedule_delay_millis = std::chrono::milliseconds(config.batch().schedule_delay().MilliSeconds()),
                .max_export_batch_size = config.batch().max_export_batch_size(),
            }
        );

It does not seem that there is a sensible rewrite of this code.
Maybe this PR can be reverted?

Originally posted by @georgthegreat in #3661 (comment)

Proposal - I believe the issue comes from adding a user-defined constructor, which means BatchSpanProcessorOptions is no longer an aggregate type. That disables C++20 designated initializers, so patterns like .max_queue_size = ... stop working even though they worked earlier.
We can fix this without reverting anything by removing the constructor and using default member initializers along with a small set of static helper functions for the environment variable logic. This restores aggregate initialization while keeping the original behavior intact.
</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

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.

Batch span processor env variables breaks C++20 aggregate initialization

2 participants