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

[BUG]: Crashes when the connection string is missing #47638

Open
JoeMarkov opened this issue Dec 22, 2024 · 3 comments
Open

[BUG]: Crashes when the connection string is missing #47638

JoeMarkov opened this issue Dec 22, 2024 · 3 comments
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor - Distro Monitor OpenTelemetry Distro needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@JoeMarkov
Copy link

Library name and version

Azure.Monitor.OpenTelemetry.AspNetCore v1.2.0

Describe the bug

I just migrated from the old AppInsights library to Azure.Monitor.OpenTelemetry.AspNetCore and I this gotcha caught me off guard and I had to spend 30 minutes trying to find why.

So, apparently, if the App Insight connection string is not present, then it will just DIE at startup with.

System.InvalidOperationException: A connection string was not found. Please set your connection string.

In my opinion, logging libraries should not prevent my application from crashing.

I also find it useful to have the library in the code, but when the connection string is not present, the library is just disabled.

https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/AzureMonitorTransmitter.cs#L77

I just think this is bad, and will trip soo many developers and many developer hours will be spent trying to figure out why.

I think a kinder approach is to not terminate the application and instead , log a friendly message that the connection string is missing and the Azure.Monitor.OpenTelemetry.AspNetCore is disabled.

just ventilating my frustration.

Expected behavior

Logging libraries should no terminate my applications.

Actual behavior

2024-12-22T17:00:19.498890235Z System.InvalidOperationException: A connection string was not found. Please set your connection string.

Reproduction Steps

don't provide any connection string.

Environment

Azure, ASP.NET Core 9

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Dec 22, 2024
@jsquire jsquire added Service Attention Workflow: This issue is responsible by Azure service team. Client This issue points to a problem in the data-plane of the library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Monitor - Distro Monitor OpenTelemetry Distro and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Dec 22, 2024
Copy link

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

@TimothyMothra
Copy link
Contributor

Hi @JoeMarkov, I'm sorry for your frustration and thank you for providing your feedback.

Let me explain how we got here.
I agree in principal that the logging library should not crash the host application.
The one exception to that is at startup.

We reasoned that if a user invokes ".UseAzureMonitor", then they're expecting their telemetry to be delivered to Application Insights.
If the SDK is unable to startup, then that's a critical failure that the user needs to know about.
We want to avoid a scenario where a user has need of their telemetry, only to discover that it wasn't properly configured.

@JoeMarkov
Copy link
Author

Thanks for the reply, I understand.

I think it would be good if this was mentioned more clearly in the most common "Getting started guides" :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor - Distro Monitor OpenTelemetry Distro needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

3 participants