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

[OneCollector] Dictionary serialization issue #2083

Open
MattHyman opened this issue Sep 19, 2024 · 1 comment
Open

[OneCollector] Dictionary serialization issue #2083

MattHyman opened this issue Sep 19, 2024 · 1 comment
Assignees
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

Comments

@MattHyman
Copy link

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

@MattHyman MattHyman added the bug Something isn't working label Sep 19, 2024
@github-actions github-actions bot added the comp:exporter.onecollector Things related to OpenTelemetry.Exporter.OneCollector label Sep 19, 2024
@CodeBlanch CodeBlanch added the needs-triage New issues which have not been classified or triaged by a community member label Sep 19, 2024
@CodeBlanch CodeBlanch self-assigned this Sep 19, 2024
@CodeBlanch CodeBlanch changed the title OneCollector [OneCollector] Dictionary serialization issue Sep 19, 2024
@sstulman
Copy link

I am seeing this also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

3 participants