Azure / azure-sdk-for-java

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

Improve the connection string management #40901

Closed jeanbisutti closed 1 day ago

jeanbisutti commented 5 days ago

The application failed to start with an unclear message when the user did not provide an Application Insights connection string, or if the connection string had a wrong format:

Caused by: io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException: Unrecognized value for otel.metrics.exporter: azure-exporter

Now, if the user does not provide a connection string, then the application does not fail to start, and the telemetry data export is disabled. This way, the customer can check that the instrumentation code does not break something in his tests.

If the Application Insights connection string does not start with InstrumentationKey=, then now the application will fail to start with a clear error message:

com.azure.monitor.applicationinsights.spring.WrongConnectionStringException: Your Application Insights connection string seems to have the wrong format. Please check the connection string and try again.

azure-sdk commented 5 days ago

API change check

APIView has identified API level changes in this PR and created following API reviews.

com.azure.spring:spring-cloud-azure-starter-monitor

jeanbisutti commented 3 days ago

/check-enforcer override