-
Notifications
You must be signed in to change notification settings - Fork 772
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
Disallow LogRecord
options to be updated after initialization.
#2902
Comments
I would treat it as a bug that current LoggingProvider respected changes after building the factory. We need to "snapshot" the options, and not respect changes done after that. Only exception is adding processors, which is a documented/supported feature for traces, and we share same pipeline for logs as well, so need to keep it that for consistency. |
I'm interested in working on this. I think this is an easy fix. and call this method in the This will clone all the boolean properties. opentelemetry-dotnet/src/OpenTelemetry/Logs/OpenTelemetryLoggerProvider.cs Lines 47 to 58 in 4d6c05c
|
^Correction to above. As of today, there is no ability to add processors after building the factory. This is different from tracing. |
Bug Report
Currently, the SDK allows
LogRecord
options to be changed after the object was being built by the LoggerFactory.This could introduce unnecessary complexity toward different states (before/after options got updated) and making it harder to maintain.
Discussion: #2891 (comment)
What is the expected behavior?
Remove existing test code on changing the
LogRecord
options after the object was being built by the LoggerFactory inLogRecordTest.cs and
OtlpLogExporterTests.cs`.(To be discussed)
Explicitly disallow
LogRecord
options to be tweaked after instantiation.The text was updated successfully, but these errors were encountered: