diff --git a/custom/src/main/java/com/solarwinds/opentelemetry/extensions/SolarwindsPropertiesSupplier.java b/custom/src/main/java/com/solarwinds/opentelemetry/extensions/SolarwindsPropertiesSupplier.java index 03f72a16..169fb2e0 100644 --- a/custom/src/main/java/com/solarwinds/opentelemetry/extensions/SolarwindsPropertiesSupplier.java +++ b/custom/src/main/java/com/solarwinds/opentelemetry/extensions/SolarwindsPropertiesSupplier.java @@ -17,7 +17,6 @@ package com.solarwinds.opentelemetry.extensions; import static com.solarwinds.opentelemetry.extensions.SharedNames.COMPONENT_NAME; -import static com.solarwinds.opentelemetry.extensions.SharedNames.SPAN_STACKTRACE_FILTER_CLASS; import static com.solarwinds.opentelemetry.extensions.config.provider.AutoConfigurationCustomizerProviderImpl.isAgentEnabled; import java.util.HashMap; @@ -33,23 +32,13 @@ public class SolarwindsPropertiesSupplier implements Supplier> { + private static final Map PROPERTIES; + + static { + PROPERTIES = new HashMap<>(); + PROPERTIES.put("otel.java.experimental.span-stacktrace.filter", SPAN_STACKTRACE_FILTER_CLASS); + PROPERTIES.put("otel.semconv-stability.opt-in", "database/dup"); + + PROPERTIES.put("otel.exporter.otlp.metrics.temporality.preference", "delta"); + PROPERTIES.put( + "otel.exporter.otlp.metrics.default.histogram.aggregation", + "base2_exponential_bucket_histogram"); + + PROPERTIES.put( + "otel.java.disabled.resource.providers", + "io.opentelemetry.sdk.autoconfigure.ServiceInstanceIdResourceProvider"); + } + + @Override + public Map get() { + return PROPERTIES; + } +} diff --git a/libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/SharedPropertiesSupplierTest.java b/libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/SharedPropertiesSupplierTest.java new file mode 100644 index 00000000..94968e7e --- /dev/null +++ b/libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/SharedPropertiesSupplierTest.java @@ -0,0 +1,54 @@ +/* + * © SolarWinds Worldwide, LLC. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.solarwinds.opentelemetry.extensions; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.Map; +import org.junit.jupiter.api.Test; + +class SharedPropertiesSupplierTest { + + private final Map properties = new SharedPropertiesSupplier().get(); + + @Test + void disablesServiceInstanceIdResourceProvider() { + assertEquals( + "io.opentelemetry.sdk.autoconfigure.ServiceInstanceIdResourceProvider", + properties.get("otel.java.disabled.resource.providers")); + } + + @Test + void usesSolarwindsSpanStacktraceFilter() { + assertEquals( + SharedNames.SPAN_STACKTRACE_FILTER_CLASS, + properties.get("otel.java.experimental.span-stacktrace.filter")); + } + + @Test + void configuresDeltaTemporalityAndExponentialHistograms() { + assertEquals("delta", properties.get("otel.exporter.otlp.metrics.temporality.preference")); + assertEquals( + "base2_exponential_bucket_histogram", + properties.get("otel.exporter.otlp.metrics.default.histogram.aggregation")); + } + + @Test + void optsIntoDuplicateDatabaseSemconv() { + assertEquals("database/dup", properties.get("otel.semconv-stability.opt-in")); + } +}