Skip to content
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

Potentially common error when registering log record processors via AutoConfigurationCustomizer? #6599

Open
trask opened this issue Jul 23, 2024 · 3 comments

Comments

@trask
Copy link
Member

trask commented Jul 23, 2024

I only just found that the way I've been registering log processors via AutoConfigurationCustomizer is seriously flawed, and worried other people may be doing the same:

AutoConfigurationCustomizer.addLoggerProviderCustomizer(
            (builder, otelConfig) -> builder.addLogRecordProcessor(...))

Since this will register the log record processor after the BatchLogRecordProcessor, any mutations made by the log record processor may not be exported, although 99.9% (~) of the time the mutations will be exported since they will be made prior to the batch being exported.

One (non-obvious) workaround is to leverage AutoConfigurationCustomizer.addLogRecordProcessorCustomizer().

@jack-berg
Copy link
Member

Right now, span processors can only mutate spans #onStart. It would only be mutations #onEnd that a BatchSpanProcessor would not see. This is proposed in https://github.com/open-telemetry/opentelemetry-specification/pulls, but not possible today.

@trask trask changed the title Potentially common error when registering span processors via AutoConfigurationCustomizer? Potentially common error when registering log record processors via AutoConfigurationCustomizer? Jul 23, 2024
@trask
Copy link
Member Author

trask commented Jul 23, 2024

oh right 🙈 for some reason I found the problem in logs and assumed I had the same problem in spans but actually don't

i've updated the title and description above to reference logs

@jack-berg
Copy link
Member

Right right. Logs is definitely impacted by this.

One option I've thought about is adding a option for SdkTracerProviderBuilder and SdkLoggerProviderBuilder to insert a processor at the front of the processing pipeline, rather than appending to the end.

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

No branches or pull requests

2 participants