[OneCollector] Dictionary serialization issue #2083
Labels
bug
Something isn't working
comp:exporter.onecollector
Things related to OpenTelemetry.Exporter.OneCollector
needs-triage
New issues which have not been classified or triaged by a community member
Component
OpenTelemetry.Exporter.OneCollector
Package Version
Runtime Version
1.9.2
Description
One Collector Exporter double serializing Dictionary payload with loggerMessage
Steps to Reproduce
Use LoggerMessage and Otel with a dictionary of objects indexed by strings. Send a message and notice how in fiddler the JSON is not being formed/parsed corectly.
[LoggerMessage(LogLevel.Debug, EventName = "ExtensionInitialized")]
public static partial void SendExtensionInitializedEvent(this ILogger logger, Dictionary<string, object> payload);
Expected Result
When direct logging is used everything is formed/parsed correctly.
otelLogger.Log(LogLevel.Information, new EventId(0, eventName), "{EventName}{Payload}", eventName, payload);
Actual Result
Use LoggerMessage and Otel with a dictionary of objects indexed by strings. Send a message and notice how in fiddler the JSON is not being formed/parsed corectly.
[LoggerMessage(LogLevel.Debug, EventName = "ExtensionInitialized")]
public static partial void SendExtensionInitializedEvent(this ILogger logger, Dictionary<string, object> payload);
Additional Context
We have found a partial mitigation via
[LogProperties(OmitReferenceName = true)] as described in documentation.
[LoggerMessage(LogLevel.Information, EventName = "WidgetActionStarted")]
public static partial void SendWidgetActionStartedEvent(this ILogger logger, [LogProperties(OmitReferenceName = true)] WidgetActionTelemetryEvent payload);
The text was updated successfully, but these errors were encountered: