diff --git a/docs/apidiffs/current_vs_latest/opentelemetry-sdk-extension-autoconfigure.txt b/docs/apidiffs/current_vs_latest/opentelemetry-sdk-extension-autoconfigure.txt index 293c00f1fbb..b940794c347 100644 --- a/docs/apidiffs/current_vs_latest/opentelemetry-sdk-extension-autoconfigure.txt +++ b/docs/apidiffs/current_vs_latest/opentelemetry-sdk-extension-autoconfigure.txt @@ -2,14 +2,14 @@ Comparing source compatibility of against *** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder (not serializable) === CLASS FILE FORMAT VERSION: 52.0 <- 52.0 +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder setComponentLoader(io.opentelemetry.sdk.autoconfigure.ComponentLoader) -+++* NEW INTERFACE: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.autoconfigure.ComponentLoader (not serializable) ++++ NEW INTERFACE: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.autoconfigure.ComponentLoader (not serializable) +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. +++ NEW SUPERCLASS: java.lang.Object - +++* NEW METHOD: PUBLIC(+) ABSTRACT(+) java.lang.Iterable load(java.lang.Class) + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) java.lang.Iterable load(java.lang.Class) GENERIC TEMPLATES: +++ T:java.lang.Object - +++* NEW METHOD: PUBLIC(+) java.util.Map loadConfigurableProviders(java.lang.Class) + +++ NEW METHOD: PUBLIC(+) java.util.Map loadConfigurableProviders(java.lang.Class) GENERIC TEMPLATES: +++ T:io.opentelemetry.sdk.autoconfigure.spi.ConfigurableProvider - +++* NEW METHOD: PUBLIC(+) java.util.Optional loadOptional(java.lang.Class) + +++ NEW METHOD: PUBLIC(+) java.util.Optional loadOptional(java.lang.Class) GENERIC TEMPLATES: +++ T:java.lang.Object - +++* NEW METHOD: PUBLIC(+) java.util.List loadOrdered(java.lang.Class) + +++ NEW METHOD: PUBLIC(+) java.util.List loadOrdered(java.lang.Class) GENERIC TEMPLATES: +++ T:io.opentelemetry.sdk.autoconfigure.spi.Ordered diff --git a/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkBuilder.java b/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkBuilder.java index c8712cfb9f6..c60b4ac5c43 100644 --- a/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkBuilder.java +++ b/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkBuilder.java @@ -569,12 +569,19 @@ private ConfigProperties getConfig() { } private ConfigProperties computeConfigProperties() { - DefaultConfigProperties properties = DefaultConfigProperties.create(propertiesSupplier.get()); - for (Function> customizer : propertiesCustomizers) { - Map overrides = customizer.apply(properties); - properties = properties.withOverrides(overrides); - } - return properties; + return spiHelper + .loadOptional(ConfigProperties.class) + .orElseGet( + () -> { + DefaultConfigProperties properties = + DefaultConfigProperties.create(propertiesSupplier.get()); + for (Function> customizer : + propertiesCustomizers) { + Map overrides = customizer.apply(properties); + properties = properties.withOverrides(overrides); + } + return properties; + }); } // Visible for testing