Skip to content

[OneCollector] Dictionary serialization issue #2083

Open
@MattHyman

Description

@MattHyman

Component

OpenTelemetry.Exporter.OneCollector

Package Version

Package Name Version
OpenTelemetry.Api 1.8.0
OpenTelemetry 1.8.0
TBD TBD

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);

image

Expected Result

When direct logging is used everything is formed/parsed correctly.

otelLogger.Log(LogLevel.Information, new EventId(0, eventName), "{EventName}{Payload}", eventName, payload);

image

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);

image

Additional Context

We have found a partial mitigation via
[LogProperties(OmitReferenceName = true)] as described in documentation.

image

[LoggerMessage(LogLevel.Information, EventName = "WidgetActionStarted")]
public static partial void SendWidgetActionStartedEvent(this ILogger logger, [LogProperties(OmitReferenceName = true)] WidgetActionTelemetryEvent payload);

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcomp:exporter.onecollectorThings related to OpenTelemetry.Exporter.OneCollectorneeds-triageNew issues which have not been classified or triaged by a community member

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions