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.47k stars 4.8k forks source link

[FEATURE REQ] Add Live Metrics support for .NET console / worker apps #46098

Open gastonmuijtjens opened 1 month ago

gastonmuijtjens commented 1 month ago

Library name

Azure.Monitor.OpenTelemetry.Exporter

Please describe the feature.

According to the documentation, Live Metrics is currently not supported for the Azure.Monitor.OpenTelemetry.Exporter package which can be used for console and worker service applications. It is however supported for Azure.Monitor.OpenTelemetry.AspNetCore. There used to be a separate package for Live Metrics, but that has been moved to the AspNetCore specific package: https://github.com/Azure/azure-sdk-for-net/pull/43506, and is now considered deprecated.

Our team has some worker services where we also want to have support for Live Metrics after we migrated from the classic Application Insights API.

Is there any way to enable Live Metrics support for regular .NET console applications or worker services?

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.

TimothyMothra commented 1 month ago

Hi @gastonmuijtjens, this is on our backlog. The Exporter package must maintain AOT compatibility. Currently the LiveMetrics codebase uses some reflection to apply filters which will require a rewrite. It's a lower priority today, but we are exploring options. We will keep this issue open to monitor feedback.

As a workaround, you could use the AspNetCore package in your worker service app. I can't officially recommend this in our docs because this will bring in extra AspNetCore dependencies and you would be responsible for maintaining the lifecycle of the OpenTelemetry components (startup and graceful shutdown).