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

Update SDK Observability docs to include instructions and samples for the **Azure.Monitor.OpenTelemetry.AspNetCore** package #4932

Closed
argium opened this issue Dec 18, 2024 · 1 comment
Labels
customer-reported Issue created by a customer needs-investigation

Comments

@argium
Copy link

argium commented Dec 18, 2024

Please update the SDK Observability page to include instructions and code samples for the Azure.Monitor.OpenTelemetry.AspNetCore package.

Details
Application Insights documentation recommends that new applications use Azure Monitor OpenTelemetry for .NET (aka. Azure.Monitor.OpenTelemetry.AspNetCore) instead of their classic APIs for instrumentation. The CosmosDB SDK Observability documentation provides instructions and code samples for Azure.Monitor.OpenTelemetry.Exporter and Microsoft.ApplicationInsights.AspNetCore, but not the recommended one.

OpenTelemetry is relatively new for me so I'm not sure how to configure it. My solution does not use ActivitySource, and none of the code samples are compatible with the App Insights documentation.

var otel = services
    .AddOpenTelemetry()
    .ConfigureResource(r => r.AddService(environment.ApplicationName))
    .UseAzureMonitor();

services.Configure<OpenTelemetryLoggerOptions>((loggingOptions) =>
{
    loggingOptions.IncludeScopes = true;
});

As a result, CosmosDB requests do not show up correctly in the App Insights Azure portal UI out of the box. Azure Storage SDK works as expected.

@sourabh1007
Copy link
Contributor

sourabh1007 commented Jan 22, 2025

you can refer this: https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/docs/observability.md

Feel free to reopen this issue or fork the repo, if you have any suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issue created by a customer needs-investigation
Projects
None yet
Development

No branches or pull requests

2 participants