Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.17k stars 4.53k forks source link

Azure.Monitor.OpenTelemetry.AspNetCore.Internals.AzureSdkCompat.AzureEventSourceLogForwarder double formats event messages #44028

Open christothes opened 1 month ago

christothes commented 1 month ago

https://github.com/Azure/azure-sdk-for-net/blob/c4418cd3e85f2e01a92b702414244647ff3695df/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/src/Internals/AzureSdkCompat/AzureEventSourceLogForwarder.cs#L70

calls LogEvent, but ignores the formatted string coming from the s parameter.

LogEvent then calls _formatMessage here: https://github.com/Azure/azure-sdk-for-net/blob/c4418cd3e85f2e01a92b702414244647ff3695df/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/src/Internals/AzureSdkCompat/AzureEventSourceLogForwarder.cs#L34

which is defined as: https://github.com/Azure/azure-sdk-for-net/blob/c4418cd3e85f2e01a92b702414244647ff3695df/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/src/Internals/AzureSdkCompat/AzureEventSourceLogForwarder.cs#L64

Then EventSource.Format() calls: https://github.com/Azure/azure-sdk-for-net/blob/2a0e020ae9348cb31af769027efd6b1491595a9d/sdk/core/Azure.Core/src/Shared/EventSourceEvent.cs#L58

This seems to effectively calls EventSourceEventFormatting.Format twice.

(related to https://github.com/Azure/azure-sdk-for-net/pull/43947#issuecomment-2111253949)

github-actions[bot] commented 1 month ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @cijothomas @rajkumar-rangaraj @reyang @TimothyMothra @vishweshbankwar.