-
Notifications
You must be signed in to change notification settings - Fork 790
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
The LogRecord scopes are corrupted when using the BatchLogRecordExportProcessor #1933
Comments
Just encountered this issues. Here are some more details to add. if (logRecord.State is IReadOnlyCollection<KeyValuePair<string, object>> stateDictionary)
{
foreach (KeyValuePair<string, object> item in stateDictionary)
{
if (string.Equals(item.Key, "{OriginalFormat}", System.StringComparison.Ordinal))
{
customProperties["OriginalFormat"] = Convert.ToString(item.Value, CultureInfo.InvariantCulture);
}
else
{
customProperties[item.Key] = Convert.ToString(item.Value, CultureInfo.InvariantCulture);
}
}
} Here are the exception details
|
Thanks for using the new feature and reporting the issue! |
Hi, I found this issue reproduced ASP.NET Core Instrumentation only on Windows. The same code is working fine on Mac but it crashed with the ObjectDisposedException on Windows. If I should file my case as a separate case, please let me know. Here is the project file.
Here is how to configure the OTLP exporter in ASP.NET Core startup code.
Here is how to output the log.
And exception details.
To avoid this issue, we can add |
The original issue about scopes being accessed outside its lifecycle is fixed by #2026 We can close this issue. |
Thanks for reporting this. This issue is about scopes being corrupted, but your scenario is exposing a different bug, likely related to #2905. Could you open a new issue, and use 2905 to report this, for better tracking and fix. |
Bug Report
OpenTelemetry 1.1.0-beta1
Microsoft.Extensions.Logging 5.0.0
Runtime version
netcoreapp3.1
Symptom
The
BaseExporter<LogRecord>
will process incorrect scopes ifBatchLogRecordExportProcessor
is used. IfSimpleLogRecordExportProcessor
is used everything is processed correctly. This is a symptom ofBatchLogRecordExportProcessor
processing the records after the original scopes are disposed.What is the expected behavior?
The exporter should have access to correct scopes.
What is the actual behavior?
The scopes that the exported are not consistent.
Reproduce
The unit test bellow reproduces the issue:
We will close this issue if:
Additional Context
I think the
LogRecord
needs to be extended withScopes
property and these must be filled directly by theOpenTelemetryLogger
. Current APILogRecord.ForEachScope
will simply not work ifBatchLogRecordExportProcessor
is involved.The text was updated successfully, but these errors were encountered: