-
Notifications
You must be signed in to change notification settings - Fork 295
Description
Is your feature request related to a problem?
In versions before 3.0, the library gracefully handled missing ConnectionString (or InstrumentationKey earlier).
This does not work anymore in v3 and causes an exception at startup from Azure Monitor Exporter.
In earlier versions you could not supply the connection string, e.g. in development or test environments, and things just worked (I think). You could normally resolve and use TelemetryConfiguration or TelemetryClient.
It's not clear how to resolve this. One could run AddApplicationInsightsTelemetry conditionally depending on the connection string presence. Aspire templates suggest something like this (though against Azure Monitor distro direcly). But this is problematic. For one, there's more than one way to supply the connection string (APPLICATIONINSIGHTS_CONNECTION_STRING, ApplicationInsights:ConnectionString, possibly others). And then of course we still wouldn't have TelemetryClient, TelemetryConfiguration in the DI and would need to work around that if the app uses those.
Describe the solution you'd like.
I'd like for this to work like in earlier versions, which I believe was for the library to gracefully handle a missing connection string, i.e. I can resolve a TelemetryClient, it just doesn't do anything.
Describe alternatives you've considered.
Which alternative solutions or features have you considered?
Additional context.
Add any other context about the feature request here.