Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ io.clientcore:http-stress;1.0.0-beta.1;1.0.0-beta.1
# <!-- {x-version-update;unreleased_com.azure:azure-core;dependency} -->

unreleased_com.azure:azure-monitor-opentelemetry-exporter;1.0.0-beta.31
unreleased_com.azure:azure-monitor-opentelemetry-autoconfigure;1.0.0-beta.1

# Released Beta dependencies: Copy the entry from above, prepend "beta_", remove the current
# version and set the version to the released beta. Released beta dependencies are only valid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import com.azure.json.JsonProviders;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.monitor.opentelemetry.exporter.implementation.localstorage.LocalStorageTelemetryPipelineListener;
import com.azure.monitor.opentelemetry.exporter.implementation.models.TelemetryItem;
import com.azure.monitor.opentelemetry.autoconfigure.implementation.localstorage.LocalStorageTelemetryPipelineListener;
import com.azure.monitor.opentelemetry.autoconfigure.implementation.models.TelemetryItem;
import reactor.core.publisher.Mono;

import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import com.azure.core.http.policy.HttpPipelinePolicy;
import com.azure.json.JsonProviders;
import com.azure.json.JsonReader;
import com.azure.monitor.opentelemetry.exporter.AzureMonitorExporterOptions;
import com.azure.monitor.opentelemetry.exporter.implementation.models.*;
import com.azure.monitor.opentelemetry.autoconfigure.AzureMonitorAutoConfigureOptions;
import com.azure.monitor.opentelemetry.autoconfigure.implementation.models.*;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -47,10 +47,10 @@ class SpringMonitorTest {
static class TestConfig {

@Bean
AzureMonitorExporterOptions azureMonitorExporterBuilder() {
AzureMonitorAutoConfigureOptions azureMonitorExporterBuilder() {
countDownLatch = new CountDownLatch(2);
customValidationPolicy = new CustomValidationPolicy(countDownLatch);
return new AzureMonitorExporterOptions()
return new AzureMonitorAutoConfigureOptions()
.connectionString("InstrumentationKey=00000000-0000-0000-0000-0FEEDDADBEEF;IngestionEndpoint=https://test.in.applicationinsights.azure.com/;LiveEndpoint=https://test.livediagnostics.monitor.azure.com/")
.pipeline(getHttpPipeline(customValidationPolicy));
}
Expand Down
4 changes: 2 additions & 2 deletions sdk/spring/spring-cloud-azure-starter-monitor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-monitor-opentelemetry-exporter</artifactId>
<version>1.0.0-beta.31</version> <!-- {x-version-update;com.azure:azure-monitor-opentelemetry-exporter;dependency} -->
<artifactId>azure-monitor-opentelemetry-autoconfigure</artifactId>
<version>1.0.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-monitor-opentelemetry-autoconfigure;dependency} -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This artifact is not released yet: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/monitor/azure-monitor-opentelemetry-autoconfigure/CHANGELOG.md

image

To unblock spring-cloud-azure-starter-monitor's release, maybe we should merge this PR after this artifact released?

</dependency>

<!-- Test dependencies -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

package com.azure.spring.cloud.autoconfigure.monitor.implementation;

import com.azure.monitor.opentelemetry.exporter.AzureMonitorExporter;
import com.azure.monitor.opentelemetry.exporter.AzureMonitorExporterOptions;
import com.azure.monitor.opentelemetry.autoconfigure.AzureMonitorAutoConfigure;
import com.azure.monitor.opentelemetry.autoconfigure.AzureMonitorAutoConfigureOptions;
import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration;
import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider;
import org.slf4j.Logger;
Expand Down Expand Up @@ -56,22 +56,22 @@ private static boolean applicationInsightsAgentIsAttached() {
}

@Bean
AutoConfigurationCustomizerProvider autoConfigurationCustomizerProvider(@Value("${applicationinsights.connection.string:#{null}}") String connectionString, ObjectProvider<AzureMonitorExporterOptions> azureMonitorExporterOptions) {
AutoConfigurationCustomizerProvider autoConfigurationCustomizerProvider(@Value("${applicationinsights.connection.string:#{null}}") String connectionString, ObjectProvider<AzureMonitorAutoConfigureOptions> azureMonitorAutoConfigureOptions) {

if (!isNativeRuntimeExecution() && applicationInsightsAgentIsAttached()) {
LOG.warn("The spring-cloud-azure-starter-monitor Spring starter is disabled because the Application Insights Java agent is enabled."
+ " You can remove this message by using the otel.sdk.disabled=true property.");
return DISABLE_OTEL_CUSTOMER_PROVIDER;
}

AzureMonitorExporterOptions providedAzureMonitorExporterOptions = azureMonitorExporterOptions.getIfAvailable();
if (providedAzureMonitorExporterOptions != null) {
AzureMonitorAutoConfigureOptions providedAzureMonitorAutoConfigureOptions = azureMonitorAutoConfigureOptions.getIfAvailable();
if (providedAzureMonitorAutoConfigureOptions != null) {
if (System.getenv("APPLICATIONINSIGHTS_CONNECTION_STRING") == null && System.getProperty("applicationinsights.connection.string") == null && (connectionString != null && !connectionString.isEmpty())) {
LOG.warn("You have created an AzureMonitorExporterBuilder bean and set the applicationinsights.connection.string property in a .properties or .yml file."
+ " This property is ignored.");
}
// The AzureMonitor class (OpenTelemetry exporter library) is able to use the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable or the applicationinsights.connection.string JVM property
return autoConfigurationCustomizer -> AzureMonitorExporter.customize(autoConfigurationCustomizer, providedAzureMonitorExporterOptions);
return autoConfigurationCustomizer -> AzureMonitorAutoConfigure.customize(autoConfigurationCustomizer, providedAzureMonitorAutoConfigureOptions);
}

if (connectionString == null || connectionString.isEmpty()) {
Expand All @@ -83,10 +83,10 @@ AutoConfigurationCustomizerProvider autoConfigurationCustomizerProvider(@Value("
}

if (!connectionString.contains("InstrumentationKey=")) {
throw new WrongConnectionStringException(); // To fail fast, before the OpenTelemetry exporter
throw new WrongConnectionStringException(); // To fail fast, before Azure Monitor AutoConfigure
}

return autoConfigurationCustomizer -> AzureMonitorExporter.customize(autoConfigurationCustomizer, connectionString);
return autoConfigurationCustomizer -> AzureMonitorAutoConfigure.customize(autoConfigurationCustomizer, connectionString);
}

@Bean
Expand Down
Loading