From df2d1bbf8a689453ed18f1ef0b97170d9abb6897 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Wed, 26 Jun 2024 17:52:38 +0200 Subject: [PATCH 01/23] remove need for reflection --- .../JavaHttpClientInstrumenterFactory.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 instrumentation/java-http-client/library/src/main/java/io/opentelemetry/instrumentation/httpclient/internal/JavaHttpClientInstrumenterFactory.java diff --git a/instrumentation/java-http-client/library/src/main/java/io/opentelemetry/instrumentation/httpclient/internal/JavaHttpClientInstrumenterFactory.java b/instrumentation/java-http-client/library/src/main/java/io/opentelemetry/instrumentation/httpclient/internal/JavaHttpClientInstrumenterFactory.java new file mode 100644 index 000000000000..c6f47401f04a --- /dev/null +++ b/instrumentation/java-http-client/library/src/main/java/io/opentelemetry/instrumentation/httpclient/internal/JavaHttpClientInstrumenterFactory.java @@ -0,0 +1,27 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.httpclient.internal; + +import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.instrumentation.api.incubator.builder.internal.DefaultHttpClientInstrumenterBuilder; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; + +/** + * This class is internal and is hence not for public use. Its APIs are unstable and can change at + * any time. + */ +public class JavaHttpClientInstrumenterFactory { + private JavaHttpClientInstrumenterFactory() {} + + private static final String INSTRUMENTATION_NAME = "io.opentelemetry.java-http-client"; + + public static DefaultHttpClientInstrumenterBuilder> create( + OpenTelemetry openTelemetry) { + return new DefaultHttpClientInstrumenterBuilder<>( + INSTRUMENTATION_NAME, openTelemetry, JavaHttpClientAttributesGetter.INSTANCE); + } +} From 92f5d61277715b95f25caa71e38a67b9d1d5753e Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Wed, 26 Jun 2024 18:16:23 +0200 Subject: [PATCH 02/23] remove need for reflection --- .../JavaHttpClientInstrumenterFactory.java | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100644 instrumentation/java-http-client/library/src/main/java/io/opentelemetry/instrumentation/httpclient/internal/JavaHttpClientInstrumenterFactory.java diff --git a/instrumentation/java-http-client/library/src/main/java/io/opentelemetry/instrumentation/httpclient/internal/JavaHttpClientInstrumenterFactory.java b/instrumentation/java-http-client/library/src/main/java/io/opentelemetry/instrumentation/httpclient/internal/JavaHttpClientInstrumenterFactory.java deleted file mode 100644 index c6f47401f04a..000000000000 --- a/instrumentation/java-http-client/library/src/main/java/io/opentelemetry/instrumentation/httpclient/internal/JavaHttpClientInstrumenterFactory.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.instrumentation.httpclient.internal; - -import io.opentelemetry.api.OpenTelemetry; -import io.opentelemetry.instrumentation.api.incubator.builder.internal.DefaultHttpClientInstrumenterBuilder; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; - -/** - * This class is internal and is hence not for public use. Its APIs are unstable and can change at - * any time. - */ -public class JavaHttpClientInstrumenterFactory { - private JavaHttpClientInstrumenterFactory() {} - - private static final String INSTRUMENTATION_NAME = "io.opentelemetry.java-http-client"; - - public static DefaultHttpClientInstrumenterBuilder> create( - OpenTelemetry openTelemetry) { - return new DefaultHttpClientInstrumenterBuilder<>( - INSTRUMENTATION_NAME, openTelemetry, JavaHttpClientAttributesGetter.INSTANCE); - } -} From 4a70523ad67bbcbb4587121e3639d6b5d5c0f9a7 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Mon, 17 Jun 2024 07:01:09 +0200 Subject: [PATCH 03/23] use ConfigPropertiesBridge for spring starter --- .../internal/config/CommonConfigSetter.java | 24 ++++ .../internal/config/CoreCommonConfig.java | 125 ++++++++++++++++++ .../config/CoreInstrumentationConfig.java | 110 +++++++++++++++ .../internal/config}/EnduserConfig.java | 4 +- .../HttpClientInstrumenterBuilder.java | 40 ++++++ .../javaagent-unit-tests/build.gradle.kts | 1 + .../extannotations/IncludeTest.java | 4 +- .../ExternalAnnotationInstrumentation.java | 3 +- .../log4j/appender/v2_17/Log4jHelper.java | 3 +- .../appender/v1_0/LogbackSingletons.java | 3 +- .../micrometer/v1_5/MicrometerSingletons.java | 3 +- .../web/RestTemplateBeanPostProcessor.java | 12 +- .../web/RestTemplateInstrumentation.java | 12 +- ...ngWebInstrumentationAutoConfiguration.java | 11 +- .../internal/properties/CommonConfigUtil.java | 21 +++ .../properties/ConfigPropertiesBridge.java | 109 +++++++++++++++ ...itional-spring-configuration-metadata.json | 27 ++++ ...bInstrumentationAutoConfigurationTest.java | 6 + .../bootstrap/internal/CommonConfig.java | 120 +---------------- .../internal/DeprecatedConfigProperties.java | 7 +- .../internal/EmptyInstrumentationConfig.java | 3 +- .../internal/ExperimentalConfig.java | 5 +- .../internal/InstrumentationConfig.java | 111 ++-------------- javaagent-tooling/build.gradle.kts | 1 + .../config/ConfigPropertiesBridge.java | 4 +- muzzle/build.gradle.kts | 1 + 26 files changed, 530 insertions(+), 240 deletions(-) create mode 100644 instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CommonConfigSetter.java create mode 100644 instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CoreCommonConfig.java create mode 100644 instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CoreInstrumentationConfig.java rename {javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal => instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config}/EnduserConfig.java (96%) create mode 100644 instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/instrumenter/HttpClientInstrumenterBuilder.java create mode 100644 instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/CommonConfigUtil.java create mode 100644 instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/ConfigPropertiesBridge.java diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CommonConfigSetter.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CommonConfigSetter.java new file mode 100644 index 000000000000..0bce3e18e6bd --- /dev/null +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CommonConfigSetter.java @@ -0,0 +1,24 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.api.incubator.internal.config; + +import java.util.function.Consumer; +import java.util.function.Supplier; + +/** + * This class is internal and is hence not for public use. Its APIs are unstable and can change at + * any time. + */ +public final class CommonConfigSetter { + private CommonConfigSetter() {} + + public static void set(Supplier supplier, Consumer consumer) { + T t = supplier.get(); + if (t != null) { + consumer.accept(t); + } + } +} diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CoreCommonConfig.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CoreCommonConfig.java new file mode 100644 index 000000000000..7bf1b58f2af6 --- /dev/null +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CoreCommonConfig.java @@ -0,0 +1,125 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.api.incubator.internal.config; + +import static java.util.Collections.emptyMap; + +import io.opentelemetry.instrumentation.api.incubator.log.LoggingContextConstants; +import io.opentelemetry.instrumentation.api.incubator.semconv.net.PeerServiceResolver; +import io.opentelemetry.instrumentation.api.internal.HttpConstants; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * This class is internal and is hence not for public use. Its APIs are unstable and can change at + * any time. + */ +public final class CoreCommonConfig { + + private final PeerServiceResolver peerServiceResolver; + private final List clientRequestHeaders; + private final List clientResponseHeaders; + private final List serverRequestHeaders; + private final List serverResponseHeaders; + private final Set knownHttpRequestMethods; + private final EnduserConfig enduserConfig; + private final boolean statementSanitizationEnabled; + private final boolean emitExperimentalHttpClientTelemetry; + private final boolean emitExperimentalHttpServerTelemetry; + private final String loggingTraceIdKey; + private final String loggingSpanIdKey; + private final String loggingTraceFlagsKey; + + public CoreCommonConfig(CoreInstrumentationConfig config) { + peerServiceResolver = + PeerServiceResolver.create( + config.getMap("otel.instrumentation.common.peer-service-mapping", emptyMap())); + + clientRequestHeaders = + config.getList("otel.instrumentation.http.client.capture-request-headers"); + clientResponseHeaders = + config.getList("otel.instrumentation.http.client.capture-response-headers"); + serverRequestHeaders = + config.getList("otel.instrumentation.http.server.capture-request-headers"); + serverResponseHeaders = + config.getList("otel.instrumentation.http.server.capture-response-headers"); + knownHttpRequestMethods = + new HashSet<>( + config.getList( + "otel.instrumentation.http.known-methods", + new ArrayList<>(HttpConstants.KNOWN_METHODS))); + statementSanitizationEnabled = + config.getBoolean("otel.instrumentation.common.db-statement-sanitizer.enabled", true); + emitExperimentalHttpClientTelemetry = + config.getBoolean("otel.instrumentation.http.client.emit-experimental-telemetry", false); + emitExperimentalHttpServerTelemetry = + config.getBoolean("otel.instrumentation.http.server.emit-experimental-telemetry", false); + enduserConfig = new EnduserConfig(config); + loggingTraceIdKey = + config.getString( + "otel.instrumentation.common.logging.trace-id", LoggingContextConstants.TRACE_ID); + loggingSpanIdKey = + config.getString( + "otel.instrumentation.common.logging.span-id", LoggingContextConstants.SPAN_ID); + loggingTraceFlagsKey = + config.getString( + "otel.instrumentation.common.logging.trace-flags", LoggingContextConstants.TRACE_FLAGS); + } + + public PeerServiceResolver getPeerServiceResolver() { + return peerServiceResolver; + } + + public List getClientRequestHeaders() { + return clientRequestHeaders; + } + + public List getClientResponseHeaders() { + return clientResponseHeaders; + } + + public List getServerRequestHeaders() { + return serverRequestHeaders; + } + + public List getServerResponseHeaders() { + return serverResponseHeaders; + } + + public Set getKnownHttpRequestMethods() { + return knownHttpRequestMethods; + } + + public EnduserConfig getEnduserConfig() { + return enduserConfig; + } + + public boolean isStatementSanitizationEnabled() { + return statementSanitizationEnabled; + } + + public boolean shouldEmitExperimentalHttpClientTelemetry() { + return emitExperimentalHttpClientTelemetry; + } + + public boolean shouldEmitExperimentalHttpServerTelemetry() { + return emitExperimentalHttpServerTelemetry; + } + + public String getTraceIdKey() { + return loggingTraceIdKey; + } + + public String getSpanIdKey() { + return loggingSpanIdKey; + } + + public String getTraceFlagsKey() { + return loggingTraceFlagsKey; + } +} diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CoreInstrumentationConfig.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CoreInstrumentationConfig.java new file mode 100644 index 000000000000..e375cba5da3e --- /dev/null +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CoreInstrumentationConfig.java @@ -0,0 +1,110 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.api.incubator.internal.config; + +import static java.util.Collections.emptyList; + +import java.time.Duration; +import java.util.List; +import java.util.Map; +import javax.annotation.Nullable; + +/** + * Represents the global instrumentation configuration consisting of system properties, environment + * variables, contents of the agent configuration file and properties defined by the {@code + * ConfigPropertySource} SPI implementations. + * + *

In case any {@code get*()} method variant gets called for the same property more than once + * (e.g. each time an advice class executes) it is suggested to cache the result instead of + * repeatedly calling {@link CoreInstrumentationConfig}. Instrumentation configuration does not + * change during the runtime so retrieving the property once and storing its result in a static + * final field allows JIT to do its magic and remove some code branches. + * + *

This class is internal and is hence not for public use. Its APIs are unstable and can change + * at any time. + */ +public interface CoreInstrumentationConfig { + + /** + * Returns a string-valued configuration property or {@code null} if a property with name {@code + * name} has not been configured. + */ + @Nullable + String getString(String name); + + /** + * Returns a string-valued configuration property or {@code defaultValue} if a property with name + * {@code name} has not been configured. + */ + String getString(String name, String defaultValue); + + /** + * Returns a boolean-valued configuration property or {@code defaultValue} if a property with name + * {@code name} has not been configured. + */ + boolean getBoolean(String name, boolean defaultValue); + + /** + * Returns an integer-valued configuration property or {@code defaultValue} if a property with + * name {@code name} has not been configured or when parsing has failed. + */ + int getInt(String name, int defaultValue); + + /** + * Returns a long-valued configuration property or {@code defaultValue} if a property with name + * {@code name} has not been configured or when parsing has failed. + */ + long getLong(String name, long defaultValue); + + /** + * Returns a double-valued configuration property or {@code defaultValue} if a property with name + * {@code name} has not been configured or when parsing has failed. + */ + double getDouble(String name, double defaultValue); + + /** + * Returns a duration-valued configuration property or {@code defaultValue} if a property with + * name {@code name} has not been configured or when parsing has failed. + * + *

Durations can be of the form "{number}{unit}", where unit is one of: + * + *

    + *
  • ms + *
  • s + *
  • m + *
  • h + *
  • d + *
+ * + *

If no unit is specified, milliseconds is the assumed duration unit. + * + *

Examples: 10s, 20ms, 5000 + */ + Duration getDuration(String name, Duration defaultValue); + + /** + * This is the same as calling {@code getList(String, List)} with the defaultValue equal to the + * emptyList()/ + */ + default List getList(String name) { + return getList(name, emptyList()); + } + + /** + * Returns a list-valued configuration property or {@code defaultValue} if a property with name + * {@code name} has not been configured. The format of the original value must be comma-separated, + * e.g. {@code one,two,three}. The returned list is unmodifiable. + */ + List getList(String name, List defaultValue); + + /** + * Returns a map-valued configuration property or {@code defaultValue} if a property with name + * {@code name} has not been configured or when parsing has failed. The format of the original + * value must be comma-separated for each key, with an '=' separating the key and value, e.g. + * {@code key=value,anotherKey=anotherValue}. The returned map is unmodifiable. + */ + Map getMap(String name, Map defaultValue); +} diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/EnduserConfig.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/EnduserConfig.java similarity index 96% rename from javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/EnduserConfig.java rename to instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/EnduserConfig.java index fbde1c90aaa2..9f56241aed18 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/EnduserConfig.java +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/EnduserConfig.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.bootstrap.internal; +package io.opentelemetry.instrumentation.api.incubator.internal.config; import java.util.Objects; @@ -39,7 +39,7 @@ public class EnduserConfig { private final boolean roleEnabled; private final boolean scopeEnabled; - EnduserConfig(InstrumentationConfig instrumentationConfig) { + EnduserConfig(CoreInstrumentationConfig instrumentationConfig) { Objects.requireNonNull(instrumentationConfig, "instrumentationConfig must not be null"); /* diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/instrumenter/HttpClientInstrumenterBuilder.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/instrumenter/HttpClientInstrumenterBuilder.java new file mode 100644 index 000000000000..a2e12e1ed1f1 --- /dev/null +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/instrumenter/HttpClientInstrumenterBuilder.java @@ -0,0 +1,40 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.api.incubator.internal.instrumenter; + +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import io.opentelemetry.instrumentation.api.incubator.builder.AbstractHttpClientTelemetryBuilder; +import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreCommonConfig; +import java.util.function.Consumer; +import java.util.function.Supplier; + +/** + * This class is internal and is hence not for public use. Its APIs are unstable and can change at + * any time. + */ +public class HttpClientInstrumenterBuilder { + private HttpClientInstrumenterBuilder() {} + + @CanIgnoreReturnValue + public static > T configure( + CoreCommonConfig config, T builder) { + set(config::getKnownHttpRequestMethods, builder::setKnownMethods); + set(config::getClientRequestHeaders, builder::setCapturedRequestHeaders); + set(config::getClientResponseHeaders, builder::setCapturedResponseHeaders); + set(config::getPeerServiceResolver, builder::setPeerServiceResolver); + set( + config::shouldEmitExperimentalHttpClientTelemetry, + builder::setEmitExperimentalHttpClientMetrics); + return builder; + } + + private static void set(Supplier supplier, Consumer consumer) { + T t = supplier.get(); + if (t != null) { + consumer.accept(t); + } + } +} diff --git a/instrumentation/external-annotations/javaagent-unit-tests/build.gradle.kts b/instrumentation/external-annotations/javaagent-unit-tests/build.gradle.kts index 364911c6d0df..7ce37d7de0b3 100644 --- a/instrumentation/external-annotations/javaagent-unit-tests/build.gradle.kts +++ b/instrumentation/external-annotations/javaagent-unit-tests/build.gradle.kts @@ -4,6 +4,7 @@ plugins { dependencies { testImplementation(project(":instrumentation-api")) + testImplementation(project(":instrumentation-api-incubator")) testImplementation(project(":javaagent-extension-api")) testImplementation(project(":javaagent-tooling")) testImplementation(project(":instrumentation:external-annotations:javaagent")) diff --git a/instrumentation/external-annotations/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/extannotations/IncludeTest.java b/instrumentation/external-annotations/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/extannotations/IncludeTest.java index b1f096ced00a..4344ffd61a60 100644 --- a/instrumentation/external-annotations/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/extannotations/IncludeTest.java +++ b/instrumentation/external-annotations/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/extannotations/IncludeTest.java @@ -9,7 +9,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.when; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; @@ -25,7 +25,7 @@ @ExtendWith(MockitoExtension.class) class IncludeTest { - @Mock InstrumentationConfig config; + @Mock CoreInstrumentationConfig config; @ParameterizedTest @MethodSource("provideArguments") diff --git a/instrumentation/external-annotations/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extannotations/ExternalAnnotationInstrumentation.java b/instrumentation/external-annotations/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extannotations/ExternalAnnotationInstrumentation.java index 6b231d97aa5c..2e19864a8bdc 100644 --- a/instrumentation/external-annotations/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extannotations/ExternalAnnotationInstrumentation.java +++ b/instrumentation/external-annotations/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extannotations/ExternalAnnotationInstrumentation.java @@ -17,6 +17,7 @@ import io.opentelemetry.context.Context; import io.opentelemetry.context.Scope; +import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; import io.opentelemetry.instrumentation.api.incubator.semconv.util.ClassAndMethod; import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge; import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; @@ -113,7 +114,7 @@ public void transform(TypeTransformer transformer) { } // visible for testing - static Set configureAdditionalTraceAnnotations(InstrumentationConfig config) { + static Set configureAdditionalTraceAnnotations(CoreInstrumentationConfig config) { String configString = config.getString(TRACE_ANNOTATIONS_CONFIG); if (configString == null) { return Collections.unmodifiableSet(new HashSet<>(DEFAULT_ANNOTATIONS)); diff --git a/instrumentation/log4j/log4j-appender-2.17/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v2_17/Log4jHelper.java b/instrumentation/log4j/log4j-appender-2.17/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v2_17/Log4jHelper.java index 3c228dafa1f5..5d3807e0673a 100644 --- a/instrumentation/log4j/log4j-appender-2.17/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v2_17/Log4jHelper.java +++ b/instrumentation/log4j/log4j-appender-2.17/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v2_17/Log4jHelper.java @@ -9,6 +9,7 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.logs.LogRecordBuilder; +import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; import io.opentelemetry.instrumentation.log4j.appender.v2_17.internal.ContextDataAccessor; import io.opentelemetry.instrumentation.log4j.appender.v2_17.internal.LogEventMapper; import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; @@ -30,7 +31,7 @@ public final class Log4jHelper { private static final boolean captureExperimentalAttributes; static { - InstrumentationConfig config = InstrumentationConfig.get(); + CoreInstrumentationConfig config = InstrumentationConfig.get(); captureExperimentalAttributes = config.getBoolean("otel.instrumentation.log4j-appender.experimental-log-attributes", false); diff --git a/instrumentation/logback/logback-appender-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackSingletons.java b/instrumentation/logback/logback-appender-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackSingletons.java index 23d3ff8f44ab..981852c54cbf 100644 --- a/instrumentation/logback/logback-appender-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackSingletons.java +++ b/instrumentation/logback/logback-appender-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackSingletons.java @@ -7,6 +7,7 @@ import static java.util.Collections.emptyList; +import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; import io.opentelemetry.instrumentation.logback.appender.v1_0.internal.LoggingEventMapper; import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; import java.util.List; @@ -16,7 +17,7 @@ public final class LogbackSingletons { private static final LoggingEventMapper mapper; static { - InstrumentationConfig config = InstrumentationConfig.get(); + CoreInstrumentationConfig config = InstrumentationConfig.get(); boolean captureExperimentalAttributes = config.getBoolean( diff --git a/instrumentation/micrometer/micrometer-1.5/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/v1_5/MicrometerSingletons.java b/instrumentation/micrometer/micrometer-1.5/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/v1_5/MicrometerSingletons.java index 8416c35fe9f2..860dcb918024 100644 --- a/instrumentation/micrometer/micrometer-1.5/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/v1_5/MicrometerSingletons.java +++ b/instrumentation/micrometer/micrometer-1.5/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/v1_5/MicrometerSingletons.java @@ -7,6 +7,7 @@ import io.micrometer.core.instrument.MeterRegistry; import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; import io.opentelemetry.instrumentation.micrometer.v1_5.OpenTelemetryMeterRegistry; import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; @@ -15,7 +16,7 @@ public final class MicrometerSingletons { private static final MeterRegistry METER_REGISTRY; static { - InstrumentationConfig config = InstrumentationConfig.get(); + CoreInstrumentationConfig config = InstrumentationConfig.get(); METER_REGISTRY = OpenTelemetryMeterRegistry.builder(GlobalOpenTelemetry.get()) .setPrometheusMode( diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateBeanPostProcessor.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateBeanPostProcessor.java index 43d0c52bac38..096e97c83061 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateBeanPostProcessor.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateBeanPostProcessor.java @@ -6,6 +6,7 @@ package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.web; import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.web.client.RestTemplate; @@ -14,8 +15,13 @@ final class RestTemplateBeanPostProcessor implements BeanPostProcessor { private final ObjectProvider openTelemetryProvider; - RestTemplateBeanPostProcessor(ObjectProvider openTelemetryProvider) { + private final ObjectProvider configPropertiesProvider; + + RestTemplateBeanPostProcessor( + ObjectProvider openTelemetryProvider, + ObjectProvider configPropertiesProvider) { this.openTelemetryProvider = openTelemetryProvider; + this.configPropertiesProvider = configPropertiesProvider; } @Override @@ -25,6 +31,8 @@ public Object postProcessAfterInitialization(Object bean, String beanName) { } return RestTemplateInstrumentation.addIfNotPresent( - (RestTemplate) bean, openTelemetryProvider.getObject()); + (RestTemplate) bean, + openTelemetryProvider.getObject(), + configPropertiesProvider.getObject()); } } diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java index 58c266f09e8c..89f5b109bc82 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java @@ -7,7 +7,10 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.instrumentation.api.incubator.internal.instrumenter.HttpClientInstrumenterBuilder; +import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.CommonConfigUtil; import io.opentelemetry.instrumentation.spring.web.v3_1.SpringWebTelemetry; +import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import java.util.List; import org.springframework.http.client.ClientHttpRequestInterceptor; import org.springframework.web.client.RestTemplate; @@ -17,9 +20,14 @@ class RestTemplateInstrumentation { private RestTemplateInstrumentation() {} @CanIgnoreReturnValue - static RestTemplate addIfNotPresent(RestTemplate restTemplate, OpenTelemetry openTelemetry) { + static RestTemplate addIfNotPresent( + RestTemplate restTemplate, OpenTelemetry openTelemetry, ConfigProperties config) { + ClientHttpRequestInterceptor instrumentationInterceptor = - SpringWebTelemetry.create(openTelemetry).newInterceptor(); + HttpClientInstrumenterBuilder.configure( + CommonConfigUtil.getCommonConfig(config), SpringWebTelemetry.builder(openTelemetry)) + .build() + .newInterceptor(); List restTemplateInterceptors = restTemplate.getInterceptors(); if (restTemplateInterceptors.stream() diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/SpringWebInstrumentationAutoConfiguration.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/SpringWebInstrumentationAutoConfiguration.java index 961ee82fea13..7fed019fe527 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/SpringWebInstrumentationAutoConfiguration.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/SpringWebInstrumentationAutoConfiguration.java @@ -7,6 +7,7 @@ import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.instrumentation.spring.autoconfigure.internal.ConditionalOnEnabledInstrumentation; +import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.web.client.RestTemplateCustomizer; @@ -29,15 +30,17 @@ public SpringWebInstrumentationAutoConfiguration() {} // static to avoid "is not eligible for getting processed by all BeanPostProcessors" warning @Bean static RestTemplateBeanPostProcessor otelRestTemplateBeanPostProcessor( - ObjectProvider openTelemetryProvider) { - return new RestTemplateBeanPostProcessor(openTelemetryProvider); + ObjectProvider openTelemetryProvider, + ObjectProvider configPropertiesProvider) { + return new RestTemplateBeanPostProcessor(openTelemetryProvider, configPropertiesProvider); } @Bean RestTemplateCustomizer otelRestTemplateCustomizer( - ObjectProvider openTelemetryProvider) { + ObjectProvider openTelemetryProvider, + ObjectProvider configPropertiesProvider) { return restTemplate -> RestTemplateInstrumentation.addIfNotPresent( - restTemplate, openTelemetryProvider.getObject()); + restTemplate, openTelemetryProvider.getObject(), configPropertiesProvider.getObject()); } } diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/CommonConfigUtil.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/CommonConfigUtil.java new file mode 100644 index 000000000000..a02e281d5655 --- /dev/null +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/CommonConfigUtil.java @@ -0,0 +1,21 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties; + +import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreCommonConfig; +import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; + +/** + * This class is internal and is hence not for public use. Its APIs are unstable and can change at + * any time. + */ +public class CommonConfigUtil { + private CommonConfigUtil() {} + + public static CoreCommonConfig getCommonConfig(ConfigProperties config) { + return new CoreCommonConfig(new ConfigPropertiesBridge(config)); + } +} diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/ConfigPropertiesBridge.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/ConfigPropertiesBridge.java new file mode 100644 index 000000000000..37a7bbbf9b4f --- /dev/null +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/ConfigPropertiesBridge.java @@ -0,0 +1,109 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties; + +import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; +import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; +import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; +import java.time.Duration; +import java.util.List; +import java.util.Map; +import javax.annotation.Nullable; + +/** + * This class is internal and is hence not for public use. Its APIs are unstable and can change at + * any time. + */ +public final class ConfigPropertiesBridge implements CoreInstrumentationConfig { + + private final ConfigProperties configProperties; + + public ConfigPropertiesBridge(ConfigProperties configProperties) { + this.configProperties = configProperties; + } + + @Nullable + @Override + public String getString(String name) { + try { + return configProperties.getString(name); + } catch (ConfigurationException ignored) { + return null; + } + } + + @Override + public String getString(String name, String defaultValue) { + try { + return configProperties.getString(name, defaultValue); + } catch (ConfigurationException ignored) { + return defaultValue; + } + } + + @Override + public boolean getBoolean(String name, boolean defaultValue) { + try { + return configProperties.getBoolean(name, defaultValue); + } catch (ConfigurationException ignored) { + return defaultValue; + } + } + + @Override + public int getInt(String name, int defaultValue) { + try { + return configProperties.getInt(name, defaultValue); + } catch (ConfigurationException ignored) { + return defaultValue; + } + } + + @Override + public long getLong(String name, long defaultValue) { + try { + return configProperties.getLong(name, defaultValue); + } catch (ConfigurationException ignored) { + return defaultValue; + } + } + + @Override + public double getDouble(String name, double defaultValue) { + try { + return configProperties.getDouble(name, defaultValue); + } catch (ConfigurationException ignored) { + return defaultValue; + } + } + + @Override + public Duration getDuration(String name, Duration defaultValue) { + try { + return configProperties.getDuration(name, defaultValue); + } catch (ConfigurationException ignored) { + return defaultValue; + } + } + + @Override + public List getList(String name, List defaultValue) { + try { + return configProperties.getList(name, defaultValue); + } catch (ConfigurationException ignored) { + return defaultValue; + } + } + + @Override + public Map getMap(String name, Map defaultValue) { + try { + return configProperties.getMap(name, defaultValue); + } catch (ConfigurationException ignored) { + return defaultValue; + } + } +} diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 9bea00f40e19..1bd1e0c59f07 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -279,6 +279,33 @@ "description": "Enables the DB statement sanitization.", "defaultValue": true }, + { + "name": "otel.instrumentation.common.peer-service-mapping", + "type": "java.util.Map", + "description": "Used to specify a mapping from host names or IP addresses to peer services, as a comma-separated list of host_or_ip=user_assigned_name pairs. The peer service is added as an attribute to a span whose host or IP address match the mapping. See https://opentelemetry.io/docs/zero-code/java/agent/configuration/#peer-service-name." + }, + { + "name": "otel.instrumentation.http.client.capture-request-headers", + "type": "java.util.List", + "description": "List of HTTP request headers to capture in HTTP clients." + }, + { + "name": "otel.instrumentation.http.client.capture-response-headers", + "type": "java.util.List", + "description": "List of HTTP response headers to capture in HTTP clients." + }, + { + "name": "otel.instrumentation.http.client.emit-experimental-telemetry", + "type": "java.lang.Boolean", + "description": "Enable the capture of experimental HTTP client telemetry. Add the http.request.body.size and http.response.body.size> attributes to spans, and record the http.client.request.size and http.client.response.size metrics.", + "defaultValue": false + }, + { + "name": "otel.instrumentation.http.known-methods", + "type": "java.util.List", + "description": "Configures the instrumentation to recognize an alternative set of HTTP request methods. All other methods will be treated as _OTHER.", + "defaultValue": "CONNECT,DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT,TRACE" + }, { "name": "otel.instrumentation.jdbc.enabled", "type": "java.lang.Boolean", diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/SpringWebInstrumentationAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/SpringWebInstrumentationAutoConfigurationTest.java index 67b4e4e75a37..5dd0b973a345 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/SpringWebInstrumentationAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/SpringWebInstrumentationAutoConfigurationTest.java @@ -8,6 +8,9 @@ import static org.assertj.core.api.Assertions.assertThat; import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; +import io.opentelemetry.sdk.autoconfigure.spi.internal.DefaultConfigProperties; +import java.util.Collections; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; @@ -18,6 +21,9 @@ class SpringWebInstrumentationAutoConfigurationTest { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withBean(OpenTelemetry.class, OpenTelemetry::noop) + .withBean( + ConfigProperties.class, + () -> DefaultConfigProperties.createFromMap(Collections.emptyMap())) .withBean(RestTemplate.class, RestTemplate::new) .withConfiguration( AutoConfigurations.of(SpringWebInstrumentationAutoConfiguration.class)); diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java index f6d5a5479001..6ec149352bca 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java @@ -5,127 +5,19 @@ package io.opentelemetry.javaagent.bootstrap.internal; -import static java.util.Collections.emptyMap; - -import io.opentelemetry.instrumentation.api.incubator.log.LoggingContextConstants; -import io.opentelemetry.instrumentation.api.incubator.semconv.net.PeerServiceResolver; -import io.opentelemetry.instrumentation.api.internal.HttpConstants; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreCommonConfig; /** * This class is internal and is hence not for public use. Its APIs are unstable and can change at * any time. */ -public final class CommonConfig { +public class CommonConfig { + private CommonConfig() {} - private static final CommonConfig instance = new CommonConfig(InstrumentationConfig.get()); + private static final CoreCommonConfig instance = + new CoreCommonConfig(InstrumentationConfig.get()); - public static CommonConfig get() { + public static CoreCommonConfig get() { return instance; } - - private final PeerServiceResolver peerServiceResolver; - private final List clientRequestHeaders; - private final List clientResponseHeaders; - private final List serverRequestHeaders; - private final List serverResponseHeaders; - private final Set knownHttpRequestMethods; - private final EnduserConfig enduserConfig; - private final boolean statementSanitizationEnabled; - private final boolean emitExperimentalHttpClientTelemetry; - private final boolean emitExperimentalHttpServerTelemetry; - private final String loggingTraceIdKey; - private final String loggingSpanIdKey; - private final String loggingTraceFlagsKey; - - CommonConfig(InstrumentationConfig config) { - peerServiceResolver = - PeerServiceResolver.create( - config.getMap("otel.instrumentation.common.peer-service-mapping", emptyMap())); - - clientRequestHeaders = - config.getList("otel.instrumentation.http.client.capture-request-headers"); - clientResponseHeaders = - config.getList("otel.instrumentation.http.client.capture-response-headers"); - serverRequestHeaders = - config.getList("otel.instrumentation.http.server.capture-request-headers"); - serverResponseHeaders = - config.getList("otel.instrumentation.http.server.capture-response-headers"); - knownHttpRequestMethods = - new HashSet<>( - config.getList( - "otel.instrumentation.http.known-methods", - new ArrayList<>(HttpConstants.KNOWN_METHODS))); - statementSanitizationEnabled = - config.getBoolean("otel.instrumentation.common.db-statement-sanitizer.enabled", true); - emitExperimentalHttpClientTelemetry = - config.getBoolean("otel.instrumentation.http.client.emit-experimental-telemetry", false); - emitExperimentalHttpServerTelemetry = - config.getBoolean("otel.instrumentation.http.server.emit-experimental-telemetry", false); - enduserConfig = new EnduserConfig(config); - loggingTraceIdKey = - config.getString( - "otel.instrumentation.common.logging.trace-id", LoggingContextConstants.TRACE_ID); - loggingSpanIdKey = - config.getString( - "otel.instrumentation.common.logging.span-id", LoggingContextConstants.SPAN_ID); - loggingTraceFlagsKey = - config.getString( - "otel.instrumentation.common.logging.trace-flags", LoggingContextConstants.TRACE_FLAGS); - } - - public PeerServiceResolver getPeerServiceResolver() { - return peerServiceResolver; - } - - public List getClientRequestHeaders() { - return clientRequestHeaders; - } - - public List getClientResponseHeaders() { - return clientResponseHeaders; - } - - public List getServerRequestHeaders() { - return serverRequestHeaders; - } - - public List getServerResponseHeaders() { - return serverResponseHeaders; - } - - public Set getKnownHttpRequestMethods() { - return knownHttpRequestMethods; - } - - public EnduserConfig getEnduserConfig() { - return enduserConfig; - } - - public boolean isStatementSanitizationEnabled() { - return statementSanitizationEnabled; - } - - public boolean shouldEmitExperimentalHttpClientTelemetry() { - return emitExperimentalHttpClientTelemetry; - } - - public boolean shouldEmitExperimentalHttpServerTelemetry() { - return emitExperimentalHttpServerTelemetry; - } - - public String getTraceIdKey() { - return loggingTraceIdKey; - } - - public String getSpanIdKey() { - return loggingSpanIdKey; - } - - public String getTraceFlagsKey() { - return loggingTraceFlagsKey; - } } diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/DeprecatedConfigProperties.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/DeprecatedConfigProperties.java index 002bf787c99c..be9dd9247139 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/DeprecatedConfigProperties.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/DeprecatedConfigProperties.java @@ -8,6 +8,7 @@ import static java.util.Collections.emptyList; import static java.util.logging.Level.WARNING; +import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; import java.util.List; import java.util.logging.Logger; @@ -21,7 +22,7 @@ public final class DeprecatedConfigProperties { private static final Logger logger = Logger.getLogger(DeprecatedConfigProperties.class.getName()); public static boolean getBoolean( - InstrumentationConfig config, + CoreInstrumentationConfig config, String deprecatedPropertyName, String newPropertyName, boolean defaultValue) { @@ -31,14 +32,14 @@ public static boolean getBoolean( } public static List getList( - InstrumentationConfig config, String deprecatedPropertyName, String newPropertyName) { + CoreInstrumentationConfig config, String deprecatedPropertyName, String newPropertyName) { warnIfUsed(config, deprecatedPropertyName, newPropertyName); List value = config.getList(deprecatedPropertyName, emptyList()); return config.getList(newPropertyName, value); } private static void warnIfUsed( - InstrumentationConfig config, String deprecatedPropertyName, String newPropertyName) { + CoreInstrumentationConfig config, String deprecatedPropertyName, String newPropertyName) { if (config.getString(deprecatedPropertyName) != null) { logger.log( WARNING, diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/EmptyInstrumentationConfig.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/EmptyInstrumentationConfig.java index ede916b3b6ad..1942c6aaa191 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/EmptyInstrumentationConfig.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/EmptyInstrumentationConfig.java @@ -5,12 +5,13 @@ package io.opentelemetry.javaagent.bootstrap.internal; +import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; import java.time.Duration; import java.util.List; import java.util.Map; import javax.annotation.Nullable; -final class EmptyInstrumentationConfig extends InstrumentationConfig { +final class EmptyInstrumentationConfig implements CoreInstrumentationConfig { @Nullable @Override diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/ExperimentalConfig.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/ExperimentalConfig.java index fe3779ab2550..255ce114706b 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/ExperimentalConfig.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/ExperimentalConfig.java @@ -7,6 +7,7 @@ import static java.util.Collections.emptyList; +import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; import java.util.List; /** @@ -18,7 +19,7 @@ public final class ExperimentalConfig { private static final ExperimentalConfig instance = new ExperimentalConfig(InstrumentationConfig.get()); - private final InstrumentationConfig config; + private final CoreInstrumentationConfig config; private final List messagingHeaders; /** Returns the global agent configuration. */ @@ -26,7 +27,7 @@ public static ExperimentalConfig get() { return instance; } - public ExperimentalConfig(InstrumentationConfig config) { + public ExperimentalConfig(CoreInstrumentationConfig config) { this.config = config; messagingHeaders = config.getList("otel.instrumentation.messaging.experimental.capture-headers", emptyList()); diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/InstrumentationConfig.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/InstrumentationConfig.java index fc4b7aabc6c2..fc1c7fb75095 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/InstrumentationConfig.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/InstrumentationConfig.java @@ -5,37 +5,24 @@ package io.opentelemetry.javaagent.bootstrap.internal; -import static java.util.Collections.emptyList; import static java.util.Objects.requireNonNull; -import java.time.Duration; -import java.util.List; -import java.util.Map; +import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; import java.util.logging.Logger; -import javax.annotation.Nullable; /** - * Represents the global instrumentation configuration consisting of system properties, environment - * variables, contents of the agent configuration file and properties defined by the {@code - * ConfigPropertySource} SPI implementations. - * - *

In case any {@code get*()} method variant gets called for the same property more than once - * (e.g. each time an advice class executes) it is suggested to cache the result instead of - * repeatedly calling {@link InstrumentationConfig}. Instrumentation configuration does not change - * during the runtime so retrieving the property once and storing its result in a static final field - * allows JIT to do its magic and remove some code branches. - * - *

This class is internal and is hence not for public use. Its APIs are unstable and can change - * at any time. + * This class is internal and is hence not for public use. Its APIs are unstable and can change at + * any time. */ -public abstract class InstrumentationConfig { +public class InstrumentationConfig { + private InstrumentationConfig() {} private static final Logger logger = Logger.getLogger(InstrumentationConfig.class.getName()); - private static final InstrumentationConfig DEFAULT = new EmptyInstrumentationConfig(); + private static final CoreInstrumentationConfig DEFAULT = new EmptyInstrumentationConfig(); // lazy initialized, so that javaagent can set it - private static volatile InstrumentationConfig instance = DEFAULT; + private static volatile CoreInstrumentationConfig instance = DEFAULT; /** * Sets the instrumentation configuration singleton. This method is only supposed to be called @@ -45,7 +32,7 @@ public abstract class InstrumentationConfig { *

This method is internal and is hence not for public use. Its API is unstable and can change * at any time. */ - public static void internalInitializeConfig(InstrumentationConfig config) { + public static void internalInitializeConfig(CoreInstrumentationConfig config) { if (instance != DEFAULT) { logger.warning("InstrumentationConfig#instance was already set earlier"); return; @@ -54,87 +41,7 @@ public static void internalInitializeConfig(InstrumentationConfig config) { } /** Returns the global instrumentation configuration. */ - public static InstrumentationConfig get() { + public static CoreInstrumentationConfig get() { return instance; } - - /** - * Returns a string-valued configuration property or {@code null} if a property with name {@code - * name} has not been configured. - */ - @Nullable - public abstract String getString(String name); - - /** - * Returns a string-valued configuration property or {@code defaultValue} if a property with name - * {@code name} has not been configured. - */ - public abstract String getString(String name, String defaultValue); - - /** - * Returns a boolean-valued configuration property or {@code defaultValue} if a property with name - * {@code name} has not been configured. - */ - public abstract boolean getBoolean(String name, boolean defaultValue); - - /** - * Returns an integer-valued configuration property or {@code defaultValue} if a property with - * name {@code name} has not been configured or when parsing has failed. - */ - public abstract int getInt(String name, int defaultValue); - - /** - * Returns a long-valued configuration property or {@code defaultValue} if a property with name - * {@code name} has not been configured or when parsing has failed. - */ - public abstract long getLong(String name, long defaultValue); - - /** - * Returns a double-valued configuration property or {@code defaultValue} if a property with name - * {@code name} has not been configured or when parsing has failed. - */ - public abstract double getDouble(String name, double defaultValue); - - /** - * Returns a duration-valued configuration property or {@code defaultValue} if a property with - * name {@code name} has not been configured or when parsing has failed. - * - *

Durations can be of the form "{number}{unit}", where unit is one of: - * - *

    - *
  • ms - *
  • s - *
  • m - *
  • h - *
  • d - *
- * - *

If no unit is specified, milliseconds is the assumed duration unit. - * - *

Examples: 10s, 20ms, 5000 - */ - public abstract Duration getDuration(String name, Duration defaultValue); - - /** - * This is the same as calling {@code getList(String, List)} with the defaultValue equal to the - * emptyList()/ - */ - public List getList(String name) { - return getList(name, emptyList()); - } - - /** - * Returns a list-valued configuration property or {@code defaultValue} if a property with name - * {@code name} has not been configured. The format of the original value must be comma-separated, - * e.g. {@code one,two,three}. The returned list is unmodifiable. - */ - public abstract List getList(String name, List defaultValue); - - /** - * Returns a map-valued configuration property or {@code defaultValue} if a property with name - * {@code name} has not been configured or when parsing has failed. The format of the original - * value must be comma-separated for each key, with an '=' separating the key and value, e.g. - * {@code key=value,anotherKey=anotherValue}. The returned map is unmodifiable. - */ - public abstract Map getMap(String name, Map defaultValue); } diff --git a/javaagent-tooling/build.gradle.kts b/javaagent-tooling/build.gradle.kts index 850f4382fe17..6043f1eb0d72 100644 --- a/javaagent-tooling/build.gradle.kts +++ b/javaagent-tooling/build.gradle.kts @@ -13,6 +13,7 @@ dependencies { implementation(project(":javaagent-extension-api")) implementation(project(":javaagent-tooling:javaagent-tooling-java9")) implementation(project(":instrumentation-api")) + implementation(project(":instrumentation-api-incubator")) implementation(project(":instrumentation-annotations-support")) implementation(project(":muzzle")) implementation(project(":sdk-autoconfigure-support")) diff --git a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/config/ConfigPropertiesBridge.java b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/config/ConfigPropertiesBridge.java index c690921de4a8..d0aa2c97eec5 100644 --- a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/config/ConfigPropertiesBridge.java +++ b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/config/ConfigPropertiesBridge.java @@ -5,7 +5,7 @@ package io.opentelemetry.javaagent.tooling.config; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; import java.time.Duration; @@ -13,7 +13,7 @@ import java.util.Map; import javax.annotation.Nullable; -public final class ConfigPropertiesBridge extends InstrumentationConfig { +public final class ConfigPropertiesBridge implements CoreInstrumentationConfig { private final ConfigProperties configProperties; diff --git a/muzzle/build.gradle.kts b/muzzle/build.gradle.kts index bd25aeff7ed8..5e8f5ff9b9f6 100644 --- a/muzzle/build.gradle.kts +++ b/muzzle/build.gradle.kts @@ -18,6 +18,7 @@ dependencies { implementation(project(":javaagent-bootstrap")) implementation(project(":instrumentation-api")) + implementation(project(":instrumentation-api-incubator")) implementation(project(":javaagent-extension-api")) // Used by byte-buddy but not brought in as a transitive dependency. From c89a002c30e80640ae10a752c676e36b9f2a8872 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Fri, 21 Jun 2024 08:40:17 +0200 Subject: [PATCH 04/23] make DefaultHttpClientTelemetryBuilder internal --- .../HttpClientInstrumenterBuilder.java | 61 +++++++++++++++++++ .../internal}/CommonConfigSetter.java | 2 +- .../internal}/CoreCommonConfig.java | 2 +- .../internal}/CoreInstrumentationConfig.java | 2 +- .../internal}/EnduserConfig.java | 2 +- .../HttpClientInstrumenterBuilder.java | 40 ------------ .../ExternalAnnotationInstrumentation.java | 2 +- .../log4j/appender/v2_17/Log4jHelper.java | 2 +- .../appender/v1_0/LogbackSingletons.java | 2 +- .../micrometer/v1_5/MicrometerSingletons.java | 2 +- .../web/RestTemplateInstrumentation.java | 11 ++-- .../internal/properties/CommonConfigUtil.java | 2 +- .../properties/ConfigPropertiesBridge.java | 2 +- .../bootstrap/internal/CommonConfig.java | 2 +- .../internal/DeprecatedConfigProperties.java | 2 +- .../internal/EmptyInstrumentationConfig.java | 2 +- .../internal/ExperimentalConfig.java | 2 +- .../internal/InstrumentationConfig.java | 2 +- .../JavaagentHttpClientInstrumenters.java | 2 +- .../config/ConfigPropertiesBridge.java | 2 +- 20 files changed, 83 insertions(+), 63 deletions(-) create mode 100644 instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/HttpClientInstrumenterBuilder.java rename instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/{internal/config => config/internal}/CommonConfigSetter.java (87%) rename instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/{internal/config => config/internal}/CoreCommonConfig.java (98%) rename instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/{internal/config => config/internal}/CoreInstrumentationConfig.java (98%) rename instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/{internal/config => config/internal}/EnduserConfig.java (97%) delete mode 100644 instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/instrumenter/HttpClientInstrumenterBuilder.java diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/HttpClientInstrumenterBuilder.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/HttpClientInstrumenterBuilder.java new file mode 100644 index 000000000000..c2dfaae9de8c --- /dev/null +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/HttpClientInstrumenterBuilder.java @@ -0,0 +1,61 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.api.incubator.builder.internal; + +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreCommonConfig; +import java.lang.reflect.Field; +import java.util.function.Consumer; +import java.util.function.Supplier; + +/** + * This class is internal and is hence not for public use. Its APIs are unstable and can change at + * any time. + */ +public class HttpClientInstrumenterBuilder { + private HttpClientInstrumenterBuilder() {} + + @CanIgnoreReturnValue + public static DefaultHttpClientTelemetryBuilder configure( + CoreCommonConfig config, Object builder) { + DefaultHttpClientTelemetryBuilder defaultBuilder = unwrapBuilder(builder); + set(config::getKnownHttpRequestMethods, defaultBuilder::setKnownMethods); + set(config::getClientRequestHeaders, defaultBuilder::setCapturedRequestHeaders); + set(config::getClientResponseHeaders, defaultBuilder::setCapturedResponseHeaders); + set(config::getPeerServiceResolver, defaultBuilder::setPeerServiceResolver); + set( + config::shouldEmitExperimentalHttpClientTelemetry, + defaultBuilder::setEmitExperimentalHttpClientMetrics); + return defaultBuilder; + } + + private static void set(Supplier supplier, Consumer consumer) { + T t = supplier.get(); + if (t != null) { + consumer.accept(t); + } + } + + /** + * This method is used to access the builder field of the builder object. + * + *

This approach allows us to re-use the existing builder classes from the library modules + */ + @SuppressWarnings("unchecked") + private static + DefaultHttpClientTelemetryBuilder unwrapBuilder(Object builder) { + if (builder instanceof DefaultHttpClientTelemetryBuilder) { + return (DefaultHttpClientTelemetryBuilder) builder; + } + try { + Field field = builder.getClass().getDeclaredField("builder"); + field.setAccessible(true); + return (DefaultHttpClientTelemetryBuilder) field.get(builder); + } catch (Exception e) { + throw new IllegalStateException("Could not access builder field", e); + } + } +} diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CommonConfigSetter.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CommonConfigSetter.java similarity index 87% rename from instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CommonConfigSetter.java rename to instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CommonConfigSetter.java index 0bce3e18e6bd..0153dda07640 100644 --- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CommonConfigSetter.java +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CommonConfigSetter.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.instrumentation.api.incubator.internal.config; +package io.opentelemetry.instrumentation.api.incubator.config.internal; import java.util.function.Consumer; import java.util.function.Supplier; diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CoreCommonConfig.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CoreCommonConfig.java similarity index 98% rename from instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CoreCommonConfig.java rename to instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CoreCommonConfig.java index 7bf1b58f2af6..2bffed675c85 100644 --- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CoreCommonConfig.java +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CoreCommonConfig.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.instrumentation.api.incubator.internal.config; +package io.opentelemetry.instrumentation.api.incubator.config.internal; import static java.util.Collections.emptyMap; diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CoreInstrumentationConfig.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CoreInstrumentationConfig.java similarity index 98% rename from instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CoreInstrumentationConfig.java rename to instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CoreInstrumentationConfig.java index e375cba5da3e..d786940f0305 100644 --- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/CoreInstrumentationConfig.java +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CoreInstrumentationConfig.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.instrumentation.api.incubator.internal.config; +package io.opentelemetry.instrumentation.api.incubator.config.internal; import static java.util.Collections.emptyList; diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/EnduserConfig.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/EnduserConfig.java similarity index 97% rename from instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/EnduserConfig.java rename to instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/EnduserConfig.java index 9f56241aed18..9799cfe0f287 100644 --- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/config/EnduserConfig.java +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/EnduserConfig.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.instrumentation.api.incubator.internal.config; +package io.opentelemetry.instrumentation.api.incubator.config.internal; import java.util.Objects; diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/instrumenter/HttpClientInstrumenterBuilder.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/instrumenter/HttpClientInstrumenterBuilder.java deleted file mode 100644 index a2e12e1ed1f1..000000000000 --- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/internal/instrumenter/HttpClientInstrumenterBuilder.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.instrumentation.api.incubator.internal.instrumenter; - -import com.google.errorprone.annotations.CanIgnoreReturnValue; -import io.opentelemetry.instrumentation.api.incubator.builder.AbstractHttpClientTelemetryBuilder; -import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreCommonConfig; -import java.util.function.Consumer; -import java.util.function.Supplier; - -/** - * This class is internal and is hence not for public use. Its APIs are unstable and can change at - * any time. - */ -public class HttpClientInstrumenterBuilder { - private HttpClientInstrumenterBuilder() {} - - @CanIgnoreReturnValue - public static > T configure( - CoreCommonConfig config, T builder) { - set(config::getKnownHttpRequestMethods, builder::setKnownMethods); - set(config::getClientRequestHeaders, builder::setCapturedRequestHeaders); - set(config::getClientResponseHeaders, builder::setCapturedResponseHeaders); - set(config::getPeerServiceResolver, builder::setPeerServiceResolver); - set( - config::shouldEmitExperimentalHttpClientTelemetry, - builder::setEmitExperimentalHttpClientMetrics); - return builder; - } - - private static void set(Supplier supplier, Consumer consumer) { - T t = supplier.get(); - if (t != null) { - consumer.accept(t); - } - } -} diff --git a/instrumentation/external-annotations/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extannotations/ExternalAnnotationInstrumentation.java b/instrumentation/external-annotations/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extannotations/ExternalAnnotationInstrumentation.java index 2e19864a8bdc..d2af3bc923a2 100644 --- a/instrumentation/external-annotations/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extannotations/ExternalAnnotationInstrumentation.java +++ b/instrumentation/external-annotations/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extannotations/ExternalAnnotationInstrumentation.java @@ -17,7 +17,7 @@ import io.opentelemetry.context.Context; import io.opentelemetry.context.Scope; -import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; import io.opentelemetry.instrumentation.api.incubator.semconv.util.ClassAndMethod; import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge; import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; diff --git a/instrumentation/log4j/log4j-appender-2.17/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v2_17/Log4jHelper.java b/instrumentation/log4j/log4j-appender-2.17/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v2_17/Log4jHelper.java index 5d3807e0673a..940b22a5a5cf 100644 --- a/instrumentation/log4j/log4j-appender-2.17/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v2_17/Log4jHelper.java +++ b/instrumentation/log4j/log4j-appender-2.17/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v2_17/Log4jHelper.java @@ -9,7 +9,7 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.logs.LogRecordBuilder; -import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; import io.opentelemetry.instrumentation.log4j.appender.v2_17.internal.ContextDataAccessor; import io.opentelemetry.instrumentation.log4j.appender.v2_17.internal.LogEventMapper; import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; diff --git a/instrumentation/logback/logback-appender-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackSingletons.java b/instrumentation/logback/logback-appender-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackSingletons.java index 981852c54cbf..d54e814d06c7 100644 --- a/instrumentation/logback/logback-appender-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackSingletons.java +++ b/instrumentation/logback/logback-appender-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackSingletons.java @@ -7,7 +7,7 @@ import static java.util.Collections.emptyList; -import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; import io.opentelemetry.instrumentation.logback.appender.v1_0.internal.LoggingEventMapper; import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; import java.util.List; diff --git a/instrumentation/micrometer/micrometer-1.5/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/v1_5/MicrometerSingletons.java b/instrumentation/micrometer/micrometer-1.5/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/v1_5/MicrometerSingletons.java index 860dcb918024..5f70e3645b18 100644 --- a/instrumentation/micrometer/micrometer-1.5/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/v1_5/MicrometerSingletons.java +++ b/instrumentation/micrometer/micrometer-1.5/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/v1_5/MicrometerSingletons.java @@ -7,7 +7,7 @@ import io.micrometer.core.instrument.MeterRegistry; import io.opentelemetry.api.GlobalOpenTelemetry; -import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; import io.opentelemetry.instrumentation.micrometer.v1_5.OpenTelemetryMeterRegistry; import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java index 89f5b109bc82..8da60c916175 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java @@ -7,9 +7,10 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import io.opentelemetry.api.OpenTelemetry; -import io.opentelemetry.instrumentation.api.incubator.internal.instrumenter.HttpClientInstrumenterBuilder; +import io.opentelemetry.instrumentation.api.incubator.builder.internal.HttpClientInstrumenterBuilder; import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.CommonConfigUtil; import io.opentelemetry.instrumentation.spring.web.v3_1.SpringWebTelemetry; +import io.opentelemetry.instrumentation.spring.web.v3_1.SpringWebTelemetryBuilder; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import java.util.List; import org.springframework.http.client.ClientHttpRequestInterceptor; @@ -23,11 +24,9 @@ private RestTemplateInstrumentation() {} static RestTemplate addIfNotPresent( RestTemplate restTemplate, OpenTelemetry openTelemetry, ConfigProperties config) { - ClientHttpRequestInterceptor instrumentationInterceptor = - HttpClientInstrumenterBuilder.configure( - CommonConfigUtil.getCommonConfig(config), SpringWebTelemetry.builder(openTelemetry)) - .build() - .newInterceptor(); + SpringWebTelemetryBuilder builder = SpringWebTelemetry.builder(openTelemetry); + HttpClientInstrumenterBuilder.configure(CommonConfigUtil.getCommonConfig(config), builder); + ClientHttpRequestInterceptor instrumentationInterceptor = builder.build().newInterceptor(); List restTemplateInterceptors = restTemplate.getInterceptors(); if (restTemplateInterceptors.stream() diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/CommonConfigUtil.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/CommonConfigUtil.java index a02e281d5655..10ff981f2345 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/CommonConfigUtil.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/CommonConfigUtil.java @@ -5,7 +5,7 @@ package io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties; -import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreCommonConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreCommonConfig; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; /** diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/ConfigPropertiesBridge.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/ConfigPropertiesBridge.java index 37a7bbbf9b4f..f2b69d7e29be 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/ConfigPropertiesBridge.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/ConfigPropertiesBridge.java @@ -5,7 +5,7 @@ package io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties; -import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; import java.time.Duration; diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java index 6ec149352bca..3961170a6d88 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java @@ -5,7 +5,7 @@ package io.opentelemetry.javaagent.bootstrap.internal; -import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreCommonConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreCommonConfig; /** * This class is internal and is hence not for public use. Its APIs are unstable and can change at diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/DeprecatedConfigProperties.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/DeprecatedConfigProperties.java index be9dd9247139..33419774e9f0 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/DeprecatedConfigProperties.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/DeprecatedConfigProperties.java @@ -8,7 +8,7 @@ import static java.util.Collections.emptyList; import static java.util.logging.Level.WARNING; -import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; import java.util.List; import java.util.logging.Logger; diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/EmptyInstrumentationConfig.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/EmptyInstrumentationConfig.java index 1942c6aaa191..4251d19ff45b 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/EmptyInstrumentationConfig.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/EmptyInstrumentationConfig.java @@ -5,7 +5,7 @@ package io.opentelemetry.javaagent.bootstrap.internal; -import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; import java.time.Duration; import java.util.List; import java.util.Map; diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/ExperimentalConfig.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/ExperimentalConfig.java index 255ce114706b..4f0b57fd75cb 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/ExperimentalConfig.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/ExperimentalConfig.java @@ -7,7 +7,7 @@ import static java.util.Collections.emptyList; -import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; import java.util.List; /** diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/InstrumentationConfig.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/InstrumentationConfig.java index fc1c7fb75095..bb3af4668d72 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/InstrumentationConfig.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/InstrumentationConfig.java @@ -7,7 +7,7 @@ import static java.util.Objects.requireNonNull; -import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; import java.util.logging.Logger; /** diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/JavaagentHttpClientInstrumenters.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/JavaagentHttpClientInstrumenters.java index a83c0ee10622..7078397e9713 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/JavaagentHttpClientInstrumenters.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/JavaagentHttpClientInstrumenters.java @@ -8,11 +8,11 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.context.propagation.TextMapSetter; import io.opentelemetry.instrumentation.api.incubator.builder.internal.DefaultHttpClientInstrumenterBuilder; +import io.opentelemetry.instrumentation.api.incubator.builder.internal.HttpClientInstrumenterBuilder; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesGetter; import java.util.function.Consumer; -import java.util.function.Supplier; /** * This class is internal and is hence not for public use. Its APIs are unstable and can change at diff --git a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/config/ConfigPropertiesBridge.java b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/config/ConfigPropertiesBridge.java index d0aa2c97eec5..12812e63e4e1 100644 --- a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/config/ConfigPropertiesBridge.java +++ b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/config/ConfigPropertiesBridge.java @@ -5,7 +5,7 @@ package io.opentelemetry.javaagent.tooling.config; -import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; import java.time.Duration; From 70eb45747fe8529c98b692b1e79e76df729cde27 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Fri, 21 Jun 2024 09:40:48 +0200 Subject: [PATCH 05/23] fix compile --- .../javaagent/instrumentation/extannotations/IncludeTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instrumentation/external-annotations/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/extannotations/IncludeTest.java b/instrumentation/external-annotations/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/extannotations/IncludeTest.java index 4344ffd61a60..7212da0620a3 100644 --- a/instrumentation/external-annotations/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/extannotations/IncludeTest.java +++ b/instrumentation/external-annotations/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/extannotations/IncludeTest.java @@ -9,7 +9,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.when; -import io.opentelemetry.instrumentation.api.incubator.internal.config.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; From 06e5c7d8481898032549a1a8e7345f910adc0985 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Fri, 21 Jun 2024 10:28:12 +0200 Subject: [PATCH 06/23] add runtime hint --- .../resources/META-INF/native-image/reflect-config.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 instrumentation-api-incubator/src/main/resources/META-INF/native-image/reflect-config.json diff --git a/instrumentation-api-incubator/src/main/resources/META-INF/native-image/reflect-config.json b/instrumentation-api-incubator/src/main/resources/META-INF/native-image/reflect-config.json new file mode 100644 index 000000000000..b0668f589920 --- /dev/null +++ b/instrumentation-api-incubator/src/main/resources/META-INF/native-image/reflect-config.json @@ -0,0 +1,8 @@ +[ + { + "name": "io.opentelemetry.instrumentation.spring.web.v3_1.SpringWebTelemetryBuilder", + "fields": [ + { "name" : "builder" } + ] + } +] From 633e0af39b4e149f9a5bf59313a8d8fd778b062f Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Fri, 21 Jun 2024 23:24:35 +0200 Subject: [PATCH 07/23] fix rebase --- .../HttpClientInstrumenterBuilder.java | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/HttpClientInstrumenterBuilder.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/HttpClientInstrumenterBuilder.java index c2dfaae9de8c..6aa583ad739c 100644 --- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/HttpClientInstrumenterBuilder.java +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/HttpClientInstrumenterBuilder.java @@ -5,8 +5,9 @@ package io.opentelemetry.instrumentation.api.incubator.builder.internal; -import com.google.errorprone.annotations.CanIgnoreReturnValue; import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreCommonConfig; +import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; +import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; import java.lang.reflect.Field; import java.util.function.Consumer; import java.util.function.Supplier; @@ -18,10 +19,11 @@ public class HttpClientInstrumenterBuilder { private HttpClientInstrumenterBuilder() {} - @CanIgnoreReturnValue - public static DefaultHttpClientTelemetryBuilder configure( - CoreCommonConfig config, Object builder) { - DefaultHttpClientTelemetryBuilder defaultBuilder = unwrapBuilder(builder); + public static Instrumenter configure( + CoreCommonConfig config, + Object builder, + Consumer> builderCustomizer) { + DefaultHttpClientInstrumenterBuilder defaultBuilder = unwrapBuilder(builder); set(config::getKnownHttpRequestMethods, defaultBuilder::setKnownMethods); set(config::getClientRequestHeaders, defaultBuilder::setCapturedRequestHeaders); set(config::getClientResponseHeaders, defaultBuilder::setCapturedResponseHeaders); @@ -29,7 +31,8 @@ public static DefaultHttpClientTelemetryBuilder void set(Supplier supplier, Consumer consumer) { @@ -46,14 +49,14 @@ private static void set(Supplier supplier, Consumer consumer) { */ @SuppressWarnings("unchecked") private static - DefaultHttpClientTelemetryBuilder unwrapBuilder(Object builder) { - if (builder instanceof DefaultHttpClientTelemetryBuilder) { - return (DefaultHttpClientTelemetryBuilder) builder; + DefaultHttpClientInstrumenterBuilder unwrapBuilder(Object builder) { + if (builder instanceof DefaultHttpClientInstrumenterBuilder) { + return (DefaultHttpClientInstrumenterBuilder) builder; } try { Field field = builder.getClass().getDeclaredField("builder"); field.setAccessible(true); - return (DefaultHttpClientTelemetryBuilder) field.get(builder); + return (DefaultHttpClientInstrumenterBuilder) field.get(builder); } catch (Exception e) { throw new IllegalStateException("Could not access builder field", e); } From ffe822548b848a5b69d593a85bcd6346488cdfdb Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Sat, 22 Jun 2024 08:02:27 +0200 Subject: [PATCH 08/23] rename --- .../internal/HttpClientInstrumenterBuilder.java | 12 ++++-------- .../web/RestTemplateInstrumentation.java | 12 ++++++------ .../internal/properties/ConfigPropertiesBridge.java | 6 +----- ...onfigUtil.java => InstrumentationConfigUtil.java} | 11 +++++++---- 4 files changed, 18 insertions(+), 23 deletions(-) rename instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/{CommonConfigUtil.java => InstrumentationConfigUtil.java} (52%) diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/HttpClientInstrumenterBuilder.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/HttpClientInstrumenterBuilder.java index 6aa583ad739c..1334b0484286 100644 --- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/HttpClientInstrumenterBuilder.java +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/HttpClientInstrumenterBuilder.java @@ -6,8 +6,6 @@ package io.opentelemetry.instrumentation.api.incubator.builder.internal; import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreCommonConfig; -import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; -import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; import java.lang.reflect.Field; import java.util.function.Consumer; import java.util.function.Supplier; @@ -19,10 +17,9 @@ public class HttpClientInstrumenterBuilder { private HttpClientInstrumenterBuilder() {} - public static Instrumenter configure( - CoreCommonConfig config, - Object builder, - Consumer> builderCustomizer) { + public static + DefaultHttpClientInstrumenterBuilder configure( + CoreCommonConfig config, Object builder) { DefaultHttpClientInstrumenterBuilder defaultBuilder = unwrapBuilder(builder); set(config::getKnownHttpRequestMethods, defaultBuilder::setKnownMethods); set(config::getClientRequestHeaders, defaultBuilder::setCapturedRequestHeaders); @@ -31,8 +28,7 @@ public static Instrumenter configure( set( config::shouldEmitExperimentalHttpClientTelemetry, defaultBuilder::setEmitExperimentalHttpClientMetrics); - defaultBuilder.setBuilderCustomizer(builderCustomizer); - return defaultBuilder.build(); + return defaultBuilder; } private static void set(Supplier supplier, Consumer consumer) { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java index 8da60c916175..755872231663 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java @@ -7,10 +7,8 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import io.opentelemetry.api.OpenTelemetry; -import io.opentelemetry.instrumentation.api.incubator.builder.internal.HttpClientInstrumenterBuilder; -import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.CommonConfigUtil; +import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.InstrumentationConfigUtil; import io.opentelemetry.instrumentation.spring.web.v3_1.SpringWebTelemetry; -import io.opentelemetry.instrumentation.spring.web.v3_1.SpringWebTelemetryBuilder; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import java.util.List; import org.springframework.http.client.ClientHttpRequestInterceptor; @@ -24,9 +22,11 @@ private RestTemplateInstrumentation() {} static RestTemplate addIfNotPresent( RestTemplate restTemplate, OpenTelemetry openTelemetry, ConfigProperties config) { - SpringWebTelemetryBuilder builder = SpringWebTelemetry.builder(openTelemetry); - HttpClientInstrumenterBuilder.configure(CommonConfigUtil.getCommonConfig(config), builder); - ClientHttpRequestInterceptor instrumentationInterceptor = builder.build().newInterceptor(); + ClientHttpRequestInterceptor instrumentationInterceptor = + InstrumentationConfigUtil.configureBuilder( + config, SpringWebTelemetry.builder(openTelemetry)) + .build() + .newInterceptor(); List restTemplateInterceptors = restTemplate.getInterceptors(); if (restTemplateInterceptors.stream() diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/ConfigPropertiesBridge.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/ConfigPropertiesBridge.java index f2b69d7e29be..0ec344eb172f 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/ConfigPropertiesBridge.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/ConfigPropertiesBridge.java @@ -13,11 +13,7 @@ import java.util.Map; import javax.annotation.Nullable; -/** - * This class is internal and is hence not for public use. Its APIs are unstable and can change at - * any time. - */ -public final class ConfigPropertiesBridge implements CoreInstrumentationConfig { +final class ConfigPropertiesBridge implements CoreInstrumentationConfig { private final ConfigProperties configProperties; diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/CommonConfigUtil.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java similarity index 52% rename from instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/CommonConfigUtil.java rename to instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java index 10ff981f2345..c6f1a73f50f3 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/CommonConfigUtil.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java @@ -5,6 +5,7 @@ package io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties; +import io.opentelemetry.instrumentation.api.incubator.builder.internal.HttpClientInstrumenterBuilder; import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreCommonConfig; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; @@ -12,10 +13,12 @@ * This class is internal and is hence not for public use. Its APIs are unstable and can change at * any time. */ -public class CommonConfigUtil { - private CommonConfigUtil() {} +public class InstrumentationConfigUtil { + private InstrumentationConfigUtil() {} - public static CoreCommonConfig getCommonConfig(ConfigProperties config) { - return new CoreCommonConfig(new ConfigPropertiesBridge(config)); + public static T configureBuilder(ConfigProperties config, T builder) { + HttpClientInstrumenterBuilder.configure( + new CoreCommonConfig(new ConfigPropertiesBridge(config)), builder); + return builder; } } From bd5439294c3fe77ddaf3386f9658c1a28f9faf3c Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Sat, 22 Jun 2024 08:13:50 +0200 Subject: [PATCH 09/23] rename --- .../DefaultHttpClientInstrumenterBuilder.java | 44 ++++++++++++++ .../HttpClientInstrumenterBuilder.java | 60 ------------------- .../config/internal/CommonConfigSetter.java | 24 -------- .../properties/InstrumentationConfigUtil.java | 4 +- 4 files changed, 46 insertions(+), 86 deletions(-) delete mode 100644 instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/HttpClientInstrumenterBuilder.java delete mode 100644 instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CommonConfigSetter.java diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java index 1eb82d40caba..9ea589f98fcf 100644 --- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java @@ -8,6 +8,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.context.propagation.TextMapSetter; +import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreCommonConfig; import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientExperimentalMetrics; import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientPeerServiceAttributesExtractor; import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpExperimentalAttributesExtractor; @@ -24,11 +25,13 @@ import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractorBuilder; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor; +import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.function.Consumer; import java.util.function.Function; +import java.util.function.Supplier; import javax.annotation.Nullable; /** @@ -192,4 +195,45 @@ public Instrumenter build() { public OpenTelemetry getOpenTelemetry() { return openTelemetry; } + + public static + DefaultHttpClientInstrumenterBuilder unwrapAndConfigure( + CoreCommonConfig config, Object builder) { + DefaultHttpClientInstrumenterBuilder defaultBuilder = unwrapBuilder(builder); + set(config::getKnownHttpRequestMethods, defaultBuilder::setKnownMethods); + set(config::getClientRequestHeaders, defaultBuilder::setCapturedRequestHeaders); + set(config::getClientResponseHeaders, defaultBuilder::setCapturedResponseHeaders); + set(config::getPeerServiceResolver, defaultBuilder::setPeerServiceResolver); + set( + config::shouldEmitExperimentalHttpClientTelemetry, + defaultBuilder::setEmitExperimentalHttpClientMetrics); + return defaultBuilder; + } + + private static void set(Supplier supplier, Consumer consumer) { + T t = supplier.get(); + if (t != null) { + consumer.accept(t); + } + } + + /** + * This method is used to access the builder field of the builder object. + * + *

This approach allows us to re-use the existing builder classes from the library modules + */ + @SuppressWarnings("unchecked") + private static + DefaultHttpClientInstrumenterBuilder unwrapBuilder(Object builder) { + if (builder instanceof DefaultHttpClientInstrumenterBuilder) { + return (DefaultHttpClientInstrumenterBuilder) builder; + } + try { + Field field = builder.getClass().getDeclaredField("builder"); + field.setAccessible(true); + return (DefaultHttpClientInstrumenterBuilder) field.get(builder); + } catch (Exception e) { + throw new IllegalStateException("Could not access builder field", e); + } + } } diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/HttpClientInstrumenterBuilder.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/HttpClientInstrumenterBuilder.java deleted file mode 100644 index 1334b0484286..000000000000 --- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/HttpClientInstrumenterBuilder.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.instrumentation.api.incubator.builder.internal; - -import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreCommonConfig; -import java.lang.reflect.Field; -import java.util.function.Consumer; -import java.util.function.Supplier; - -/** - * This class is internal and is hence not for public use. Its APIs are unstable and can change at - * any time. - */ -public class HttpClientInstrumenterBuilder { - private HttpClientInstrumenterBuilder() {} - - public static - DefaultHttpClientInstrumenterBuilder configure( - CoreCommonConfig config, Object builder) { - DefaultHttpClientInstrumenterBuilder defaultBuilder = unwrapBuilder(builder); - set(config::getKnownHttpRequestMethods, defaultBuilder::setKnownMethods); - set(config::getClientRequestHeaders, defaultBuilder::setCapturedRequestHeaders); - set(config::getClientResponseHeaders, defaultBuilder::setCapturedResponseHeaders); - set(config::getPeerServiceResolver, defaultBuilder::setPeerServiceResolver); - set( - config::shouldEmitExperimentalHttpClientTelemetry, - defaultBuilder::setEmitExperimentalHttpClientMetrics); - return defaultBuilder; - } - - private static void set(Supplier supplier, Consumer consumer) { - T t = supplier.get(); - if (t != null) { - consumer.accept(t); - } - } - - /** - * This method is used to access the builder field of the builder object. - * - *

This approach allows us to re-use the existing builder classes from the library modules - */ - @SuppressWarnings("unchecked") - private static - DefaultHttpClientInstrumenterBuilder unwrapBuilder(Object builder) { - if (builder instanceof DefaultHttpClientInstrumenterBuilder) { - return (DefaultHttpClientInstrumenterBuilder) builder; - } - try { - Field field = builder.getClass().getDeclaredField("builder"); - field.setAccessible(true); - return (DefaultHttpClientInstrumenterBuilder) field.get(builder); - } catch (Exception e) { - throw new IllegalStateException("Could not access builder field", e); - } - } -} diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CommonConfigSetter.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CommonConfigSetter.java deleted file mode 100644 index 0153dda07640..000000000000 --- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CommonConfigSetter.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.instrumentation.api.incubator.config.internal; - -import java.util.function.Consumer; -import java.util.function.Supplier; - -/** - * This class is internal and is hence not for public use. Its APIs are unstable and can change at - * any time. - */ -public final class CommonConfigSetter { - private CommonConfigSetter() {} - - public static void set(Supplier supplier, Consumer consumer) { - T t = supplier.get(); - if (t != null) { - consumer.accept(t); - } - } -} diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java index c6f1a73f50f3..e087a9ad25c0 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java @@ -5,7 +5,7 @@ package io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties; -import io.opentelemetry.instrumentation.api.incubator.builder.internal.HttpClientInstrumenterBuilder; +import io.opentelemetry.instrumentation.api.incubator.builder.internal.DefaultHttpClientInstrumenterBuilder; import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreCommonConfig; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; @@ -17,7 +17,7 @@ public class InstrumentationConfigUtil { private InstrumentationConfigUtil() {} public static T configureBuilder(ConfigProperties config, T builder) { - HttpClientInstrumenterBuilder.configure( + DefaultHttpClientInstrumenterBuilder.unwrapAndConfigure( new CoreCommonConfig(new ConfigPropertiesBridge(config)), builder); return builder; } From 55ff36cb915aef18c1f70e59ce33e06b234374aa Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Sat, 22 Jun 2024 08:14:59 +0200 Subject: [PATCH 10/23] move file --- .../opentelemetry-spring-boot}/reflect-config.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {instrumentation-api-incubator/src/main/resources/META-INF/native-image => instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/native-image/io.opentelemetry.instrumentation/opentelemetry-spring-boot}/reflect-config.json (100%) diff --git a/instrumentation-api-incubator/src/main/resources/META-INF/native-image/reflect-config.json b/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/native-image/io.opentelemetry.instrumentation/opentelemetry-spring-boot/reflect-config.json similarity index 100% rename from instrumentation-api-incubator/src/main/resources/META-INF/native-image/reflect-config.json rename to instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/native-image/io.opentelemetry.instrumentation/opentelemetry-spring-boot/reflect-config.json From e7a5e82b5d8439ef7b7d97c16b08e9f975b340f9 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Sat, 22 Jun 2024 09:18:02 +0200 Subject: [PATCH 11/23] fix build --- .../internal/properties/InstrumentationConfigUtil.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java index e087a9ad25c0..f2b40881834e 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java @@ -5,6 +5,7 @@ package io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import io.opentelemetry.instrumentation.api.incubator.builder.internal.DefaultHttpClientInstrumenterBuilder; import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreCommonConfig; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; @@ -16,6 +17,7 @@ public class InstrumentationConfigUtil { private InstrumentationConfigUtil() {} + @CanIgnoreReturnValue public static T configureBuilder(ConfigProperties config, T builder) { DefaultHttpClientInstrumenterBuilder.unwrapAndConfigure( new CoreCommonConfig(new ConfigPropertiesBridge(config)), builder); From f993486542511a64d5da4913b6bfb56ded2a1c59 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Sat, 22 Jun 2024 13:11:21 +0200 Subject: [PATCH 12/23] rest client --- .../build.gradle.kts | 1 + .../web/RestClientBeanPostProcessor.java | 24 +++++++++++++++---- ...lientInstrumentationAutoConfiguration.java | 13 ++++++---- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/instrumentation/spring/spring-boot-autoconfigure-3/build.gradle.kts b/instrumentation/spring/spring-boot-autoconfigure-3/build.gradle.kts index c3cd8b9f32f6..17e54b614de3 100644 --- a/instrumentation/spring/spring-boot-autoconfigure-3/build.gradle.kts +++ b/instrumentation/spring/spring-boot-autoconfigure-3/build.gradle.kts @@ -14,6 +14,7 @@ dependencies { val springBootVersion = "3.2.4" library("org.springframework.boot:spring-boot-starter-web:$springBootVersion") compileOnly(project(":instrumentation:spring:spring-boot-autoconfigure")) + implementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") implementation(project(":instrumentation:spring:spring-web:spring-web-3.1:library")) testImplementation(project(":instrumentation:spring:spring-boot-autoconfigure")) diff --git a/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientBeanPostProcessor.java b/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientBeanPostProcessor.java index dc7de4b22189..f5efcd488955 100644 --- a/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientBeanPostProcessor.java +++ b/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientBeanPostProcessor.java @@ -6,7 +6,9 @@ package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.web; import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.InstrumentationConfigUtil; import io.opentelemetry.instrumentation.spring.web.v3_1.SpringWebTelemetry; +import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.http.client.ClientHttpRequestInterceptor; @@ -15,23 +17,27 @@ public final class RestClientBeanPostProcessor implements BeanPostProcessor { private final ObjectProvider openTelemetryProvider; + private final ObjectProvider configPropertiesProvider; - public RestClientBeanPostProcessor(ObjectProvider openTelemetryProvider) { + public RestClientBeanPostProcessor( + ObjectProvider openTelemetryProvider, + ObjectProvider configPropertiesProvider) { this.openTelemetryProvider = openTelemetryProvider; + this.configPropertiesProvider = configPropertiesProvider; } @Override public Object postProcessAfterInitialization(Object bean, String beanName) { if (bean instanceof RestClient restClient) { - return addRestClientInterceptorIfNotPresent(restClient, openTelemetryProvider.getObject()); + return addRestClientInterceptorIfNotPresent( + restClient, openTelemetryProvider.getObject(), configPropertiesProvider.getObject()); } return bean; } private static RestClient addRestClientInterceptorIfNotPresent( - RestClient restClient, OpenTelemetry openTelemetry) { - ClientHttpRequestInterceptor instrumentationInterceptor = - SpringWebTelemetry.create(openTelemetry).newInterceptor(); + RestClient restClient, OpenTelemetry openTelemetry, ConfigProperties config) { + ClientHttpRequestInterceptor instrumentationInterceptor = getInterceptor(openTelemetry, config); return restClient .mutate() @@ -46,4 +52,12 @@ private static RestClient addRestClientInterceptorIfNotPresent( }) .build(); } + + static ClientHttpRequestInterceptor getInterceptor( + OpenTelemetry openTelemetry, ConfigProperties config) { + return InstrumentationConfigUtil.configureBuilder( + config, SpringWebTelemetry.builder(openTelemetry)) + .build() + .newInterceptor(); + } } diff --git a/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientInstrumentationAutoConfiguration.java b/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientInstrumentationAutoConfiguration.java index d3e862443187..f261dbcd2324 100644 --- a/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientInstrumentationAutoConfiguration.java +++ b/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientInstrumentationAutoConfiguration.java @@ -7,7 +7,7 @@ import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.instrumentation.spring.autoconfigure.internal.ConditionalOnEnabledInstrumentation; -import io.opentelemetry.instrumentation.spring.web.v3_1.SpringWebTelemetry; +import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -30,15 +30,18 @@ public class RestClientInstrumentationAutoConfiguration { @Bean static RestClientBeanPostProcessor otelRestClientBeanPostProcessor( - ObjectProvider openTelemetryProvider) { - return new RestClientBeanPostProcessor(openTelemetryProvider); + ObjectProvider openTelemetryProvider, + ObjectProvider configPropertiesProvider) { + return new RestClientBeanPostProcessor(openTelemetryProvider, configPropertiesProvider); } @Bean RestClientCustomizer otelRestClientCustomizer( - ObjectProvider openTelemetryProvider) { + ObjectProvider openTelemetryProvider, + ObjectProvider configPropertiesProvider) { return builder -> builder.requestInterceptor( - SpringWebTelemetry.create(openTelemetryProvider.getObject()).newInterceptor()); + RestClientBeanPostProcessor.getInterceptor( + openTelemetryProvider.getObject(), configPropertiesProvider.getObject())); } } From 55d68a055f9433f8c475994e93a9d279fc1dafbb Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Mon, 24 Jun 2024 09:24:18 +0200 Subject: [PATCH 13/23] test experimental attributes --- ...tInstrumentationAutoConfigurationTest.java | 6 +++++ .../smoketest/OtelSpringStarterSmokeTest.java | 12 ++-------- .../AbstractOtelSpringStarterSmokeTest.java | 23 ++++++++++++------- .../src/main/resources/application.yaml | 3 +++ ...actOtelReactiveSpringStarterSmokeTest.java | 2 ++ 5 files changed, 28 insertions(+), 18 deletions(-) diff --git a/instrumentation/spring/spring-boot-autoconfigure-3/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientInstrumentationAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure-3/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientInstrumentationAutoConfigurationTest.java index eb5223c0eab2..58237e0f8fd8 100644 --- a/instrumentation/spring/spring-boot-autoconfigure-3/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientInstrumentationAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure-3/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientInstrumentationAutoConfigurationTest.java @@ -8,6 +8,9 @@ import static org.assertj.core.api.Assertions.assertThat; import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; +import io.opentelemetry.sdk.autoconfigure.spi.internal.DefaultConfigProperties; +import java.util.Collections; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; @@ -18,6 +21,9 @@ class RestClientInstrumentationAutoConfigurationTest { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withBean(OpenTelemetry.class, OpenTelemetry::noop) + .withBean( + ConfigProperties.class, + () -> DefaultConfigProperties.createFromMap(Collections.emptyMap())) .withBean(RestClient.class, RestClient::create) .withConfiguration( AutoConfigurations.of(RestClientInstrumentationAutoConfiguration.class)); diff --git a/smoke-tests-otel-starter/spring-boot-3.2/src/test/java/io/opentelemetry/spring/smoketest/OtelSpringStarterSmokeTest.java b/smoke-tests-otel-starter/spring-boot-3.2/src/test/java/io/opentelemetry/spring/smoketest/OtelSpringStarterSmokeTest.java index 2fac92b2d1cf..cfb46104aadd 100644 --- a/smoke-tests-otel-starter/spring-boot-3.2/src/test/java/io/opentelemetry/spring/smoketest/OtelSpringStarterSmokeTest.java +++ b/smoke-tests-otel-starter/spring-boot-3.2/src/test/java/io/opentelemetry/spring/smoketest/OtelSpringStarterSmokeTest.java @@ -10,7 +10,6 @@ import io.opentelemetry.api.trace.SpanKind; import io.opentelemetry.sdk.testing.assertj.TraceAssert; import io.opentelemetry.semconv.HttpAttributes; -import io.opentelemetry.semconv.UrlAttributes; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -52,14 +51,7 @@ void restClient() { private static void assertClient(TraceAssert traceAssert) { traceAssert.hasSpansSatisfyingExactly( - nestedClientSpan -> - nestedClientSpan - .hasKind(SpanKind.CLIENT) - .hasAttributesSatisfying( - a -> assertThat(a.get(UrlAttributes.URL_FULL)).endsWith("/ping")), - nestedServerSpan -> - nestedServerSpan - .hasKind(SpanKind.SERVER) - .hasAttribute(HttpAttributes.HTTP_ROUTE, "/ping")); + span -> AbstractOtelSpringStarterSmokeTest.assertClientSpan(span, "/ping"), + span -> span.hasKind(SpanKind.SERVER).hasAttribute(HttpAttributes.HTTP_ROUTE, "/ping")); } } diff --git a/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java b/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java index 98abed7eef32..5f70ecc2778a 100644 --- a/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java +++ b/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java @@ -22,6 +22,7 @@ import io.opentelemetry.sdk.logs.data.LogRecordData; import io.opentelemetry.sdk.resources.Resource; import io.opentelemetry.semconv.ClientAttributes; +import io.opentelemetry.sdk.testing.assertj.SpanDataAssert; import io.opentelemetry.semconv.HttpAttributes; import io.opentelemetry.semconv.ServerAttributes; import io.opentelemetry.semconv.UrlAttributes; @@ -32,6 +33,7 @@ import java.util.List; import org.assertj.core.api.AbstractCharSequenceAssert; import org.assertj.core.api.AbstractIterableAssert; +import org.assertj.core.api.AbstractLongAssert; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; @@ -227,14 +229,19 @@ void restTemplate() { testing.waitAndAssertTraces( traceAssert -> traceAssert.hasSpansSatisfyingExactly( - nestedClientSpan -> - nestedClientSpan - .hasKind(SpanKind.CLIENT) - .hasAttributesSatisfying( - a -> assertThat(a.get(UrlAttributes.URL_FULL)).endsWith("/ping")), - nestedServerSpan -> - nestedServerSpan - .hasKind(SpanKind.SERVER) + span -> assertClientSpan(span, "/ping"), + span -> + span.hasKind(SpanKind.SERVER) .hasAttribute(HttpAttributes.HTTP_ROUTE, "/ping"))); } + + public static void assertClientSpan(SpanDataAssert nestedClientSpan, String path) { + nestedClientSpan + .hasKind(SpanKind.CLIENT) + .hasAttributesSatisfying( + OpenTelemetryAssertions.satisfies(UrlAttributes.URL_FULL, a -> a.endsWith(path)), + // this attribute is set by the experimental http instrumentation + OpenTelemetryAssertions.satisfies( + AttributeKey.longKey("http.response.body.size"), AbstractLongAssert::isPositive)); + } } diff --git a/smoke-tests-otel-starter/spring-boot-common/src/main/resources/application.yaml b/smoke-tests-otel-starter/spring-boot-common/src/main/resources/application.yaml index 37dc3bcf6a0e..df0764948302 100644 --- a/smoke-tests-otel-starter/spring-boot-common/src/main/resources/application.yaml +++ b/smoke-tests-otel-starter/spring-boot-common/src/main/resources/application.yaml @@ -8,6 +8,9 @@ otel: logback-appender: experimental: capture-code-attributes: true + http: + client: + emit-experimental-telemetry: true propagators: - b3 resource: diff --git a/smoke-tests-otel-starter/spring-boot-reactive-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelReactiveSpringStarterSmokeTest.java b/smoke-tests-otel-starter/spring-boot-reactive-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelReactiveSpringStarterSmokeTest.java index 7bc32e819fcc..4b943aae4a76 100644 --- a/smoke-tests-otel-starter/spring-boot-reactive-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelReactiveSpringStarterSmokeTest.java +++ b/smoke-tests-otel-starter/spring-boot-reactive-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelReactiveSpringStarterSmokeTest.java @@ -53,6 +53,8 @@ void webClientAndWebFluxAndR2dbc() { trace -> trace.hasSpansSatisfyingExactly( span -> + // todo (gregor) use AbstractOtelSpringStarterSmokeTest.assertClient + // when DefaultHttpClientInstrumenterBuilder is used span.hasKind(SpanKind.CLIENT) .hasName("GET") .hasAttributesSatisfying( From 783399c1d9ae61768fa2513c10964e7e1cc2b02f Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Wed, 26 Jun 2024 19:09:07 +0200 Subject: [PATCH 14/23] remove need for reflection --- .../DefaultHttpClientInstrumenterBuilder.java | 40 +++++-------------- .../web/RestClientBeanPostProcessor.java | 3 +- .../web/RestTemplateInstrumentation.java | 3 +- .../properties/InstrumentationConfigUtil.java | 9 +++-- .../web/v3_1/SpringWebTelemetryBuilder.java | 9 +++++ .../web/v3_1/internal/WebTelemetryUtil.java | 25 ++++++++++++ .../JavaagentHttpClientInstrumenters.java | 18 +-------- 7 files changed, 54 insertions(+), 53 deletions(-) create mode 100644 instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java index 9ea589f98fcf..225cf4b10e2d 100644 --- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java @@ -25,7 +25,6 @@ import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractorBuilder; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor; -import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -196,18 +195,17 @@ public OpenTelemetry getOpenTelemetry() { return openTelemetry; } - public static - DefaultHttpClientInstrumenterBuilder unwrapAndConfigure( - CoreCommonConfig config, Object builder) { - DefaultHttpClientInstrumenterBuilder defaultBuilder = unwrapBuilder(builder); - set(config::getKnownHttpRequestMethods, defaultBuilder::setKnownMethods); - set(config::getClientRequestHeaders, defaultBuilder::setCapturedRequestHeaders); - set(config::getClientResponseHeaders, defaultBuilder::setCapturedResponseHeaders); - set(config::getPeerServiceResolver, defaultBuilder::setPeerServiceResolver); + @CanIgnoreReturnValue + public DefaultHttpClientInstrumenterBuilder configure( + CoreCommonConfig config) { + set(config::getKnownHttpRequestMethods, this::setKnownMethods); + set(config::getClientRequestHeaders, this::setCapturedRequestHeaders); + set(config::getClientResponseHeaders, this::setCapturedResponseHeaders); + set(config::getPeerServiceResolver, this::setPeerServiceResolver); set( config::shouldEmitExperimentalHttpClientTelemetry, - defaultBuilder::setEmitExperimentalHttpClientMetrics); - return defaultBuilder; + this::setEmitExperimentalHttpClientMetrics); + return this; } private static void set(Supplier supplier, Consumer consumer) { @@ -216,24 +214,4 @@ private static void set(Supplier supplier, Consumer consumer) { consumer.accept(t); } } - - /** - * This method is used to access the builder field of the builder object. - * - *

This approach allows us to re-use the existing builder classes from the library modules - */ - @SuppressWarnings("unchecked") - private static - DefaultHttpClientInstrumenterBuilder unwrapBuilder(Object builder) { - if (builder instanceof DefaultHttpClientInstrumenterBuilder) { - return (DefaultHttpClientInstrumenterBuilder) builder; - } - try { - Field field = builder.getClass().getDeclaredField("builder"); - field.setAccessible(true); - return (DefaultHttpClientInstrumenterBuilder) field.get(builder); - } catch (Exception e) { - throw new IllegalStateException("Could not access builder field", e); - } - } } diff --git a/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientBeanPostProcessor.java b/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientBeanPostProcessor.java index f5efcd488955..74b7eaf86646 100644 --- a/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientBeanPostProcessor.java +++ b/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientBeanPostProcessor.java @@ -8,6 +8,7 @@ import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.InstrumentationConfigUtil; import io.opentelemetry.instrumentation.spring.web.v3_1.SpringWebTelemetry; +import io.opentelemetry.instrumentation.spring.web.v3_1.internal.WebTelemetryUtil; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.config.BeanPostProcessor; @@ -56,7 +57,7 @@ private static RestClient addRestClientInterceptorIfNotPresent( static ClientHttpRequestInterceptor getInterceptor( OpenTelemetry openTelemetry, ConfigProperties config) { return InstrumentationConfigUtil.configureBuilder( - config, SpringWebTelemetry.builder(openTelemetry)) + config, SpringWebTelemetry.builder(openTelemetry), WebTelemetryUtil.GET_BUILDER) .build() .newInterceptor(); } diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java index 755872231663..55e6bc68ba67 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java @@ -9,6 +9,7 @@ import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.InstrumentationConfigUtil; import io.opentelemetry.instrumentation.spring.web.v3_1.SpringWebTelemetry; +import io.opentelemetry.instrumentation.spring.web.v3_1.internal.WebTelemetryUtil; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import java.util.List; import org.springframework.http.client.ClientHttpRequestInterceptor; @@ -24,7 +25,7 @@ static RestTemplate addIfNotPresent( ClientHttpRequestInterceptor instrumentationInterceptor = InstrumentationConfigUtil.configureBuilder( - config, SpringWebTelemetry.builder(openTelemetry)) + config, SpringWebTelemetry.builder(openTelemetry), WebTelemetryUtil.GET_BUILDER) .build() .newInterceptor(); diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java index f2b40881834e..b66bc5d20da3 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java @@ -9,6 +9,7 @@ import io.opentelemetry.instrumentation.api.incubator.builder.internal.DefaultHttpClientInstrumenterBuilder; import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreCommonConfig; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; +import java.util.function.Function; /** * This class is internal and is hence not for public use. Its APIs are unstable and can change at @@ -18,9 +19,11 @@ public class InstrumentationConfigUtil { private InstrumentationConfigUtil() {} @CanIgnoreReturnValue - public static T configureBuilder(ConfigProperties config, T builder) { - DefaultHttpClientInstrumenterBuilder.unwrapAndConfigure( - new CoreCommonConfig(new ConfigPropertiesBridge(config)), builder); + public static T configureBuilder( + ConfigProperties config, + T builder, + Function> getBuilder) { + getBuilder.apply(builder).configure(new CoreCommonConfig(new ConfigPropertiesBridge(config))); return builder; } } diff --git a/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/SpringWebTelemetryBuilder.java b/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/SpringWebTelemetryBuilder.java index 35e50ce426be..a4edb71a0aa8 100644 --- a/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/SpringWebTelemetryBuilder.java +++ b/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/SpringWebTelemetryBuilder.java @@ -11,6 +11,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor; import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractorBuilder; +import io.opentelemetry.instrumentation.spring.web.v3_1.internal.WebTelemetryUtil; import java.util.List; import java.util.Set; import java.util.function.Function; @@ -22,6 +23,10 @@ public final class SpringWebTelemetryBuilder { private static final String INSTRUMENTATION_NAME = "io.opentelemetry.spring-web-3.1"; private final DefaultHttpClientInstrumenterBuilder builder; + static { + WebTelemetryUtil.GET_BUILDER = SpringWebTelemetryBuilder::getBuilder; + } + SpringWebTelemetryBuilder(OpenTelemetry openTelemetry) { builder = new DefaultHttpClientInstrumenterBuilder<>( @@ -29,6 +34,10 @@ public final class SpringWebTelemetryBuilder { .setHeaderSetter(HttpRequestSetter.INSTANCE); } + private DefaultHttpClientInstrumenterBuilder getBuilder() { + return builder; + } + /** * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented * items. diff --git a/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java b/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java new file mode 100644 index 000000000000..949551c378f2 --- /dev/null +++ b/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java @@ -0,0 +1,25 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.spring.web.v3_1.internal; + +import io.opentelemetry.instrumentation.api.incubator.builder.internal.DefaultHttpClientInstrumenterBuilder; +import io.opentelemetry.instrumentation.spring.web.v3_1.SpringWebTelemetryBuilder; +import java.util.function.Function; +import org.springframework.http.HttpRequest; +import org.springframework.http.client.ClientHttpResponse; + +/** + * This class is internal and is hence not for public use. Its APIs are unstable and can change at + * any time. + */ +public class WebTelemetryUtil { + private WebTelemetryUtil() {} + + public static Function< + SpringWebTelemetryBuilder, + DefaultHttpClientInstrumenterBuilder> + GET_BUILDER; +} diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/JavaagentHttpClientInstrumenters.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/JavaagentHttpClientInstrumenters.java index 7078397e9713..dfeaaf169ee1 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/JavaagentHttpClientInstrumenters.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/JavaagentHttpClientInstrumenters.java @@ -8,7 +8,6 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.context.propagation.TextMapSetter; import io.opentelemetry.instrumentation.api.incubator.builder.internal.DefaultHttpClientInstrumenterBuilder; -import io.opentelemetry.instrumentation.api.incubator.builder.internal.HttpClientInstrumenterBuilder; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesGetter; @@ -57,21 +56,6 @@ public static Instrumenter create( private static Instrumenter create( DefaultHttpClientInstrumenterBuilder builder, Consumer> builderCustomizer) { - CommonConfig config = CommonConfig.get(); - set(config::getKnownHttpRequestMethods, builder::setKnownMethods); - set(config::getClientRequestHeaders, builder::setCapturedRequestHeaders); - set(config::getClientResponseHeaders, builder::setCapturedResponseHeaders); - set(config::getPeerServiceResolver, builder::setPeerServiceResolver); - set( - config::shouldEmitExperimentalHttpClientTelemetry, - builder::setEmitExperimentalHttpClientMetrics); - return builder.setBuilderCustomizer(builderCustomizer).build(); - } - - private static void set(Supplier supplier, Consumer consumer) { - T t = supplier.get(); - if (t != null) { - consumer.accept(t); - } + return builder.configure(CommonConfig.get()).setBuilderCustomizer(builderCustomizer).build(); } } From 28e238fd4df173d95bd5437ab09ff56761890bfe Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 27 Jun 2024 08:00:32 +0200 Subject: [PATCH 15/23] remove need for reflection --- .../spring/web/v3_1/internal/WebTelemetryUtil.java | 1 + 1 file changed, 1 insertion(+) diff --git a/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java b/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java index 949551c378f2..2ee5e8bb1714 100644 --- a/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java +++ b/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java @@ -18,6 +18,7 @@ public class WebTelemetryUtil { private WebTelemetryUtil() {} + @SuppressWarnings("ConstantField") public static Function< SpringWebTelemetryBuilder, DefaultHttpClientInstrumenterBuilder> From c2a12fac87281483e4862d310b2de8518552926d Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 27 Jun 2024 09:48:51 +0200 Subject: [PATCH 16/23] remove need for reflection --- .../opentelemetry-spring-boot/reflect-config.json | 8 -------- .../AbstractOtelReactiveSpringStarterSmokeTest.java | 2 -- 2 files changed, 10 deletions(-) delete mode 100644 instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/native-image/io.opentelemetry.instrumentation/opentelemetry-spring-boot/reflect-config.json diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/native-image/io.opentelemetry.instrumentation/opentelemetry-spring-boot/reflect-config.json b/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/native-image/io.opentelemetry.instrumentation/opentelemetry-spring-boot/reflect-config.json deleted file mode 100644 index b0668f589920..000000000000 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/native-image/io.opentelemetry.instrumentation/opentelemetry-spring-boot/reflect-config.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "name": "io.opentelemetry.instrumentation.spring.web.v3_1.SpringWebTelemetryBuilder", - "fields": [ - { "name" : "builder" } - ] - } -] diff --git a/smoke-tests-otel-starter/spring-boot-reactive-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelReactiveSpringStarterSmokeTest.java b/smoke-tests-otel-starter/spring-boot-reactive-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelReactiveSpringStarterSmokeTest.java index 4b943aae4a76..7bc32e819fcc 100644 --- a/smoke-tests-otel-starter/spring-boot-reactive-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelReactiveSpringStarterSmokeTest.java +++ b/smoke-tests-otel-starter/spring-boot-reactive-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelReactiveSpringStarterSmokeTest.java @@ -53,8 +53,6 @@ void webClientAndWebFluxAndR2dbc() { trace -> trace.hasSpansSatisfyingExactly( span -> - // todo (gregor) use AbstractOtelSpringStarterSmokeTest.assertClient - // when DefaultHttpClientInstrumenterBuilder is used span.hasKind(SpanKind.CLIENT) .hasName("GET") .hasAttributesSatisfying( From cedf1ca1c9923d8679d68111785279927c8e2bde Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 27 Jun 2024 12:17:51 +0200 Subject: [PATCH 17/23] add comment --- .../spring/web/v3_1/internal/WebTelemetryUtil.java | 1 + 1 file changed, 1 insertion(+) diff --git a/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java b/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java index 2ee5e8bb1714..6b919455b2c8 100644 --- a/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java +++ b/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java @@ -18,6 +18,7 @@ public class WebTelemetryUtil { private WebTelemetryUtil() {} + // allows access to the private field for the spring starter @SuppressWarnings("ConstantField") public static Function< SpringWebTelemetryBuilder, From 1a8ac3babe091cc5342ac97a50d307fb6d337ddb Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Fri, 28 Jun 2024 14:53:04 +0200 Subject: [PATCH 18/23] fix rebase --- .../smoketest/AbstractOtelSpringStarterSmokeTest.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java b/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java index 5f70ecc2778a..5c8e2a444c1d 100644 --- a/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java +++ b/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java @@ -21,8 +21,8 @@ import io.opentelemetry.sdk.autoconfigure.spi.internal.DefaultConfigProperties; import io.opentelemetry.sdk.logs.data.LogRecordData; import io.opentelemetry.sdk.resources.Resource; -import io.opentelemetry.semconv.ClientAttributes; import io.opentelemetry.sdk.testing.assertj.SpanDataAssert; +import io.opentelemetry.semconv.ClientAttributes; import io.opentelemetry.semconv.HttpAttributes; import io.opentelemetry.semconv.ServerAttributes; import io.opentelemetry.semconv.UrlAttributes; @@ -235,13 +235,12 @@ void restTemplate() { .hasAttribute(HttpAttributes.HTTP_ROUTE, "/ping"))); } - public static void assertClientSpan(SpanDataAssert nestedClientSpan, String path) { - nestedClientSpan - .hasKind(SpanKind.CLIENT) + public static void assertClientSpan(SpanDataAssert span, String path) { + span.hasKind(SpanKind.CLIENT) .hasAttributesSatisfying( - OpenTelemetryAssertions.satisfies(UrlAttributes.URL_FULL, a -> a.endsWith(path)), + satisfies(UrlAttributes.URL_FULL, a -> a.endsWith(path)), // this attribute is set by the experimental http instrumentation - OpenTelemetryAssertions.satisfies( + satisfies( AttributeKey.longKey("http.response.body.size"), AbstractLongAssert::isPositive)); } } From 39c04163203fadd3f69648733de287b4ae00ef5e Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Mon, 1 Jul 2024 09:54:58 +0200 Subject: [PATCH 19/23] use constant --- .../spring/smoketest/AbstractOtelSpringStarterSmokeTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java b/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java index 5c8e2a444c1d..4b2ff243d73e 100644 --- a/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java +++ b/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java @@ -28,6 +28,7 @@ import io.opentelemetry.semconv.UrlAttributes; import io.opentelemetry.semconv.incubating.CodeIncubatingAttributes; import io.opentelemetry.semconv.incubating.DbIncubatingAttributes; +import io.opentelemetry.semconv.incubating.HttpIncubatingAttributes; import io.opentelemetry.semconv.incubating.ServiceIncubatingAttributes; import java.util.Collections; import java.util.List; @@ -241,6 +242,6 @@ public static void assertClientSpan(SpanDataAssert span, String path) { satisfies(UrlAttributes.URL_FULL, a -> a.endsWith(path)), // this attribute is set by the experimental http instrumentation satisfies( - AttributeKey.longKey("http.response.body.size"), AbstractLongAssert::isPositive)); + HttpIncubatingAttributes.HTTP_RESPONSE_BODY_SIZE, AbstractLongAssert::isPositive)); } } From fa74d31c684e440d36be5143ee9973b3babbfb0e Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Mon, 1 Jul 2024 10:07:28 +0200 Subject: [PATCH 20/23] renames --- .../DefaultHttpClientInstrumenterBuilder.java | 5 ++- ...oreCommonConfig.java => CommonConfig.java} | 4 +-- .../config/internal/EnduserConfig.java | 2 +- ...Config.java => InstrumentationConfig.java} | 8 ++--- .../server/AkkaHttpServerSingletons.java | 14 ++++---- .../apachedubbo/v2_7/OpenTelemetryFilter.java | 4 +-- .../apacheshenyu/v2_4/MetaDataHelper.java | 4 +-- .../armeria/v1_3/ArmeriaSingletons.java | 18 +++++------ .../v2_2/AwsLambdaInstrumentationHelper.java | 4 +-- .../awssdk/v1_11/TracingRequestHandler.java | 4 +-- .../v2_2/autoconfigure/AwsSdkSingletons.java | 6 ++-- .../decorators/BaseSpanDecorator.java | 4 +-- .../decorators/DbSpanDecorator.java | 4 +-- .../decorators/HttpSpanDecorator.java | 5 +-- .../cassandra/v3_0/CassandraSingletons.java | 4 +-- .../cassandra/v4_0/CassandraSingletons.java | 4 +-- .../cassandra/v4_4/CassandraSingletons.java | 4 +-- .../v2_0/CouchbaseQuerySanitizer.java | 4 +-- .../couchbase/v2_0/CouchbaseSingletons.java | 4 +-- ...earchRestJavaagentInstrumenterFactory.java | 8 ++--- ...ticsearchTransportInstrumenterFactory.java | 4 +-- .../executors/ExecutorMatchers.java | 7 ++-- .../extannotations/IncludeTest.java | 4 +-- .../ExternalAnnotationInstrumentation.java | 10 +++--- .../geode/GeodeDbAttributesGetter.java | 4 +-- .../graphql/v12_0/GraphqlSingletons.java | 4 +-- .../graphql/v20_0/GraphqlSingletons.java | 8 ++--- .../grizzly/GrizzlySingletons.java | 14 ++++---- .../grpc/v1_6/GrpcSingletons.java | 8 ++--- .../guava/v10_0/InstrumentationHelper.java | 4 +-- .../HibernateInstrumenterFactory.java | 4 +-- .../hibernate/OperationNameUtil.java | 4 +-- .../HttpUrlConnectionSingletons.java | 4 +-- .../hystrix/HystrixSingletons.java | 4 +-- .../influxdb/v2_4/InfluxDbRequest.java | 4 +-- .../jul/JavaUtilLoggingHelper.java | 4 +-- .../instrumentation/jaxrs/JaxrsConfig.java | 4 +-- .../appender/v1_1/LoggingEventMapper.java | 6 ++-- .../JbossExtLogRecordInstrumentation.java | 32 +++++++++---------- .../instrumentation/jdbc/JdbcSingletons.java | 10 +++--- .../jedis/v1_4/JedisDbAttributesGetter.java | 4 +-- .../jedis/v1_4/JedisSingletons.java | 4 +-- .../jedis/v3_0/JedisRequest.java | 4 +-- .../jedis/v3_0/JedisSingletons.java | 4 +-- .../jedis/v4_0/JedisRequest.java | 4 +-- .../jetty/v12_0/Jetty12Singletons.java | 14 ++++---- .../HttpJspPageInstrumentationSingletons.java | 4 +-- ...ationContextInstrumentationSingletons.java | 4 +-- .../kafkaclients/v0_11/KafkaSingletons.java | 6 ++-- .../v0_11/metrics/KafkaMetricsUtil.java | 4 +-- .../kafkastreams/KafkaStreamsSingletons.java | 4 +-- .../WithSpanInstrumentation.java | 6 ++-- .../ktor/v2_0/HttpClientInstrumentation.java | 8 ++--- .../ktor/v2_0/ServerInstrumentation.java | 8 ++--- .../KubernetesClientSingletons.java | 12 +++---- .../lettuce/v4_0/InstrumentationPoints.java | 4 +-- .../lettuce/v4_0/LettuceSingletons.java | 8 ++--- .../v5_0/EndCommandAsyncBiFunction.java | 4 +-- .../v5_0/EndConnectAsyncBiFunction.java | 4 +-- .../v5_0/LettuceDbAttributesGetter.java | 4 +-- .../lettuce/v5_0/LettuceSingletons.java | 9 +++--- .../rx/LettuceFluxTerminationRunnable.java | 4 +-- .../lettuce/v5_1/TracingHolder.java | 4 +-- .../LibertyDispatcherSingletons.java | 14 ++++---- .../log4j/appender/v1_2/LogEventMapper.java | 6 ++-- .../log4j/appender/v2_17/Log4jHelper.java | 6 ++-- .../SpanDecoratingContextDataInjector.java | 12 +++---- .../mdc/v1_2/LoggingEventInstrumentation.java | 14 ++++---- .../appender/v1_0/LogbackSingletons.java | 6 ++-- .../logback/mdc/v1_0/LogbackSingletons.java | 13 ++++---- .../mdc/v1_0/LoggingEventInstrumentation.java | 4 +-- .../methods/MethodInstrumentationModule.java | 4 +-- .../micrometer/v1_5/MicrometerSingletons.java | 6 ++-- .../v3_1/MongoInstrumentationSingletons.java | 8 ++--- .../v3_7/MongoInstrumentationSingletons.java | 8 ++--- .../v4_0/MongoInstrumentationSingletons.java | 8 ++--- .../v3_3/MongoInstrumentationSingletons.java | 8 ++--- .../v3_8/client/NettyClientSingletons.java | 4 +-- .../v3_8/server/NettyServerSingletons.java | 14 ++++---- .../v4_0/client/NettyClientSingletons.java | 21 ++++++------ .../v4_0/server/NettyServerSingletons.java | 14 ++++---- .../netty/v4_1/NettyClientSingletons.java | 23 ++++++------- .../netty/v4_1/NettyServerSingletons.java | 12 +++---- .../WithSpanInstrumentation.java | 4 +-- .../AnnotationExcludedMethods.java | 4 +-- .../oshi/MetricsRegistration.java | 4 +-- .../server/PekkoHttpServerSingletons.java | 12 +++---- .../v2_8/telemetry/PulsarSingletons.java | 4 +-- .../quartz/v2_0/QuartzSingletons.java | 4 +-- .../r2dbc/v1_0/R2dbcSingletons.java | 11 ++++--- .../rabbitmq/RabbitInstrumenterHelper.java | 4 +-- .../rabbitmq/RabbitSingletons.java | 4 +-- .../reactor/v3_1/HooksInstrumentation.java | 4 +-- .../kafka/v1_0/ReactorKafkaSingletons.java | 4 +-- .../v1_0/ReactorNettySingletons.java | 10 +++--- .../redisson/RedissonRequest.java | 4 +-- .../restlet/v1_1/RestletSingletons.java | 8 ++--- .../restlet/v2_0/RestletSingletons.java | 14 ++++---- .../v4_8/RocketMqClientHooks.java | 4 +-- .../v2_0/TracingAssemblyActivation.java | 4 +-- .../v3_0/TracingAssemblyActivation.java | 4 +-- .../v3_1_1/TracingAssemblyActivation.java | 4 +-- .../v2_2/Servlet2SpanNameExtractor.java | 4 +-- .../servlet/BaseServletHelper.java | 4 +-- .../ServletAdditionalAttributesExtractor.java | 8 ++--- .../servlet/ServletInstrumenterBuilder.java | 14 ++++---- .../ServletRequestParametersExtractor.java | 4 +-- .../SpringBatchInstrumentationConfig.java | 6 ++-- .../spring/batch/v3_0/job/JobSingletons.java | 4 +-- .../properties/ConfigPropertiesBridge.java | 4 +-- .../properties/InstrumentationConfigUtil.java | 4 +-- .../gateway/v2_0/ServerWebExchangeHelper.java | 4 +-- .../v4_1/SpringIntegrationSingletons.java | 6 ++-- .../kafka/v2_7/SpringKafkaSingletons.java | 6 ++-- .../v3_1/SpringSchedulingSingletons.java | 4 +-- .../EnduserAttributesCapturerSingletons.java | 14 ++++---- ...ityConfigServletInstrumentationModule.java | 4 +-- ...ityConfigWebFluxInstrumentationModule.java | 4 +-- .../webflux/v5_0/SpringWebfluxConfig.java | 4 +-- .../webflux/v5_0/client/WebClientHelper.java | 14 ++++---- .../ModelAndViewAttributesExtractor.java | 4 +-- .../spymemcached/CompletionListener.java | 4 +-- .../common/TomcatInstrumenterFactory.java | 14 ++++---- .../twilio/TwilioSingletons.java | 4 +-- .../undertow/UndertowSingletons.java | 14 ++++---- .../kafka/v3_6/VertxKafkaSingletons.java | 4 +-- .../VertxRedisClientAttributesGetter.java | 4 +-- .../redis/VertxRedisClientSingletons.java | 4 +-- .../v4_0/sql/VertxSqlClientSingletons.java | 6 ++-- .../common/XxlJobInstrumenterFactory.java | 4 +-- ...mmonConfig.java => AgentCommonConfig.java} | 11 +++---- ...g.java => AgentInstrumentationConfig.java} | 20 ++++++------ .../ConfiguredResourceAttributesHolder.java | 2 +- .../internal/DeprecatedConfigProperties.java | 8 ++--- .../internal/EmptyInstrumentationConfig.java | 4 +-- .../internal/ExperimentalConfig.java | 8 ++--- .../JavaagentHttpClientInstrumenters.java | 5 ++- .../javaagent/tooling/AgentInstaller.java | 4 +-- .../config/ConfigPropertiesBridge.java | 4 +-- .../FieldBackedImplementationInstaller.java | 4 +-- .../muzzle/AgentCachingPoolStrategy.java | 4 +-- 141 files changed, 480 insertions(+), 472 deletions(-) rename instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/{CoreCommonConfig.java => CommonConfig.java} (97%) rename instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/{CoreInstrumentationConfig.java => InstrumentationConfig.java} (92%) rename javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/{CommonConfig.java => AgentCommonConfig.java} (60%) rename javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/{InstrumentationConfig.java => AgentInstrumentationConfig.java} (60%) diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java index 225cf4b10e2d..50f73aa48069 100644 --- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java @@ -8,7 +8,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.context.propagation.TextMapSetter; -import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreCommonConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.CommonConfig; import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientExperimentalMetrics; import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientPeerServiceAttributesExtractor; import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpExperimentalAttributesExtractor; @@ -196,8 +196,7 @@ public OpenTelemetry getOpenTelemetry() { } @CanIgnoreReturnValue - public DefaultHttpClientInstrumenterBuilder configure( - CoreCommonConfig config) { + public DefaultHttpClientInstrumenterBuilder configure(CommonConfig config) { set(config::getKnownHttpRequestMethods, this::setKnownMethods); set(config::getClientRequestHeaders, this::setCapturedRequestHeaders); set(config::getClientResponseHeaders, this::setCapturedResponseHeaders); diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CoreCommonConfig.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CommonConfig.java similarity index 97% rename from instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CoreCommonConfig.java rename to instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CommonConfig.java index 2bffed675c85..23875d7e8b5f 100644 --- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CoreCommonConfig.java +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CommonConfig.java @@ -19,7 +19,7 @@ * This class is internal and is hence not for public use. Its APIs are unstable and can change at * any time. */ -public final class CoreCommonConfig { +public final class CommonConfig { private final PeerServiceResolver peerServiceResolver; private final List clientRequestHeaders; @@ -35,7 +35,7 @@ public final class CoreCommonConfig { private final String loggingSpanIdKey; private final String loggingTraceFlagsKey; - public CoreCommonConfig(CoreInstrumentationConfig config) { + public CommonConfig(InstrumentationConfig config) { peerServiceResolver = PeerServiceResolver.create( config.getMap("otel.instrumentation.common.peer-service-mapping", emptyMap())); diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/EnduserConfig.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/EnduserConfig.java index 9799cfe0f287..b44057c75f90 100644 --- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/EnduserConfig.java +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/EnduserConfig.java @@ -39,7 +39,7 @@ public class EnduserConfig { private final boolean roleEnabled; private final boolean scopeEnabled; - EnduserConfig(CoreInstrumentationConfig instrumentationConfig) { + EnduserConfig(InstrumentationConfig instrumentationConfig) { Objects.requireNonNull(instrumentationConfig, "instrumentationConfig must not be null"); /* diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CoreInstrumentationConfig.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/InstrumentationConfig.java similarity index 92% rename from instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CoreInstrumentationConfig.java rename to instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/InstrumentationConfig.java index d786940f0305..8ce777b270a7 100644 --- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CoreInstrumentationConfig.java +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/InstrumentationConfig.java @@ -19,14 +19,14 @@ * *

In case any {@code get*()} method variant gets called for the same property more than once * (e.g. each time an advice class executes) it is suggested to cache the result instead of - * repeatedly calling {@link CoreInstrumentationConfig}. Instrumentation configuration does not - * change during the runtime so retrieving the property once and storing its result in a static - * final field allows JIT to do its magic and remove some code branches. + * repeatedly calling {@link InstrumentationConfig}. Instrumentation configuration does not change + * during the runtime so retrieving the property once and storing its result in a static final field + * allows JIT to do its magic and remove some code branches. * *

This class is internal and is hence not for public use. Its APIs are unstable and can change * at any time. */ -public interface CoreInstrumentationConfig { +public interface InstrumentationConfig { /** * Returns a string-valued configuration property or {@code null} if a property with name {@code diff --git a/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/AkkaHttpServerSingletons.java b/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/AkkaHttpServerSingletons.java index 71338fca4212..af0a3d61da82 100644 --- a/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/AkkaHttpServerSingletons.java +++ b/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/AkkaHttpServerSingletons.java @@ -17,7 +17,7 @@ import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRoute; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.instrumentation.akkahttp.AkkaHttpUtil; public final class AkkaHttpServerSingletons { @@ -31,21 +31,21 @@ public final class AkkaHttpServerSingletons { GlobalOpenTelemetry.get(), AkkaHttpUtil.instrumentationName(), HttpSpanNameExtractor.builder(httpAttributesGetter) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter)) .addAttributesExtractor( HttpServerAttributesExtractor.builder(httpAttributesGetter) - .setCapturedRequestHeaders(CommonConfig.get().getServerRequestHeaders()) - .setCapturedResponseHeaders(CommonConfig.get().getServerResponseHeaders()) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setCapturedRequestHeaders(AgentCommonConfig.get().getServerRequestHeaders()) + .setCapturedResponseHeaders(AgentCommonConfig.get().getServerResponseHeaders()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .addOperationMetrics(HttpServerMetrics.get()) .addContextCustomizer( HttpServerRoute.builder(httpAttributesGetter) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()); - if (CommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) { + if (AgentCommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) { builder .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter)) .addOperationMetrics(HttpServerExperimentalMetrics.get()); diff --git a/instrumentation/apache-dubbo-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachedubbo/v2_7/OpenTelemetryFilter.java b/instrumentation/apache-dubbo-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachedubbo/v2_7/OpenTelemetryFilter.java index 98f7306bfd56..550f469ad9df 100644 --- a/instrumentation/apache-dubbo-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachedubbo/v2_7/OpenTelemetryFilter.java +++ b/instrumentation/apache-dubbo-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachedubbo/v2_7/OpenTelemetryFilter.java @@ -9,7 +9,7 @@ import io.opentelemetry.instrumentation.apachedubbo.v2_7.DubboTelemetry; import io.opentelemetry.instrumentation.apachedubbo.v2_7.internal.DubboClientNetworkAttributesGetter; import io.opentelemetry.instrumentation.api.incubator.semconv.net.PeerServiceAttributesExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import org.apache.dubbo.common.extension.Activate; import org.apache.dubbo.rpc.Filter; import org.apache.dubbo.rpc.Invocation; @@ -27,7 +27,7 @@ public OpenTelemetryFilter() { .addAttributesExtractor( PeerServiceAttributesExtractor.create( new DubboClientNetworkAttributesGetter(), - CommonConfig.get().getPeerServiceResolver())) + AgentCommonConfig.get().getPeerServiceResolver())) .build() .newFilter(); } diff --git a/instrumentation/apache-shenyu-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheshenyu/v2_4/MetaDataHelper.java b/instrumentation/apache-shenyu-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheshenyu/v2_4/MetaDataHelper.java index 15645b8ea6f7..4414e6eeb628 100644 --- a/instrumentation/apache-shenyu-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheshenyu/v2_4/MetaDataHelper.java +++ b/instrumentation/apache-shenyu-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheshenyu/v2_4/MetaDataHelper.java @@ -9,7 +9,7 @@ import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.instrumenter.LocalRootSpan; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import org.apache.shenyu.common.dto.MetaData; public final class MetaDataHelper { @@ -58,7 +58,7 @@ public final class MetaDataHelper { static { CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.apache-shenyu.experimental-span-attributes", false); } diff --git a/instrumentation/armeria/armeria-1.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/armeria/v1_3/ArmeriaSingletons.java b/instrumentation/armeria/armeria-1.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/armeria/v1_3/ArmeriaSingletons.java index 99a3b2c6c17f..8f4800ebca34 100644 --- a/instrumentation/armeria/armeria-1.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/armeria/v1_3/ArmeriaSingletons.java +++ b/instrumentation/armeria/armeria-1.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/armeria/v1_3/ArmeriaSingletons.java @@ -11,7 +11,7 @@ import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientPeerServiceAttributesExtractor; import io.opentelemetry.instrumentation.armeria.v1_3.ArmeriaTelemetry; import io.opentelemetry.instrumentation.armeria.v1_3.internal.ArmeriaHttpClientAttributesGetter; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import java.util.function.Function; // Holds singleton references to decorators to match against during suppression. @@ -24,19 +24,19 @@ public final class ArmeriaSingletons { static { ArmeriaTelemetry telemetry = ArmeriaTelemetry.builder(GlobalOpenTelemetry.get()) - .setCapturedClientRequestHeaders(CommonConfig.get().getClientRequestHeaders()) - .setCapturedClientResponseHeaders(CommonConfig.get().getClientResponseHeaders()) - .setCapturedServerRequestHeaders(CommonConfig.get().getServerRequestHeaders()) - .setCapturedServerResponseHeaders(CommonConfig.get().getServerResponseHeaders()) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setCapturedClientRequestHeaders(AgentCommonConfig.get().getClientRequestHeaders()) + .setCapturedClientResponseHeaders(AgentCommonConfig.get().getClientResponseHeaders()) + .setCapturedServerRequestHeaders(AgentCommonConfig.get().getServerRequestHeaders()) + .setCapturedServerResponseHeaders(AgentCommonConfig.get().getServerResponseHeaders()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .addClientAttributeExtractor( HttpClientPeerServiceAttributesExtractor.create( ArmeriaHttpClientAttributesGetter.INSTANCE, - CommonConfig.get().getPeerServiceResolver())) + AgentCommonConfig.get().getPeerServiceResolver())) .setEmitExperimentalHttpClientMetrics( - CommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()) + AgentCommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()) .setEmitExperimentalHttpServerMetrics( - CommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) + AgentCommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) .build(); CLIENT_DECORATOR = telemetry.newClientDecorator(); diff --git a/instrumentation/aws-lambda/aws-lambda-events-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awslambdaevents/v2_2/AwsLambdaInstrumentationHelper.java b/instrumentation/aws-lambda/aws-lambda-events-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awslambdaevents/v2_2/AwsLambdaInstrumentationHelper.java index 8783d93ef8bd..d55898e75053 100644 --- a/instrumentation/aws-lambda/aws-lambda-events-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awslambdaevents/v2_2/AwsLambdaInstrumentationHelper.java +++ b/instrumentation/aws-lambda/aws-lambda-events-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awslambdaevents/v2_2/AwsLambdaInstrumentationHelper.java @@ -10,7 +10,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.awslambdaevents.v2_2.internal.AwsLambdaEventsInstrumenterFactory; import io.opentelemetry.instrumentation.awslambdaevents.v2_2.internal.AwsLambdaSqsInstrumenterFactory; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; public final class AwsLambdaInstrumentationHelper { @@ -18,7 +18,7 @@ public final class AwsLambdaInstrumentationHelper { .AwsLambdaFunctionInstrumenter FUNCTION_INSTRUMENTER = AwsLambdaEventsInstrumenterFactory.createInstrumenter( - GlobalOpenTelemetry.get(), CommonConfig.get().getKnownHttpRequestMethods()); + GlobalOpenTelemetry.get(), AgentCommonConfig.get().getKnownHttpRequestMethods()); public static io.opentelemetry.instrumentation.awslambdacore.v1_0.internal .AwsLambdaFunctionInstrumenter diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awssdk/v1_11/TracingRequestHandler.java b/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awssdk/v1_11/TracingRequestHandler.java index dee44d73f0b8..872c7303507a 100644 --- a/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awssdk/v1_11/TracingRequestHandler.java +++ b/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awssdk/v1_11/TracingRequestHandler.java @@ -14,8 +14,8 @@ import io.opentelemetry.context.Context; import io.opentelemetry.context.Scope; import io.opentelemetry.instrumentation.awssdk.v1_11.AwsSdkTelemetry; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.bootstrap.internal.ExperimentalConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; /** * A {@link RequestHandler2} for use in the agent. Unlike library instrumentation, the agent will @@ -36,7 +36,7 @@ public class TracingRequestHandler extends RequestHandler2 { public static final RequestHandler2 tracingHandler = AwsSdkTelemetry.builder(GlobalOpenTelemetry.get()) .setCaptureExperimentalSpanAttributes( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.aws-sdk.experimental-span-attributes", false)) .setMessagingReceiveInstrumentationEnabled( ExperimentalConfig.get().messagingReceiveInstrumentationEnabled()) diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/autoconfigure/AwsSdkSingletons.java b/instrumentation/aws-sdk/aws-sdk-2.2/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/autoconfigure/AwsSdkSingletons.java index b4870cf3edda..dddb124eb938 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/autoconfigure/AwsSdkSingletons.java +++ b/instrumentation/aws-sdk/aws-sdk-2.2/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/autoconfigure/AwsSdkSingletons.java @@ -10,8 +10,8 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.api.internal.ConfigPropertiesUtil; import io.opentelemetry.instrumentation.awssdk.v2_2.AwsSdkTelemetry; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.bootstrap.internal.ExperimentalConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; import java.util.List; public final class AwsSdkSingletons { @@ -28,7 +28,7 @@ public final class AwsSdkSingletons { private static boolean hasAgentConfiguration() { try { - Class.forName("io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig"); + Class.forName("io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig"); return true; } catch (ClassNotFoundException e) { return false; @@ -69,7 +69,7 @@ private static boolean recordIndividualHttpError() { private static boolean getBoolean(String name, boolean defaultValue) { if (HAS_INSTRUMENTATION_CONFIG) { - return InstrumentationConfig.get().getBoolean(name, defaultValue); + return AgentInstrumentationConfig.get().getBoolean(name, defaultValue); } else { return ConfigPropertiesUtil.getBoolean(name, defaultValue); } diff --git a/instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/BaseSpanDecorator.java b/instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/BaseSpanDecorator.java index 322bed6a7117..1fe50b3abbda 100644 --- a/instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/BaseSpanDecorator.java +++ b/instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/BaseSpanDecorator.java @@ -26,7 +26,7 @@ import io.opentelemetry.api.common.AttributesBuilder; import io.opentelemetry.api.trace.SpanKind; import io.opentelemetry.context.Context; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.instrumentation.apachecamel.CamelDirection; import io.opentelemetry.javaagent.instrumentation.apachecamel.SpanDecorator; import java.util.Collections; @@ -41,7 +41,7 @@ class BaseSpanDecorator implements SpanDecorator { static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.camel.experimental-span-attributes", false); static final String DEFAULT_OPERATION_NAME = "CamelOperation"; diff --git a/instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/DbSpanDecorator.java b/instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/DbSpanDecorator.java index 2db260a9f088..45b368a043f1 100644 --- a/instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/DbSpanDecorator.java +++ b/instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/DbSpanDecorator.java @@ -25,7 +25,7 @@ import io.opentelemetry.api.common.AttributesBuilder; import io.opentelemetry.instrumentation.api.incubator.semconv.db.SqlStatementSanitizer; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.instrumentation.apachecamel.CamelDirection; import io.opentelemetry.semconv.incubating.DbIncubatingAttributes; import java.net.URI; @@ -36,7 +36,7 @@ class DbSpanDecorator extends BaseSpanDecorator { private static final SqlStatementSanitizer sanitizer = - SqlStatementSanitizer.create(CommonConfig.get().isStatementSanitizationEnabled()); + SqlStatementSanitizer.create(AgentCommonConfig.get().isStatementSanitizationEnabled()); private final String component; private final String system; diff --git a/instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/HttpSpanDecorator.java b/instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/HttpSpanDecorator.java index dfa923590d18..8e1c8b49f3fb 100644 --- a/instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/HttpSpanDecorator.java +++ b/instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/HttpSpanDecorator.java @@ -30,7 +30,7 @@ import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRoute; import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRouteSource; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.instrumentation.apachecamel.CamelDirection; import io.opentelemetry.semconv.HttpAttributes; import io.opentelemetry.semconv.UrlAttributes; @@ -45,7 +45,8 @@ class HttpSpanDecorator extends BaseSpanDecorator { private static final String POST_METHOD = "POST"; private static final String GET_METHOD = "GET"; - private static final Set knownMethods = CommonConfig.get().getKnownHttpRequestMethods(); + private static final Set knownMethods = + AgentCommonConfig.get().getKnownHttpRequestMethods(); protected String getProtocol() { return "http"; diff --git a/instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraSingletons.java b/instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraSingletons.java index 7792bcd3f8ad..841f48fdbc6e 100644 --- a/instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraSingletons.java +++ b/instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraSingletons.java @@ -12,7 +12,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor; import io.opentelemetry.instrumentation.api.semconv.network.NetworkAttributesExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.semconv.incubating.DbIncubatingAttributes; public final class CassandraSingletons { @@ -34,7 +34,7 @@ public final class CassandraSingletons { SqlClientAttributesExtractor.builder(attributesGetter) .setTableAttribute(DbIncubatingAttributes.DB_CASSANDRA_TABLE) .setStatementSanitizationEnabled( - CommonConfig.get().isStatementSanitizationEnabled()) + AgentCommonConfig.get().isStatementSanitizationEnabled()) .build()) .addAttributesExtractor( NetworkAttributesExtractor.create(new CassandraNetworkAttributesGetter())) diff --git a/instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraSingletons.java b/instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraSingletons.java index 73c98569f6cf..4da5b599d0a6 100644 --- a/instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraSingletons.java +++ b/instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraSingletons.java @@ -12,7 +12,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor; import io.opentelemetry.instrumentation.api.semconv.network.NetworkAttributesExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.semconv.incubating.DbIncubatingAttributes; public final class CassandraSingletons { @@ -33,7 +33,7 @@ public final class CassandraSingletons { SqlClientAttributesExtractor.builder(attributesGetter) .setTableAttribute(DbIncubatingAttributes.DB_CASSANDRA_TABLE) .setStatementSanitizationEnabled( - CommonConfig.get().isStatementSanitizationEnabled()) + AgentCommonConfig.get().isStatementSanitizationEnabled()) .build()) .addAttributesExtractor( NetworkAttributesExtractor.create(new CassandraNetworkAttributesGetter())) diff --git a/instrumentation/cassandra/cassandra-4.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_4/CassandraSingletons.java b/instrumentation/cassandra/cassandra-4.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_4/CassandraSingletons.java index 7803fbd26174..d7151d1b5722 100644 --- a/instrumentation/cassandra/cassandra-4.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_4/CassandraSingletons.java +++ b/instrumentation/cassandra/cassandra-4.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_4/CassandraSingletons.java @@ -7,13 +7,13 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.cassandra.v4_4.CassandraTelemetry; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; final class CassandraSingletons { static final CassandraTelemetry telemetry = CassandraTelemetry.builder(GlobalOpenTelemetry.get()) - .setStatementSanitizationEnabled(CommonConfig.get().isStatementSanitizationEnabled()) + .setStatementSanitizationEnabled(AgentCommonConfig.get().isStatementSanitizationEnabled()) .build(); private CassandraSingletons() {} diff --git a/instrumentation/couchbase/couchbase-2-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_0/CouchbaseQuerySanitizer.java b/instrumentation/couchbase/couchbase-2-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_0/CouchbaseQuerySanitizer.java index 738c9819547c..2fa42b1ca6bb 100644 --- a/instrumentation/couchbase/couchbase-2-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_0/CouchbaseQuerySanitizer.java +++ b/instrumentation/couchbase/couchbase-2-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_0/CouchbaseQuerySanitizer.java @@ -8,7 +8,7 @@ import io.opentelemetry.instrumentation.api.incubator.semconv.db.SqlDialect; import io.opentelemetry.instrumentation.api.incubator.semconv.db.SqlStatementInfo; import io.opentelemetry.instrumentation.api.incubator.semconv.db.SqlStatementSanitizer; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; @@ -17,7 +17,7 @@ public final class CouchbaseQuerySanitizer { private static final SqlStatementSanitizer sanitizer = - SqlStatementSanitizer.create(CommonConfig.get().isStatementSanitizationEnabled()); + SqlStatementSanitizer.create(AgentCommonConfig.get().isStatementSanitizationEnabled()); @Nullable private static final Class QUERY_CLASS; @Nullable private static final Class STATEMENT_CLASS; diff --git a/instrumentation/couchbase/couchbase-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_0/CouchbaseSingletons.java b/instrumentation/couchbase/couchbase-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_0/CouchbaseSingletons.java index a720209a8b95..0e6c3eee550a 100644 --- a/instrumentation/couchbase/couchbase-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_0/CouchbaseSingletons.java +++ b/instrumentation/couchbase/couchbase-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_0/CouchbaseSingletons.java @@ -13,7 +13,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor; import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor; import io.opentelemetry.instrumentation.api.semconv.network.NetworkAttributesExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class CouchbaseSingletons { @@ -36,7 +36,7 @@ public final class CouchbaseSingletons { (context, couchbaseRequest, startAttributes) -> CouchbaseRequestInfo.init(context, couchbaseRequest)); - if (InstrumentationConfig.get() + if (AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.couchbase.experimental-span-attributes", false)) { builder.addAttributesExtractor(new ExperimentalAttributesExtractor()); } diff --git a/instrumentation/elasticsearch/elasticsearch-rest-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/ElasticsearchRestJavaagentInstrumenterFactory.java b/instrumentation/elasticsearch/elasticsearch-rest-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/ElasticsearchRestJavaagentInstrumenterFactory.java index 6c160b9ff546..39682ce28a95 100644 --- a/instrumentation/elasticsearch/elasticsearch-rest-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/ElasticsearchRestJavaagentInstrumenterFactory.java +++ b/instrumentation/elasticsearch/elasticsearch-rest-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/ElasticsearchRestJavaagentInstrumenterFactory.java @@ -9,8 +9,8 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.elasticsearch.rest.internal.ElasticsearchRestInstrumenterFactory; import io.opentelemetry.instrumentation.elasticsearch.rest.internal.ElasticsearchRestRequest; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.util.Collections; import java.util.function.Function; import org.elasticsearch.client.Response; @@ -18,7 +18,7 @@ public final class ElasticsearchRestJavaagentInstrumenterFactory { private static final boolean CAPTURE_SEARCH_QUERY = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.elasticsearch.capture-search-query", false); private ElasticsearchRestJavaagentInstrumenterFactory() {} @@ -30,7 +30,7 @@ public static Instrumenter create( instrumentationName, Collections.emptyList(), Function.identity(), - CommonConfig.get().getKnownHttpRequestMethods(), + AgentCommonConfig.get().getKnownHttpRequestMethods(), CAPTURE_SEARCH_QUERY); } } diff --git a/instrumentation/elasticsearch/elasticsearch-transport-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/ElasticsearchTransportInstrumenterFactory.java b/instrumentation/elasticsearch/elasticsearch-transport-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/ElasticsearchTransportInstrumenterFactory.java index e1d2320aa972..33702561b4c8 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/ElasticsearchTransportInstrumenterFactory.java +++ b/instrumentation/elasticsearch/elasticsearch-transport-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/ElasticsearchTransportInstrumenterFactory.java @@ -12,12 +12,12 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import org.elasticsearch.action.ActionResponse; public final class ElasticsearchTransportInstrumenterFactory { private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.elasticsearch.experimental-span-attributes", false); public static Instrumenter create( diff --git a/instrumentation/executors/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/executors/ExecutorMatchers.java b/instrumentation/executors/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/executors/ExecutorMatchers.java index 1c3d7497ab35..717f088e4fcd 100644 --- a/instrumentation/executors/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/executors/ExecutorMatchers.java +++ b/instrumentation/executors/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/executors/ExecutorMatchers.java @@ -12,7 +12,7 @@ import static net.bytebuddy.matcher.ElementMatchers.any; import static net.bytebuddy.matcher.ElementMatchers.named; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; @@ -98,14 +98,15 @@ final class ExecutorMatchers { "scala.concurrent.Future$InternalCallbackExecutor$", "scala.concurrent.impl.ExecutionContextImpl")); combined.addAll( - InstrumentationConfig.get().getList("otel.instrumentation.executors.include", emptyList())); + AgentInstrumentationConfig.get() + .getList("otel.instrumentation.executors.include", emptyList())); INSTRUMENTED_EXECUTOR_NAMES = Collections.unmodifiableSet(combined); INSTRUMENTED_EXECUTOR_PREFIXES = Collections.singletonList("slick.util.AsyncExecutor$"); } static ElementMatcher.Junction executorNameMatcher() { - if (InstrumentationConfig.get() + if (AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.executors.include-all", false)) { return any(); } diff --git a/instrumentation/external-annotations/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/extannotations/IncludeTest.java b/instrumentation/external-annotations/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/extannotations/IncludeTest.java index 7212da0620a3..9f717b107392 100644 --- a/instrumentation/external-annotations/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/extannotations/IncludeTest.java +++ b/instrumentation/external-annotations/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/extannotations/IncludeTest.java @@ -9,7 +9,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.when; -import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.InstrumentationConfig; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; @@ -25,7 +25,7 @@ @ExtendWith(MockitoExtension.class) class IncludeTest { - @Mock CoreInstrumentationConfig config; + @Mock InstrumentationConfig config; @ParameterizedTest @MethodSource("provideArguments") diff --git a/instrumentation/external-annotations/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extannotations/ExternalAnnotationInstrumentation.java b/instrumentation/external-annotations/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extannotations/ExternalAnnotationInstrumentation.java index d2af3bc923a2..ee6baffd60bd 100644 --- a/instrumentation/external-annotations/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extannotations/ExternalAnnotationInstrumentation.java +++ b/instrumentation/external-annotations/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extannotations/ExternalAnnotationInstrumentation.java @@ -17,10 +17,10 @@ import io.opentelemetry.context.Context; import io.opentelemetry.context.Scope; -import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.InstrumentationConfig; import io.opentelemetry.instrumentation.api.incubator.semconv.util.ClassAndMethod; import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; import io.opentelemetry.javaagent.tooling.config.MethodsConfigurationParser; @@ -79,7 +79,7 @@ public class ExternalAnnotationInstrumentation implements TypeInstrumentation { public ExternalAnnotationInstrumentation() { Set additionalTraceAnnotations = - configureAdditionalTraceAnnotations(InstrumentationConfig.get()); + configureAdditionalTraceAnnotations(AgentInstrumentationConfig.get()); if (additionalTraceAnnotations.isEmpty()) { classLoaderOptimization = none(); @@ -114,7 +114,7 @@ public void transform(TypeTransformer transformer) { } // visible for testing - static Set configureAdditionalTraceAnnotations(CoreInstrumentationConfig config) { + static Set configureAdditionalTraceAnnotations(InstrumentationConfig config) { String configString = config.getString(TRACE_ANNOTATIONS_CONFIG); if (configString == null) { return Collections.unmodifiableSet(new HashSet<>(DEFAULT_ANNOTATIONS)); @@ -147,7 +147,7 @@ private static ElementMatcher.Junction configureExcludedMetho Map> excludedMethods = MethodsConfigurationParser.parse( - InstrumentationConfig.get().getString(TRACE_ANNOTATED_METHODS_EXCLUDE_CONFIG)); + AgentInstrumentationConfig.get().getString(TRACE_ANNOTATED_METHODS_EXCLUDE_CONFIG)); for (Map.Entry> entry : excludedMethods.entrySet()) { String className = entry.getKey(); ElementMatcher.Junction classMather = diff --git a/instrumentation/geode-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/geode/GeodeDbAttributesGetter.java b/instrumentation/geode-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/geode/GeodeDbAttributesGetter.java index e4382e20413f..f0f15e7f6d2b 100644 --- a/instrumentation/geode-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/geode/GeodeDbAttributesGetter.java +++ b/instrumentation/geode-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/geode/GeodeDbAttributesGetter.java @@ -7,14 +7,14 @@ import io.opentelemetry.instrumentation.api.incubator.semconv.db.DbClientAttributesGetter; import io.opentelemetry.instrumentation.api.incubator.semconv.db.SqlStatementSanitizer; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.semconv.incubating.DbIncubatingAttributes; import javax.annotation.Nullable; final class GeodeDbAttributesGetter implements DbClientAttributesGetter { private static final SqlStatementSanitizer sanitizer = - SqlStatementSanitizer.create(CommonConfig.get().isStatementSanitizationEnabled()); + SqlStatementSanitizer.create(AgentCommonConfig.get().isStatementSanitizationEnabled()); @Override public String getSystem(GeodeRequest request) { diff --git a/instrumentation/graphql-java/graphql-java-12.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/graphql/v12_0/GraphqlSingletons.java b/instrumentation/graphql-java/graphql-java-12.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/graphql/v12_0/GraphqlSingletons.java index 41c64c6a6cc3..162a54a62728 100644 --- a/instrumentation/graphql-java/graphql-java-12.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/graphql/v12_0/GraphqlSingletons.java +++ b/instrumentation/graphql-java/graphql-java-12.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/graphql/v12_0/GraphqlSingletons.java @@ -9,12 +9,12 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.graphql.internal.InstrumentationUtil; import io.opentelemetry.instrumentation.graphql.v12_0.GraphQLTelemetry; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class GraphqlSingletons { private static final boolean QUERY_SANITIZATION_ENABLED = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.graphql.query-sanitizer.enabled", true); private static final GraphQLTelemetry TELEMETRY = diff --git a/instrumentation/graphql-java/graphql-java-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/graphql/v20_0/GraphqlSingletons.java b/instrumentation/graphql-java/graphql-java-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/graphql/v20_0/GraphqlSingletons.java index 96a7e2f3a728..11f08b6c841a 100644 --- a/instrumentation/graphql-java/graphql-java-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/graphql/v20_0/GraphqlSingletons.java +++ b/instrumentation/graphql-java/graphql-java-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/graphql/v20_0/GraphqlSingletons.java @@ -9,18 +9,18 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.graphql.internal.InstrumentationUtil; import io.opentelemetry.instrumentation.graphql.v20_0.GraphQLTelemetry; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class GraphqlSingletons { private static final boolean QUERY_SANITIZATION_ENABLED = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.graphql.query-sanitizer.enabled", true); private static final boolean DATA_FETCHER_ENABLED = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.graphql.data-fetcher.enabled", false); private static final boolean TRIVIAL_DATA_FETCHER_ENABLED = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.graphql.trivial-data-fetcher.enabled", false); private static final GraphQLTelemetry TELEMETRY = diff --git a/instrumentation/grizzly-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grizzly/GrizzlySingletons.java b/instrumentation/grizzly-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grizzly/GrizzlySingletons.java index 5b10e6a735d4..7633c3bf7d56 100644 --- a/instrumentation/grizzly-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grizzly/GrizzlySingletons.java +++ b/instrumentation/grizzly-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grizzly/GrizzlySingletons.java @@ -15,7 +15,7 @@ import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRoute; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.bootstrap.servlet.AppServerBridge; import org.glassfish.grizzly.http.HttpRequestPacket; import org.glassfish.grizzly.http.HttpResponsePacket; @@ -32,17 +32,17 @@ public final class GrizzlySingletons { GlobalOpenTelemetry.get(), "io.opentelemetry.grizzly-2.3", HttpSpanNameExtractor.builder(httpAttributesGetter) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter)) .addAttributesExtractor( HttpServerAttributesExtractor.builder(httpAttributesGetter) - .setCapturedRequestHeaders(CommonConfig.get().getServerRequestHeaders()) - .setCapturedResponseHeaders(CommonConfig.get().getServerResponseHeaders()) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setCapturedRequestHeaders(AgentCommonConfig.get().getServerRequestHeaders()) + .setCapturedResponseHeaders(AgentCommonConfig.get().getServerResponseHeaders()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .addOperationMetrics(HttpServerMetrics.get()); - if (CommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) { + if (AgentCommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) { builder .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter)) .addOperationMetrics(HttpServerExperimentalMetrics.get()); @@ -59,7 +59,7 @@ public final class GrizzlySingletons { (context, httpRequestPacket, startAttributes) -> GrizzlyErrorHolder.init(context)) .addContextCustomizer( HttpServerRoute.builder(httpAttributesGetter) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .buildServerInstrumenter(HttpRequestHeadersGetter.INSTANCE); } diff --git a/instrumentation/grpc-1.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grpc/v1_6/GrpcSingletons.java b/instrumentation/grpc-1.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grpc/v1_6/GrpcSingletons.java index 36709d9e7f67..f42fb98aab00 100644 --- a/instrumentation/grpc-1.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grpc/v1_6/GrpcSingletons.java +++ b/instrumentation/grpc-1.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grpc/v1_6/GrpcSingletons.java @@ -13,7 +13,7 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.grpc.v1_6.GrpcTelemetry; import io.opentelemetry.instrumentation.grpc.v1_6.internal.ContextStorageBridge; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.util.List; import java.util.concurrent.atomic.AtomicReference; @@ -28,14 +28,14 @@ public final class GrpcSingletons { static { boolean experimentalSpanAttributes = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.grpc.experimental-span-attributes", false); List clientRequestMetadata = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getList("otel.instrumentation.grpc.capture-metadata.client.request", emptyList()); List serverRequestMetadata = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getList("otel.instrumentation.grpc.capture-metadata.server.request", emptyList()); GrpcTelemetry telemetry = diff --git a/instrumentation/guava-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/guava/v10_0/InstrumentationHelper.java b/instrumentation/guava-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/guava/v10_0/InstrumentationHelper.java index 9d15d8311d28..d1d8bbc637f0 100644 --- a/instrumentation/guava-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/guava/v10_0/InstrumentationHelper.java +++ b/instrumentation/guava-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/guava/v10_0/InstrumentationHelper.java @@ -7,14 +7,14 @@ import io.opentelemetry.instrumentation.api.annotation.support.async.AsyncOperationEndStrategies; import io.opentelemetry.instrumentation.guava.v10_0.GuavaAsyncOperationEndStrategy; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class InstrumentationHelper { static { asyncOperationEndStrategy = GuavaAsyncOperationEndStrategy.builder() .setCaptureExperimentalSpanAttributes( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.guava.experimental-span-attributes", false)) .build(); diff --git a/instrumentation/hibernate/hibernate-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/HibernateInstrumenterFactory.java b/instrumentation/hibernate/hibernate-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/HibernateInstrumenterFactory.java index b9aa1c4c4d2d..217454ef1c8f 100644 --- a/instrumentation/hibernate/hibernate-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/HibernateInstrumenterFactory.java +++ b/instrumentation/hibernate/hibernate-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/HibernateInstrumenterFactory.java @@ -8,11 +8,11 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class HibernateInstrumenterFactory { static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.hibernate.experimental-span-attributes", false); public static Instrumenter createInstrumenter( diff --git a/instrumentation/hibernate/hibernate-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/OperationNameUtil.java b/instrumentation/hibernate/hibernate-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/OperationNameUtil.java index 93e5bde1d85a..60783d0822d3 100644 --- a/instrumentation/hibernate/hibernate-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/OperationNameUtil.java +++ b/instrumentation/hibernate/hibernate-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/OperationNameUtil.java @@ -7,13 +7,13 @@ import io.opentelemetry.instrumentation.api.incubator.semconv.db.SqlStatementInfo; import io.opentelemetry.instrumentation.api.incubator.semconv.db.SqlStatementSanitizer; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import java.util.function.Function; public final class OperationNameUtil { private static final SqlStatementSanitizer sanitizer = - SqlStatementSanitizer.create(CommonConfig.get().isStatementSanitizationEnabled()); + SqlStatementSanitizer.create(AgentCommonConfig.get().isStatementSanitizationEnabled()); public static String getOperationNameForQuery(String query) { // set operation to default value that is used when sql sanitizer fails to extract diff --git a/instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlConnectionSingletons.java b/instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlConnectionSingletons.java index 62c67adb63b6..9f8b3006dc35 100644 --- a/instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlConnectionSingletons.java +++ b/instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlConnectionSingletons.java @@ -6,7 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.httpurlconnection; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenters; import java.net.HttpURLConnection; @@ -24,7 +24,7 @@ public final class HttpUrlConnectionSingletons { builder .addAttributesExtractor( HttpMethodAttributeExtractor.create( - CommonConfig.get().getKnownHttpRequestMethods())) + AgentCommonConfig.get().getKnownHttpRequestMethods())) .addContextCustomizer( (context, httpRequestPacket, startAttributes) -> GetOutputStreamContext.init(context))); diff --git a/instrumentation/hystrix-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hystrix/HystrixSingletons.java b/instrumentation/hystrix-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hystrix/HystrixSingletons.java index 19848e54d7cc..8a5ea9b501c4 100644 --- a/instrumentation/hystrix-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hystrix/HystrixSingletons.java +++ b/instrumentation/hystrix-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hystrix/HystrixSingletons.java @@ -8,7 +8,7 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class HystrixSingletons { @@ -21,7 +21,7 @@ public final class HystrixSingletons { Instrumenter.builder( GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, HystrixRequest::spanName); - if (InstrumentationConfig.get() + if (AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.hystrix.experimental-span-attributes", false)) { builder.addAttributesExtractor(new ExperimentalAttributesExtractor()); } diff --git a/instrumentation/influxdb-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbRequest.java b/instrumentation/influxdb-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbRequest.java index 23816208cecc..36ed4967b0a3 100644 --- a/instrumentation/influxdb-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbRequest.java +++ b/instrumentation/influxdb-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbRequest.java @@ -8,14 +8,14 @@ import com.google.auto.value.AutoValue; import io.opentelemetry.instrumentation.api.incubator.semconv.db.SqlStatementInfo; import io.opentelemetry.instrumentation.api.incubator.semconv.db.SqlStatementSanitizer; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import javax.annotation.Nullable; @AutoValue public abstract class InfluxDbRequest { private static final SqlStatementSanitizer sanitizer = - SqlStatementSanitizer.create(CommonConfig.get().isStatementSanitizationEnabled()); + SqlStatementSanitizer.create(AgentCommonConfig.get().isStatementSanitizationEnabled()); public static InfluxDbRequest create( String host, Integer port, String dbName, String operation, String sql) { diff --git a/instrumentation/java-util-logging/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jul/JavaUtilLoggingHelper.java b/instrumentation/java-util-logging/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jul/JavaUtilLoggingHelper.java index 434ec148421a..780e7307c845 100644 --- a/instrumentation/java-util-logging/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jul/JavaUtilLoggingHelper.java +++ b/instrumentation/java-util-logging/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jul/JavaUtilLoggingHelper.java @@ -12,7 +12,7 @@ import io.opentelemetry.api.logs.LogRecordBuilder; import io.opentelemetry.api.logs.Severity; import io.opentelemetry.context.Context; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.semconv.ExceptionAttributes; import io.opentelemetry.semconv.incubating.ThreadIncubatingAttributes; import java.io.PrintWriter; @@ -27,7 +27,7 @@ public final class JavaUtilLoggingHelper { private static final Formatter FORMATTER = new AccessibleFormatter(); private static final boolean captureExperimentalAttributes = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.java-util-logging.experimental-log-attributes", false); public static void capture(Logger logger, LogRecord logRecord) { diff --git a/instrumentation/jaxrs/jaxrs-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrs/JaxrsConfig.java b/instrumentation/jaxrs/jaxrs-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrs/JaxrsConfig.java index 5327611e44f7..3457cfba7f24 100644 --- a/instrumentation/jaxrs/jaxrs-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrs/JaxrsConfig.java +++ b/instrumentation/jaxrs/jaxrs-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrs/JaxrsConfig.java @@ -5,12 +5,12 @@ package io.opentelemetry.javaagent.instrumentation.jaxrs; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class JaxrsConfig { public static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.jaxrs.experimental-span-attributes", false); private JaxrsConfig() {} diff --git a/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/appender/v1_1/LoggingEventMapper.java b/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/appender/v1_1/LoggingEventMapper.java index 66c685c968d4..b8e13d2f3e19 100644 --- a/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/appender/v1_1/LoggingEventMapper.java +++ b/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/appender/v1_1/LoggingEventMapper.java @@ -16,7 +16,7 @@ import io.opentelemetry.api.logs.Severity; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.internal.cache.Cache; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.semconv.ExceptionAttributes; import io.opentelemetry.semconv.incubating.ThreadIncubatingAttributes; import java.io.PrintWriter; @@ -37,7 +37,7 @@ public final class LoggingEventMapper { private final List captureMdcAttributes; private static final boolean captureExperimentalAttributes = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.jboss-logmanager.experimental-log-attributes", false); // cached as an optimization @@ -45,7 +45,7 @@ public final class LoggingEventMapper { private LoggingEventMapper() { this.captureMdcAttributes = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getList( "otel.instrumentation.jboss-logmanager.experimental.capture-mdc-attributes", emptyList()); diff --git a/instrumentation/jboss-logmanager/jboss-logmanager-mdc-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/mdc/v1_1/JbossExtLogRecordInstrumentation.java b/instrumentation/jboss-logmanager/jboss-logmanager-mdc-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/mdc/v1_1/JbossExtLogRecordInstrumentation.java index b192eee169f4..5fb6ce47fc0b 100644 --- a/instrumentation/jboss-logmanager/jboss-logmanager-mdc-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/mdc/v1_1/JbossExtLogRecordInstrumentation.java +++ b/instrumentation/jboss-logmanager/jboss-logmanager-mdc-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/mdc/v1_1/JbossExtLogRecordInstrumentation.java @@ -15,7 +15,7 @@ import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.util.VirtualField; import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; import java.util.Map; @@ -55,9 +55,9 @@ public static void onExit( @Advice.This ExtLogRecord record, @Advice.Argument(0) String key, @Advice.Return(readOnly = false) String value) { - if (CommonConfig.get().getTraceIdKey().equals(key) - || CommonConfig.get().getSpanIdKey().equals(key) - || CommonConfig.get().getTraceFlagsKey().equals(key)) { + if (AgentCommonConfig.get().getTraceIdKey().equals(key) + || AgentCommonConfig.get().getSpanIdKey().equals(key) + || AgentCommonConfig.get().getTraceFlagsKey().equals(key)) { if (value != null) { // Assume already instrumented event if traceId/spanId/sampled is present. return; @@ -72,13 +72,13 @@ public static void onExit( return; } - if (CommonConfig.get().getTraceIdKey().equals(key)) { + if (AgentCommonConfig.get().getTraceIdKey().equals(key)) { value = spanContext.getTraceId(); } - if (CommonConfig.get().getSpanIdKey().equals(key)) { + if (AgentCommonConfig.get().getSpanIdKey().equals(key)) { value = spanContext.getSpanId(); } - if (CommonConfig.get().getTraceFlagsKey().equals(key)) { + if (AgentCommonConfig.get().getTraceFlagsKey().equals(key)) { value = spanContext.getTraceFlags().asHex(); } } @@ -93,9 +93,9 @@ public static void onExit( @Advice.This ExtLogRecord record, @Advice.Return(readOnly = false) Map value) { - if (value.containsKey(CommonConfig.get().getTraceIdKey()) - && value.containsKey(CommonConfig.get().getSpanIdKey()) - && value.containsKey(CommonConfig.get().getTraceFlagsKey())) { + if (value.containsKey(AgentCommonConfig.get().getTraceIdKey()) + && value.containsKey(AgentCommonConfig.get().getSpanIdKey()) + && value.containsKey(AgentCommonConfig.get().getTraceFlagsKey())) { return; } @@ -109,16 +109,16 @@ public static void onExit( return; } - if (!value.containsKey(CommonConfig.get().getTraceIdKey())) { - value.put(CommonConfig.get().getTraceIdKey(), spanContext.getTraceId()); + if (!value.containsKey(AgentCommonConfig.get().getTraceIdKey())) { + value.put(AgentCommonConfig.get().getTraceIdKey(), spanContext.getTraceId()); } - if (!value.containsKey(CommonConfig.get().getSpanIdKey())) { - value.put(CommonConfig.get().getSpanIdKey(), spanContext.getSpanId()); + if (!value.containsKey(AgentCommonConfig.get().getSpanIdKey())) { + value.put(AgentCommonConfig.get().getSpanIdKey(), spanContext.getSpanId()); } - if (!value.containsKey(CommonConfig.get().getTraceFlagsKey())) { - value.put(CommonConfig.get().getTraceFlagsKey(), spanContext.getTraceFlags().asHex()); + if (!value.containsKey(AgentCommonConfig.get().getTraceFlagsKey())) { + value.put(AgentCommonConfig.get().getTraceFlagsKey(), spanContext.getTraceFlags().asHex()); } } } diff --git a/instrumentation/jdbc/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jdbc/JdbcSingletons.java b/instrumentation/jdbc/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jdbc/JdbcSingletons.java index 7083282e8aba..afc92f2fcad9 100644 --- a/instrumentation/jdbc/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jdbc/JdbcSingletons.java +++ b/instrumentation/jdbc/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jdbc/JdbcSingletons.java @@ -17,8 +17,8 @@ import io.opentelemetry.instrumentation.jdbc.internal.DbRequest; import io.opentelemetry.instrumentation.jdbc.internal.JdbcAttributesGetter; import io.opentelemetry.instrumentation.jdbc.internal.JdbcNetworkAttributesGetter; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.bootstrap.jdbc.DbInfo; import javax.sql.DataSource; @@ -41,15 +41,15 @@ public final class JdbcSingletons { .addAttributesExtractor( SqlClientAttributesExtractor.builder(dbAttributesGetter) .setStatementSanitizationEnabled( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean( "otel.instrumentation.jdbc.statement-sanitizer.enabled", - CommonConfig.get().isStatementSanitizationEnabled())) + AgentCommonConfig.get().isStatementSanitizationEnabled())) .build()) .addAttributesExtractor(ServerAttributesExtractor.create(netAttributesGetter)) .addAttributesExtractor( PeerServiceAttributesExtractor.create( - netAttributesGetter, CommonConfig.get().getPeerServiceResolver())) + netAttributesGetter, AgentCommonConfig.get().getPeerServiceResolver())) .buildInstrumenter(SpanKindExtractor.alwaysClient()); } diff --git a/instrumentation/jedis/jedis-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisDbAttributesGetter.java b/instrumentation/jedis/jedis-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisDbAttributesGetter.java index 3ae3372ca95f..8ad1c67c30cb 100644 --- a/instrumentation/jedis/jedis-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisDbAttributesGetter.java +++ b/instrumentation/jedis/jedis-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisDbAttributesGetter.java @@ -7,14 +7,14 @@ import io.opentelemetry.instrumentation.api.incubator.semconv.db.DbClientAttributesGetter; import io.opentelemetry.instrumentation.api.incubator.semconv.db.RedisCommandSanitizer; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.semconv.incubating.DbIncubatingAttributes; import javax.annotation.Nullable; final class JedisDbAttributesGetter implements DbClientAttributesGetter { private static final RedisCommandSanitizer sanitizer = - RedisCommandSanitizer.create(CommonConfig.get().isStatementSanitizationEnabled()); + RedisCommandSanitizer.create(AgentCommonConfig.get().isStatementSanitizationEnabled()); @Override public String getSystem(JedisRequest request) { diff --git a/instrumentation/jedis/jedis-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisSingletons.java b/instrumentation/jedis/jedis-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisSingletons.java index d9ce8ccaedf5..6bf94ca5988d 100644 --- a/instrumentation/jedis/jedis-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisSingletons.java +++ b/instrumentation/jedis/jedis-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisSingletons.java @@ -12,7 +12,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor; import io.opentelemetry.instrumentation.api.semconv.network.ServerAttributesExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; public final class JedisSingletons { private static final String INSTRUMENTATION_NAME = "io.opentelemetry.jedis-1.4"; @@ -32,7 +32,7 @@ public final class JedisSingletons { .addAttributesExtractor(ServerAttributesExtractor.create(netAttributesGetter)) .addAttributesExtractor( PeerServiceAttributesExtractor.create( - netAttributesGetter, CommonConfig.get().getPeerServiceResolver())) + netAttributesGetter, AgentCommonConfig.get().getPeerServiceResolver())) .buildInstrumenter(SpanKindExtractor.alwaysClient()); } diff --git a/instrumentation/jedis/jedis-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/JedisRequest.java b/instrumentation/jedis/jedis-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/JedisRequest.java index 0c5b24df709a..36b71513660e 100644 --- a/instrumentation/jedis/jedis-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/JedisRequest.java +++ b/instrumentation/jedis/jedis-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/JedisRequest.java @@ -7,7 +7,7 @@ import com.google.auto.value.AutoValue; import io.opentelemetry.instrumentation.api.incubator.semconv.db.RedisCommandSanitizer; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import java.nio.charset.StandardCharsets; import java.util.List; import redis.clients.jedis.Connection; @@ -18,7 +18,7 @@ public abstract class JedisRequest { private static final RedisCommandSanitizer sanitizer = - RedisCommandSanitizer.create(CommonConfig.get().isStatementSanitizationEnabled()); + RedisCommandSanitizer.create(AgentCommonConfig.get().isStatementSanitizationEnabled()); public static JedisRequest create( Connection connection, ProtocolCommand command, List args) { diff --git a/instrumentation/jedis/jedis-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/JedisSingletons.java b/instrumentation/jedis/jedis-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/JedisSingletons.java index cb406ae43a9a..d52152caccab 100644 --- a/instrumentation/jedis/jedis-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/JedisSingletons.java +++ b/instrumentation/jedis/jedis-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/JedisSingletons.java @@ -13,7 +13,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor; import io.opentelemetry.instrumentation.api.semconv.network.NetworkAttributesExtractor; import io.opentelemetry.instrumentation.api.semconv.network.ServerAttributesExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; public final class JedisSingletons { private static final String INSTRUMENTATION_NAME = "io.opentelemetry.jedis-3.0"; @@ -34,7 +34,7 @@ public final class JedisSingletons { .addAttributesExtractor(NetworkAttributesExtractor.create(netAttributesGetter)) .addAttributesExtractor( PeerServiceAttributesExtractor.create( - netAttributesGetter, CommonConfig.get().getPeerServiceResolver())) + netAttributesGetter, AgentCommonConfig.get().getPeerServiceResolver())) .buildInstrumenter(SpanKindExtractor.alwaysClient()); } diff --git a/instrumentation/jedis/jedis-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v4_0/JedisRequest.java b/instrumentation/jedis/jedis-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v4_0/JedisRequest.java index 3cb189d3fa3e..a8c26bfaabbb 100644 --- a/instrumentation/jedis/jedis-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v4_0/JedisRequest.java +++ b/instrumentation/jedis/jedis-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v4_0/JedisRequest.java @@ -7,7 +7,7 @@ import com.google.auto.value.AutoValue; import io.opentelemetry.instrumentation.api.incubator.semconv.db.RedisCommandSanitizer; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import java.net.Socket; import java.net.SocketAddress; import java.nio.charset.StandardCharsets; @@ -22,7 +22,7 @@ public abstract class JedisRequest { private static final RedisCommandSanitizer sanitizer = - RedisCommandSanitizer.create(CommonConfig.get().isStatementSanitizationEnabled()); + RedisCommandSanitizer.create(AgentCommonConfig.get().isStatementSanitizationEnabled()); public static JedisRequest create(ProtocolCommand command, List args) { return new AutoValue_JedisRequest(command, args); diff --git a/instrumentation/jetty/jetty-12.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jetty/v12_0/Jetty12Singletons.java b/instrumentation/jetty/jetty-12.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jetty/v12_0/Jetty12Singletons.java index d51e70378a14..b9866c2cef93 100644 --- a/instrumentation/jetty/jetty-12.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jetty/v12_0/Jetty12Singletons.java +++ b/instrumentation/jetty/jetty-12.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jetty/v12_0/Jetty12Singletons.java @@ -15,7 +15,7 @@ import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRoute; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.bootstrap.servlet.AppServerBridge; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Response; @@ -33,18 +33,18 @@ public final class Jetty12Singletons { GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, HttpSpanNameExtractor.builder(httpAttributesGetter) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter)) .addAttributesExtractor( HttpServerAttributesExtractor.builder(httpAttributesGetter) - .setCapturedRequestHeaders(CommonConfig.get().getServerRequestHeaders()) - .setCapturedResponseHeaders(CommonConfig.get().getServerResponseHeaders()) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setCapturedRequestHeaders(AgentCommonConfig.get().getServerRequestHeaders()) + .setCapturedResponseHeaders(AgentCommonConfig.get().getServerResponseHeaders()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .addContextCustomizer( HttpServerRoute.builder(httpAttributesGetter) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .addContextCustomizer( (context, request, attributes) -> @@ -53,7 +53,7 @@ public final class Jetty12Singletons { .recordException() .init(context)) .addOperationMetrics(HttpServerMetrics.get()); - if (CommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) { + if (AgentCommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) { builder .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter)) .addOperationMetrics(HttpServerExperimentalMetrics.get()); diff --git a/instrumentation/jsp-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jsp/HttpJspPageInstrumentationSingletons.java b/instrumentation/jsp-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jsp/HttpJspPageInstrumentationSingletons.java index e4239002ad2f..fd8c74030f81 100644 --- a/instrumentation/jsp-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jsp/HttpJspPageInstrumentationSingletons.java +++ b/instrumentation/jsp-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jsp/HttpJspPageInstrumentationSingletons.java @@ -13,8 +13,8 @@ import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.bootstrap.internal.ExperimentalConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; import java.net.URI; import java.net.URISyntaxException; import java.util.logging.Logger; @@ -25,7 +25,7 @@ public class HttpJspPageInstrumentationSingletons { private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.jsp.experimental-span-attributes", false); private static final Instrumenter INSTRUMENTER; diff --git a/instrumentation/jsp-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jsp/JspCompilationContextInstrumentationSingletons.java b/instrumentation/jsp-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jsp/JspCompilationContextInstrumentationSingletons.java index c4c474c725b7..28ce32f9ecca 100644 --- a/instrumentation/jsp-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jsp/JspCompilationContextInstrumentationSingletons.java +++ b/instrumentation/jsp-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jsp/JspCompilationContextInstrumentationSingletons.java @@ -11,14 +11,14 @@ import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import javax.annotation.Nullable; import org.apache.jasper.JspCompilationContext; import org.apache.jasper.compiler.Compiler; public class JspCompilationContextInstrumentationSingletons { private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.jsp.experimental-span-attributes", false); private static final Instrumenter INSTRUMENTER; diff --git a/instrumentation/kafka/kafka-clients/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/v0_11/KafkaSingletons.java b/instrumentation/kafka/kafka-clients/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/v0_11/KafkaSingletons.java index 736b28ab1eae..bde04943f621 100644 --- a/instrumentation/kafka/kafka-clients/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/v0_11/KafkaSingletons.java +++ b/instrumentation/kafka/kafka-clients/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/v0_11/KafkaSingletons.java @@ -11,15 +11,15 @@ import io.opentelemetry.instrumentation.kafka.internal.KafkaProcessRequest; import io.opentelemetry.instrumentation.kafka.internal.KafkaProducerRequest; import io.opentelemetry.instrumentation.kafka.internal.KafkaReceiveRequest; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.bootstrap.internal.ExperimentalConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; import org.apache.kafka.clients.producer.RecordMetadata; public final class KafkaSingletons { private static final String INSTRUMENTATION_NAME = "io.opentelemetry.kafka-clients-0.11"; private static final boolean PRODUCER_PROPAGATION_ENABLED = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.kafka.producer-propagation.enabled", true); private static final Instrumenter PRODUCER_INSTRUMENTER; @@ -31,7 +31,7 @@ public final class KafkaSingletons { new KafkaInstrumenterFactory(GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME) .setCapturedHeaders(ExperimentalConfig.get().getMessagingHeaders()) .setCaptureExperimentalSpanAttributes( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.kafka.experimental-span-attributes", false)) .setMessagingReceiveInstrumentationEnabled( ExperimentalConfig.get().messagingReceiveInstrumentationEnabled()); diff --git a/instrumentation/kafka/kafka-clients/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/v0_11/metrics/KafkaMetricsUtil.java b/instrumentation/kafka/kafka-clients/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/v0_11/metrics/KafkaMetricsUtil.java index fcaa541aa085..e484e0fbd06e 100644 --- a/instrumentation/kafka/kafka-clients/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/v0_11/metrics/KafkaMetricsUtil.java +++ b/instrumentation/kafka/kafka-clients/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/v0_11/metrics/KafkaMetricsUtil.java @@ -9,8 +9,8 @@ import io.opentelemetry.instrumentation.kafka.internal.MetricsReporterList; import io.opentelemetry.instrumentation.kafka.internal.OpenTelemetryMetricsReporter; import io.opentelemetry.instrumentation.kafka.internal.OpenTelemetrySupplier; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.bootstrap.internal.DeprecatedConfigProperties; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; import java.util.List; import java.util.Map; import org.apache.kafka.clients.CommonClientConfigs; @@ -19,7 +19,7 @@ public final class KafkaMetricsUtil { private static final String INSTRUMENTATION_NAME = "io.opentelemetry.kafka-clients-0.11"; private static final boolean METRICS_ENABLED = DeprecatedConfigProperties.getBoolean( - InstrumentationConfig.get(), + AgentInstrumentationConfig.get(), "otel.instrumentation.kafka.metric-reporter.enabled", "otel.instrumentation.kafka-clients-metrics.enabled", true); diff --git a/instrumentation/kafka/kafka-streams-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkastreams/KafkaStreamsSingletons.java b/instrumentation/kafka/kafka-streams-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkastreams/KafkaStreamsSingletons.java index 8abc39e5ea68..5733eaa2d18a 100644 --- a/instrumentation/kafka/kafka-streams-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkastreams/KafkaStreamsSingletons.java +++ b/instrumentation/kafka/kafka-streams-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkastreams/KafkaStreamsSingletons.java @@ -9,8 +9,8 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.kafka.internal.KafkaInstrumenterFactory; import io.opentelemetry.instrumentation.kafka.internal.KafkaProcessRequest; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.bootstrap.internal.ExperimentalConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; public final class KafkaStreamsSingletons { @@ -20,7 +20,7 @@ public final class KafkaStreamsSingletons { new KafkaInstrumenterFactory(GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME) .setCapturedHeaders(ExperimentalConfig.get().getMessagingHeaders()) .setCaptureExperimentalSpanAttributes( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.kafka.experimental-span-attributes", false)) .setMessagingReceiveInstrumentationEnabled( ExperimentalConfig.get().messagingReceiveInstrumentationEnabled()) diff --git a/instrumentation/kotlinx-coroutines/kotlinx-coroutines-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kotlinxcoroutines/instrumentationannotations/WithSpanInstrumentation.java b/instrumentation/kotlinx-coroutines/kotlinx-coroutines-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kotlinxcoroutines/instrumentationannotations/WithSpanInstrumentation.java index 1995d5f14de9..e98a11fef3fe 100644 --- a/instrumentation/kotlinx-coroutines/kotlinx-coroutines-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kotlinxcoroutines/instrumentationannotations/WithSpanInstrumentation.java +++ b/instrumentation/kotlinx-coroutines/kotlinx-coroutines-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kotlinxcoroutines/instrumentationannotations/WithSpanInstrumentation.java @@ -16,7 +16,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import io.opentelemetry.context.Context; import io.opentelemetry.context.Scope; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; import io.opentelemetry.javaagent.extension.instrumentation.internal.AsmApi; @@ -54,10 +54,10 @@ class WithSpanInstrumentation implements TypeInstrumentation { // whether to check the transformed bytecode with asm CheckClassAdapter private static final boolean CHECK_CLASS = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean( "otel.instrumentation.kotlinx-coroutines.check-class", - InstrumentationConfig.get().getBoolean("otel.javaagent.debug", false)); + AgentInstrumentationConfig.get().getBoolean("otel.javaagent.debug", false)); private final ElementMatcher.Junction annotatedMethodMatcher; // this matcher matches all methods that should be excluded from transformation diff --git a/instrumentation/ktor/ktor-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/ktor/v2_0/HttpClientInstrumentation.java b/instrumentation/ktor/ktor-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/ktor/v2_0/HttpClientInstrumentation.java index 0a53968f9dc8..43f89f9968a5 100644 --- a/instrumentation/ktor/ktor-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/ktor/v2_0/HttpClientInstrumentation.java +++ b/instrumentation/ktor/ktor-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/ktor/v2_0/HttpClientInstrumentation.java @@ -16,7 +16,7 @@ import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.instrumentation.ktor.v2_0.client.KtorClientTracing; import io.opentelemetry.instrumentation.ktor.v2_0.client.KtorClientTracingBuilder; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; import kotlin.Unit; @@ -56,9 +56,9 @@ public static class SetupFunction implements Function1> INSTRUMENTER; private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.kubernetes-client.experimental-span-attributes", false); private static final ContextPropagators CONTEXT_PROPAGATORS; @@ -38,9 +38,9 @@ public class KubernetesClientSingletons { .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter)) .addAttributesExtractor( HttpClientAttributesExtractor.builder(httpAttributesGetter) - .setCapturedRequestHeaders(CommonConfig.get().getClientRequestHeaders()) - .setCapturedResponseHeaders(CommonConfig.get().getClientResponseHeaders()) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setCapturedRequestHeaders(AgentCommonConfig.get().getClientRequestHeaders()) + .setCapturedResponseHeaders(AgentCommonConfig.get().getClientResponseHeaders()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()); if (CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES) { diff --git a/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/InstrumentationPoints.java b/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/InstrumentationPoints.java index a6f0902635fe..514379987135 100644 --- a/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/InstrumentationPoints.java +++ b/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/InstrumentationPoints.java @@ -16,7 +16,7 @@ import com.lambdaworks.redis.protocol.RedisCommand; import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Context; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.util.EnumSet; import java.util.Set; import java.util.concurrent.CancellationException; @@ -24,7 +24,7 @@ public final class InstrumentationPoints { private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.lettuce.experimental-span-attributes", false); private static final Set NON_INSTRUMENTING_COMMANDS = EnumSet.of(SHUTDOWN, DEBUG); diff --git a/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceSingletons.java b/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceSingletons.java index cdf509ab7988..4c970bdf4973 100644 --- a/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceSingletons.java +++ b/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceSingletons.java @@ -16,8 +16,8 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor; import io.opentelemetry.instrumentation.api.semconv.network.ServerAttributesExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class LettuceSingletons { private static final String INSTRUMENTATION_NAME = "io.opentelemetry.lettuce-4.0"; @@ -48,10 +48,10 @@ public final class LettuceSingletons { .addAttributesExtractor(ServerAttributesExtractor.create(netAttributesGetter)) .addAttributesExtractor( PeerServiceAttributesExtractor.create( - netAttributesGetter, CommonConfig.get().getPeerServiceResolver())) + netAttributesGetter, AgentCommonConfig.get().getPeerServiceResolver())) .addAttributesExtractor(new LettuceConnectAttributesExtractor()) .setEnabled( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.lettuce.connection-telemetry.enabled", false)) .buildInstrumenter(SpanKindExtractor.alwaysClient()); } diff --git a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/EndCommandAsyncBiFunction.java b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/EndCommandAsyncBiFunction.java index 19f86beb0f6d..2baad6fd0692 100644 --- a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/EndCommandAsyncBiFunction.java +++ b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/EndCommandAsyncBiFunction.java @@ -10,7 +10,7 @@ import io.lettuce.core.protocol.RedisCommand; import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Context; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.util.concurrent.CancellationException; import java.util.function.BiFunction; @@ -27,7 +27,7 @@ public class EndCommandAsyncBiFunction implements BiFunction { private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.lettuce.experimental-span-attributes", false); private final Context context; diff --git a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/EndConnectAsyncBiFunction.java b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/EndConnectAsyncBiFunction.java index 93ee72ce0b76..d179605e5ccc 100644 --- a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/EndConnectAsyncBiFunction.java +++ b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/EndConnectAsyncBiFunction.java @@ -10,7 +10,7 @@ import io.lettuce.core.RedisURI; import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Context; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.util.concurrent.CancellationException; import java.util.function.BiFunction; @@ -27,7 +27,7 @@ public class EndConnectAsyncBiFunction implements BiFunction { private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.lettuce.experimental-span-attributes", false); private final Context context; diff --git a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceDbAttributesGetter.java b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceDbAttributesGetter.java index 6ecbaa3d1ee9..a3c7050e3c79 100644 --- a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceDbAttributesGetter.java +++ b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceDbAttributesGetter.java @@ -9,7 +9,7 @@ import io.opentelemetry.instrumentation.api.incubator.semconv.db.DbClientAttributesGetter; import io.opentelemetry.instrumentation.api.incubator.semconv.db.RedisCommandSanitizer; import io.opentelemetry.instrumentation.lettuce.common.LettuceArgSplitter; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.semconv.incubating.DbIncubatingAttributes; import java.util.Collections; import java.util.List; @@ -18,7 +18,7 @@ final class LettuceDbAttributesGetter implements DbClientAttributesGetter> { private static final RedisCommandSanitizer sanitizer = - RedisCommandSanitizer.create(CommonConfig.get().isStatementSanitizationEnabled()); + RedisCommandSanitizer.create(AgentCommonConfig.get().isStatementSanitizationEnabled()); @Override public String getSystem(RedisCommand request) { diff --git a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceSingletons.java b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceSingletons.java index 0cc13a7ce472..f4de0e03fbfb 100644 --- a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceSingletons.java +++ b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceSingletons.java @@ -16,8 +16,8 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor; import io.opentelemetry.instrumentation.api.semconv.network.ServerAttributesExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class LettuceSingletons { private static final String INSTRUMENTATION_NAME = "io.opentelemetry.lettuce-5.0"; @@ -49,10 +49,11 @@ public final class LettuceSingletons { ServerAttributesExtractor.create(connectNetworkAttributesGetter)) .addAttributesExtractor( PeerServiceAttributesExtractor.create( - connectNetworkAttributesGetter, CommonConfig.get().getPeerServiceResolver())) + connectNetworkAttributesGetter, + AgentCommonConfig.get().getPeerServiceResolver())) .addAttributesExtractor(new LettuceConnectAttributesExtractor()) .setEnabled( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.lettuce.connection-telemetry.enabled", false)) .buildInstrumenter(SpanKindExtractor.alwaysClient()); } diff --git a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/rx/LettuceFluxTerminationRunnable.java b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/rx/LettuceFluxTerminationRunnable.java index 03ca65e4f8d3..af20fc892495 100644 --- a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/rx/LettuceFluxTerminationRunnable.java +++ b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/rx/LettuceFluxTerminationRunnable.java @@ -10,7 +10,7 @@ import io.lettuce.core.protocol.RedisCommand; import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Context; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.util.function.Consumer; import java.util.logging.Logger; import org.reactivestreams.Subscription; @@ -21,7 +21,7 @@ public class LettuceFluxTerminationRunnable implements Consumer>, Runnable { private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.lettuce.experimental-span-attributes", false); private Context context; diff --git a/instrumentation/lettuce/lettuce-5.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/TracingHolder.java b/instrumentation/lettuce/lettuce-5.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/TracingHolder.java index 55f035404385..7b354788b5f9 100644 --- a/instrumentation/lettuce/lettuce-5.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/TracingHolder.java +++ b/instrumentation/lettuce/lettuce-5.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/TracingHolder.java @@ -8,13 +8,13 @@ import io.lettuce.core.tracing.Tracing; import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.lettuce.v5_1.LettuceTelemetry; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; public final class TracingHolder { public static final Tracing TRACING = LettuceTelemetry.builder(GlobalOpenTelemetry.get()) - .setStatementSanitizationEnabled(CommonConfig.get().isStatementSanitizationEnabled()) + .setStatementSanitizationEnabled(AgentCommonConfig.get().isStatementSanitizationEnabled()) .build() .newTracing(); diff --git a/instrumentation/liberty/liberty-dispatcher-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherSingletons.java b/instrumentation/liberty/liberty-dispatcher-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherSingletons.java index d0ce75b92238..5dc10034fd21 100644 --- a/instrumentation/liberty/liberty-dispatcher-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherSingletons.java +++ b/instrumentation/liberty/liberty-dispatcher-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherSingletons.java @@ -15,7 +15,7 @@ import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRoute; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; public final class LibertyDispatcherSingletons { private static final String INSTRUMENTATION_NAME = "io.opentelemetry.liberty-dispatcher-20.0"; @@ -31,21 +31,21 @@ public final class LibertyDispatcherSingletons { GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, HttpSpanNameExtractor.builder(httpAttributesGetter) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter)) .addAttributesExtractor( HttpServerAttributesExtractor.builder(httpAttributesGetter) - .setCapturedRequestHeaders(CommonConfig.get().getServerRequestHeaders()) - .setCapturedResponseHeaders(CommonConfig.get().getServerResponseHeaders()) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setCapturedRequestHeaders(AgentCommonConfig.get().getServerRequestHeaders()) + .setCapturedResponseHeaders(AgentCommonConfig.get().getServerResponseHeaders()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .addContextCustomizer( HttpServerRoute.builder(httpAttributesGetter) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .addOperationMetrics(HttpServerMetrics.get()); - if (CommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) { + if (AgentCommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) { builder .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter)) .addOperationMetrics(HttpServerExperimentalMetrics.get()); diff --git a/instrumentation/log4j/log4j-appender-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v1_2/LogEventMapper.java b/instrumentation/log4j/log4j-appender-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v1_2/LogEventMapper.java index da552d0756a0..522ef4ad9fb2 100644 --- a/instrumentation/log4j/log4j-appender-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v1_2/LogEventMapper.java +++ b/instrumentation/log4j/log4j-appender-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v1_2/LogEventMapper.java @@ -15,7 +15,7 @@ import io.opentelemetry.api.logs.Severity; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.internal.cache.Cache; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.semconv.ExceptionAttributes; import io.opentelemetry.semconv.incubating.ThreadIncubatingAttributes; import java.io.PrintWriter; @@ -39,7 +39,7 @@ public final class LogEventMapper { private static final int TRACE_INT = 5000; private static final boolean captureExperimentalAttributes = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.log4j-appender.experimental-log-attributes", false); private final Map> captureMdcAttributes; @@ -49,7 +49,7 @@ public final class LogEventMapper { private LogEventMapper() { List captureMdcAttributes = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getList( "otel.instrumentation.log4j-appender.experimental.capture-mdc-attributes", emptyList()); diff --git a/instrumentation/log4j/log4j-appender-2.17/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v2_17/Log4jHelper.java b/instrumentation/log4j/log4j-appender-2.17/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v2_17/Log4jHelper.java index 940b22a5a5cf..db4099bcfa84 100644 --- a/instrumentation/log4j/log4j-appender-2.17/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v2_17/Log4jHelper.java +++ b/instrumentation/log4j/log4j-appender-2.17/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v2_17/Log4jHelper.java @@ -9,10 +9,10 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.logs.LogRecordBuilder; -import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.InstrumentationConfig; import io.opentelemetry.instrumentation.log4j.appender.v2_17.internal.ContextDataAccessor; import io.opentelemetry.instrumentation.log4j.appender.v2_17.internal.LogEventMapper; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.time.Instant; import java.util.List; import java.util.Map; @@ -31,7 +31,7 @@ public final class Log4jHelper { private static final boolean captureExperimentalAttributes; static { - CoreInstrumentationConfig config = InstrumentationConfig.get(); + InstrumentationConfig config = AgentInstrumentationConfig.get(); captureExperimentalAttributes = config.getBoolean("otel.instrumentation.log4j-appender.experimental-log-attributes", false); diff --git a/instrumentation/log4j/log4j-context-data/log4j-context-data-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/contextdata/v2_7/SpanDecoratingContextDataInjector.java b/instrumentation/log4j/log4j-context-data/log4j-context-data-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/contextdata/v2_7/SpanDecoratingContextDataInjector.java index f4d7dd9c4069..8cd437da9d38 100644 --- a/instrumentation/log4j/log4j-context-data/log4j-context-data-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/contextdata/v2_7/SpanDecoratingContextDataInjector.java +++ b/instrumentation/log4j/log4j-context-data/log4j-context-data-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/contextdata/v2_7/SpanDecoratingContextDataInjector.java @@ -10,9 +10,9 @@ import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanContext; import io.opentelemetry.context.Context; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.bootstrap.internal.ConfiguredResourceAttributesHolder; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; import java.util.List; import java.util.Map; import org.apache.logging.log4j.core.ContextDataInjector; @@ -23,11 +23,11 @@ public final class SpanDecoratingContextDataInjector implements ContextDataInjector { private static final boolean BAGGAGE_ENABLED = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.log4j-context-data.add-baggage", false); - private static final String TRACE_ID_KEY = CommonConfig.get().getTraceIdKey(); - private static final String SPAN_ID_KEY = CommonConfig.get().getSpanIdKey(); - private static final String TRACE_FLAGS_KEY = CommonConfig.get().getTraceFlagsKey(); + private static final String TRACE_ID_KEY = AgentCommonConfig.get().getTraceIdKey(); + private static final String SPAN_ID_KEY = AgentCommonConfig.get().getSpanIdKey(); + private static final String TRACE_FLAGS_KEY = AgentCommonConfig.get().getTraceFlagsKey(); private static final StringMap staticContextData = getStaticContextData(); diff --git a/instrumentation/log4j/log4j-mdc-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/mdc/v1_2/LoggingEventInstrumentation.java b/instrumentation/log4j/log4j-mdc-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/mdc/v1_2/LoggingEventInstrumentation.java index 74df564edfe9..4f2ac37101d5 100644 --- a/instrumentation/log4j/log4j-mdc-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/mdc/v1_2/LoggingEventInstrumentation.java +++ b/instrumentation/log4j/log4j-mdc-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/mdc/v1_2/LoggingEventInstrumentation.java @@ -15,7 +15,7 @@ import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.util.VirtualField; import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.bootstrap.internal.ConfiguredResourceAttributesHolder; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; @@ -49,9 +49,9 @@ public static void onExit( @Advice.This LoggingEvent event, @Advice.Argument(0) String key, @Advice.Return(readOnly = false) Object value) { - if (CommonConfig.get().getTraceIdKey().equals(key) - || CommonConfig.get().getSpanIdKey().equals(key) - || CommonConfig.get().getTraceFlagsKey().equals(key)) { + if (AgentCommonConfig.get().getTraceIdKey().equals(key) + || AgentCommonConfig.get().getSpanIdKey().equals(key) + || AgentCommonConfig.get().getTraceFlagsKey().equals(key)) { if (value != null) { // Assume already instrumented event if traceId/spanId/sampled is present. return; @@ -67,13 +67,13 @@ public static void onExit( return; } - if (CommonConfig.get().getTraceIdKey().equals(key)) { + if (AgentCommonConfig.get().getTraceIdKey().equals(key)) { value = spanContext.getTraceId(); } - if (CommonConfig.get().getSpanIdKey().equals(key)) { + if (AgentCommonConfig.get().getSpanIdKey().equals(key)) { value = spanContext.getSpanId(); } - if (CommonConfig.get().getTraceFlagsKey().equals(key)) { + if (AgentCommonConfig.get().getTraceFlagsKey().equals(key)) { value = spanContext.getTraceFlags().asHex(); } } else if (value == null) { diff --git a/instrumentation/logback/logback-appender-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackSingletons.java b/instrumentation/logback/logback-appender-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackSingletons.java index d54e814d06c7..b2b9eb8a5a92 100644 --- a/instrumentation/logback/logback-appender-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackSingletons.java +++ b/instrumentation/logback/logback-appender-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackSingletons.java @@ -7,9 +7,9 @@ import static java.util.Collections.emptyList; -import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.InstrumentationConfig; import io.opentelemetry.instrumentation.logback.appender.v1_0.internal.LoggingEventMapper; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.util.List; public final class LogbackSingletons { @@ -17,7 +17,7 @@ public final class LogbackSingletons { private static final LoggingEventMapper mapper; static { - CoreInstrumentationConfig config = InstrumentationConfig.get(); + InstrumentationConfig config = AgentInstrumentationConfig.get(); boolean captureExperimentalAttributes = config.getBoolean( diff --git a/instrumentation/logback/logback-mdc-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/mdc/v1_0/LogbackSingletons.java b/instrumentation/logback/logback-mdc-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/mdc/v1_0/LogbackSingletons.java index f2bc2fbe605c..0292488a8150 100644 --- a/instrumentation/logback/logback-mdc-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/mdc/v1_0/LogbackSingletons.java +++ b/instrumentation/logback/logback-mdc-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/mdc/v1_0/LogbackSingletons.java @@ -5,15 +5,16 @@ package io.opentelemetry.javaagent.instrumentation.logback.mdc.v1_0; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class LogbackSingletons { private static final boolean ADD_BAGGAGE = - InstrumentationConfig.get().getBoolean("otel.instrumentation.logback-mdc.add-baggage", false); - private static final String TRACE_ID_KEY = CommonConfig.get().getTraceIdKey(); - private static final String SPAN_ID_KEY = CommonConfig.get().getSpanIdKey(); - private static final String TRACE_FLAGS_KEY = CommonConfig.get().getTraceFlagsKey(); + AgentInstrumentationConfig.get() + .getBoolean("otel.instrumentation.logback-mdc.add-baggage", false); + private static final String TRACE_ID_KEY = AgentCommonConfig.get().getTraceIdKey(); + private static final String SPAN_ID_KEY = AgentCommonConfig.get().getSpanIdKey(); + private static final String TRACE_FLAGS_KEY = AgentCommonConfig.get().getTraceFlagsKey(); public static boolean addBaggage() { return ADD_BAGGAGE; diff --git a/instrumentation/logback/logback-mdc-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/mdc/v1_0/LoggingEventInstrumentation.java b/instrumentation/logback/logback-mdc-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/mdc/v1_0/LoggingEventInstrumentation.java index 4a73ff345282..93768e2f9857 100644 --- a/instrumentation/logback/logback-mdc-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/mdc/v1_0/LoggingEventInstrumentation.java +++ b/instrumentation/logback/logback-mdc-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/mdc/v1_0/LoggingEventInstrumentation.java @@ -24,7 +24,7 @@ import io.opentelemetry.instrumentation.api.util.VirtualField; import io.opentelemetry.instrumentation.logback.mdc.v1_0.internal.UnionMap; import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.bootstrap.internal.ConfiguredResourceAttributesHolder; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; @@ -63,7 +63,7 @@ public static void onExit( @Advice.This ILoggingEvent event, @Advice.Return(typing = Typing.DYNAMIC, readOnly = false) Map contextData) { - if (contextData != null && contextData.containsKey(CommonConfig.get().getTraceIdKey())) { + if (contextData != null && contextData.containsKey(AgentCommonConfig.get().getTraceIdKey())) { // Assume already instrumented event if traceId is present. return; } diff --git a/instrumentation/methods/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/methods/MethodInstrumentationModule.java b/instrumentation/methods/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/methods/MethodInstrumentationModule.java index 38f76de04f71..120088cc77c2 100644 --- a/instrumentation/methods/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/methods/MethodInstrumentationModule.java +++ b/instrumentation/methods/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/methods/MethodInstrumentationModule.java @@ -9,7 +9,7 @@ import static java.util.Collections.singletonList; import com.google.auto.service.AutoService; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; import io.opentelemetry.javaagent.tooling.config.MethodsConfigurationParser; @@ -30,7 +30,7 @@ public MethodInstrumentationModule() { Map> classMethodsToTrace = MethodsConfigurationParser.parse( - InstrumentationConfig.get().getString(TRACE_METHODS_CONFIG)); + AgentInstrumentationConfig.get().getString(TRACE_METHODS_CONFIG)); typeInstrumentations = classMethodsToTrace.entrySet().stream() diff --git a/instrumentation/micrometer/micrometer-1.5/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/v1_5/MicrometerSingletons.java b/instrumentation/micrometer/micrometer-1.5/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/v1_5/MicrometerSingletons.java index 5f70e3645b18..5c08575d0659 100644 --- a/instrumentation/micrometer/micrometer-1.5/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/v1_5/MicrometerSingletons.java +++ b/instrumentation/micrometer/micrometer-1.5/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/v1_5/MicrometerSingletons.java @@ -7,16 +7,16 @@ import io.micrometer.core.instrument.MeterRegistry; import io.opentelemetry.api.GlobalOpenTelemetry; -import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.InstrumentationConfig; import io.opentelemetry.instrumentation.micrometer.v1_5.OpenTelemetryMeterRegistry; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class MicrometerSingletons { private static final MeterRegistry METER_REGISTRY; static { - CoreInstrumentationConfig config = InstrumentationConfig.get(); + InstrumentationConfig config = AgentInstrumentationConfig.get(); METER_REGISTRY = OpenTelemetryMeterRegistry.builder(GlobalOpenTelemetry.get()) .setPrometheusMode( diff --git a/instrumentation/mongo/mongo-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongo/v3_1/MongoInstrumentationSingletons.java b/instrumentation/mongo/mongo-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongo/v3_1/MongoInstrumentationSingletons.java index f9357d0fa3e6..e943f6fbc78c 100644 --- a/instrumentation/mongo/mongo-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongo/v3_1/MongoInstrumentationSingletons.java +++ b/instrumentation/mongo/mongo-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongo/v3_1/MongoInstrumentationSingletons.java @@ -8,18 +8,18 @@ import com.mongodb.event.CommandListener; import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.mongo.v3_1.MongoTelemetry; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class MongoInstrumentationSingletons { public static final CommandListener LISTENER = MongoTelemetry.builder(GlobalOpenTelemetry.get()) .setStatementSanitizationEnabled( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean( "otel.instrumentation.mongo.statement-sanitizer.enabled", - CommonConfig.get().isStatementSanitizationEnabled())) + AgentCommonConfig.get().isStatementSanitizationEnabled())) .build() .newCommandListener(); diff --git a/instrumentation/mongo/mongo-3.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongo/v3_7/MongoInstrumentationSingletons.java b/instrumentation/mongo/mongo-3.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongo/v3_7/MongoInstrumentationSingletons.java index 044ce2f45a5f..9657ac335cbd 100644 --- a/instrumentation/mongo/mongo-3.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongo/v3_7/MongoInstrumentationSingletons.java +++ b/instrumentation/mongo/mongo-3.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongo/v3_7/MongoInstrumentationSingletons.java @@ -8,18 +8,18 @@ import com.mongodb.event.CommandListener; import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.mongo.v3_1.MongoTelemetry; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class MongoInstrumentationSingletons { public static final CommandListener LISTENER = MongoTelemetry.builder(GlobalOpenTelemetry.get()) .setStatementSanitizationEnabled( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean( "otel.instrumentation.mongo.statement-sanitizer.enabled", - CommonConfig.get().isStatementSanitizationEnabled())) + AgentCommonConfig.get().isStatementSanitizationEnabled())) .build() .newCommandListener(); diff --git a/instrumentation/mongo/mongo-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongo/v4_0/MongoInstrumentationSingletons.java b/instrumentation/mongo/mongo-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongo/v4_0/MongoInstrumentationSingletons.java index 74f3bf6cb0b8..3389cc5bb6a3 100644 --- a/instrumentation/mongo/mongo-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongo/v4_0/MongoInstrumentationSingletons.java +++ b/instrumentation/mongo/mongo-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongo/v4_0/MongoInstrumentationSingletons.java @@ -8,18 +8,18 @@ import com.mongodb.event.CommandListener; import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.mongo.v3_1.MongoTelemetry; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class MongoInstrumentationSingletons { public static final CommandListener LISTENER = MongoTelemetry.builder(GlobalOpenTelemetry.get()) .setStatementSanitizationEnabled( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean( "otel.instrumentation.mongo.statement-sanitizer.enabled", - CommonConfig.get().isStatementSanitizationEnabled())) + AgentCommonConfig.get().isStatementSanitizationEnabled())) .build() .newCommandListener(); diff --git a/instrumentation/mongo/mongo-async-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongoasync/v3_3/MongoInstrumentationSingletons.java b/instrumentation/mongo/mongo-async-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongoasync/v3_3/MongoInstrumentationSingletons.java index f502009eb409..2280ce533637 100644 --- a/instrumentation/mongo/mongo-async-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongoasync/v3_3/MongoInstrumentationSingletons.java +++ b/instrumentation/mongo/mongo-async-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongoasync/v3_3/MongoInstrumentationSingletons.java @@ -8,18 +8,18 @@ import com.mongodb.event.CommandListener; import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.mongo.v3_1.MongoTelemetry; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class MongoInstrumentationSingletons { public static final CommandListener LISTENER = MongoTelemetry.builder(GlobalOpenTelemetry.get()) .setStatementSanitizationEnabled( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean( "otel.instrumentation.mongo.statement-sanitizer.enabled", - CommonConfig.get().isStatementSanitizationEnabled())) + AgentCommonConfig.get().isStatementSanitizationEnabled())) .build() .newCommandListener(); diff --git a/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyClientSingletons.java b/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyClientSingletons.java index 4670cf8cabfd..3db67f23dc80 100644 --- a/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyClientSingletons.java +++ b/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyClientSingletons.java @@ -12,7 +12,7 @@ import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractor; import io.opentelemetry.instrumentation.netty.common.internal.NettyConnectionRequest; import io.opentelemetry.instrumentation.netty.common.internal.NettyErrorHolder; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenters; import io.opentelemetry.javaagent.instrumentation.netty.v3_8.HttpRequestAndChannel; import org.jboss.netty.channel.Channel; @@ -44,7 +44,7 @@ public final class NettyClientSingletons { .addAttributesExtractor( HttpClientPeerServiceAttributesExtractor.create( NettyConnectHttpAttributesGetter.INSTANCE, - CommonConfig.get().getPeerServiceResolver())) + AgentCommonConfig.get().getPeerServiceResolver())) .buildInstrumenter(SpanKindExtractor.alwaysClient()); } diff --git a/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/server/NettyServerSingletons.java b/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/server/NettyServerSingletons.java index 12453a12f5bc..5a5719efe676 100644 --- a/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/server/NettyServerSingletons.java +++ b/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/server/NettyServerSingletons.java @@ -16,7 +16,7 @@ import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor; import io.opentelemetry.instrumentation.netty.common.internal.NettyErrorHolder; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.instrumentation.netty.v3_8.HttpRequestAndChannel; import org.jboss.netty.handler.codec.http.HttpResponse; @@ -32,17 +32,17 @@ final class NettyServerSingletons { GlobalOpenTelemetry.get(), "io.opentelemetry.netty-3.8", HttpSpanNameExtractor.builder(httpAttributesGetter) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter)) .addAttributesExtractor( HttpServerAttributesExtractor.builder(httpAttributesGetter) - .setCapturedRequestHeaders(CommonConfig.get().getServerRequestHeaders()) - .setCapturedResponseHeaders(CommonConfig.get().getServerResponseHeaders()) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setCapturedRequestHeaders(AgentCommonConfig.get().getServerRequestHeaders()) + .setCapturedResponseHeaders(AgentCommonConfig.get().getServerResponseHeaders()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .addOperationMetrics(HttpServerMetrics.get()); - if (CommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) { + if (AgentCommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) { builder .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter)) .addOperationMetrics(HttpServerExperimentalMetrics.get()); @@ -53,7 +53,7 @@ final class NettyServerSingletons { (context, requestAndChannel, startAttributes) -> NettyErrorHolder.init(context)) .addContextCustomizer( HttpServerRoute.builder(httpAttributesGetter) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .buildServerInstrumenter(NettyHeadersGetter.INSTANCE); } diff --git a/instrumentation/netty/netty-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_0/client/NettyClientSingletons.java b/instrumentation/netty/netty-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_0/client/NettyClientSingletons.java index fe0ae9006dc3..1c5a49abaef8 100644 --- a/instrumentation/netty/netty-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_0/client/NettyClientSingletons.java +++ b/instrumentation/netty/netty-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_0/client/NettyClientSingletons.java @@ -14,18 +14,18 @@ import io.opentelemetry.instrumentation.netty.v4.common.internal.client.NettyClientInstrumenterFactory; import io.opentelemetry.instrumentation.netty.v4.common.internal.client.NettyConnectionInstrumenter; import io.opentelemetry.instrumentation.netty.v4.common.internal.client.NettySslInstrumenter; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.util.Collections; import java.util.function.Function; public final class NettyClientSingletons { private static final boolean connectionTelemetryEnabled = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.netty.connection-telemetry.enabled", false); private static final boolean sslTelemetryEnabled = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.netty.ssl-telemetry.enabled", false); private static final Instrumenter INSTRUMENTER; @@ -39,16 +39,17 @@ public final class NettyClientSingletons { "io.opentelemetry.netty-4.0", enabledOrErrorOnly(connectionTelemetryEnabled), enabledOrErrorOnly(sslTelemetryEnabled), - CommonConfig.get().getPeerServiceResolver(), - CommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()); + AgentCommonConfig.get().getPeerServiceResolver(), + AgentCommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()); INSTRUMENTER = factory.createHttpInstrumenter( builder -> builder - .setCapturedRequestHeaders(CommonConfig.get().getClientRequestHeaders()) - .setCapturedResponseHeaders(CommonConfig.get().getClientResponseHeaders()) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()), - builder -> builder.setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()), + .setCapturedRequestHeaders(AgentCommonConfig.get().getClientRequestHeaders()) + .setCapturedResponseHeaders(AgentCommonConfig.get().getClientResponseHeaders()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()), + builder -> + builder.setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()), Function.identity(), Collections.emptyList()); CONNECTION_INSTRUMENTER = factory.createConnectionInstrumenter(); diff --git a/instrumentation/netty/netty-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_0/server/NettyServerSingletons.java b/instrumentation/netty/netty-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_0/server/NettyServerSingletons.java index 4059c16bbfb5..e85212f363cc 100644 --- a/instrumentation/netty/netty-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_0/server/NettyServerSingletons.java +++ b/instrumentation/netty/netty-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_0/server/NettyServerSingletons.java @@ -10,7 +10,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.netty.v4.common.HttpRequestAndChannel; import io.opentelemetry.instrumentation.netty.v4.common.internal.server.NettyServerInstrumenterFactory; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; public final class NettyServerSingletons { @@ -20,12 +20,12 @@ public final class NettyServerSingletons { "io.opentelemetry.netty-4.0", builder -> builder - .setCapturedRequestHeaders(CommonConfig.get().getServerRequestHeaders()) - .setCapturedResponseHeaders(CommonConfig.get().getServerResponseHeaders()) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()), - builder -> builder.setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()), - builder -> builder.setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()), - CommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()); + .setCapturedRequestHeaders(AgentCommonConfig.get().getServerRequestHeaders()) + .setCapturedResponseHeaders(AgentCommonConfig.get().getServerResponseHeaders()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()), + builder -> builder.setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()), + builder -> builder.setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()), + AgentCommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()); public static Instrumenter instrumenter() { return INSTRUMENTER; diff --git a/instrumentation/netty/netty-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_1/NettyClientSingletons.java b/instrumentation/netty/netty-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_1/NettyClientSingletons.java index e49c8c5375dd..72886c37ce3d 100644 --- a/instrumentation/netty/netty-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_1/NettyClientSingletons.java +++ b/instrumentation/netty/netty-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_1/NettyClientSingletons.java @@ -15,18 +15,18 @@ import io.opentelemetry.instrumentation.netty.v4.common.internal.client.NettyConnectionInstrumenter; import io.opentelemetry.instrumentation.netty.v4.common.internal.client.NettySslInstrumenter; import io.opentelemetry.instrumentation.netty.v4_1.internal.client.NettyClientHandlerFactory; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.util.Collections; import java.util.function.Function; public final class NettyClientSingletons { private static final boolean connectionTelemetryEnabled = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.netty.connection-telemetry.enabled", false); private static final boolean sslTelemetryEnabled = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.netty.ssl-telemetry.enabled", false); private static final Instrumenter INSTRUMENTER; @@ -41,23 +41,24 @@ public final class NettyClientSingletons { "io.opentelemetry.netty-4.1", enabledOrErrorOnly(connectionTelemetryEnabled), enabledOrErrorOnly(sslTelemetryEnabled), - CommonConfig.get().getPeerServiceResolver(), - CommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()); + AgentCommonConfig.get().getPeerServiceResolver(), + AgentCommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()); INSTRUMENTER = factory.createHttpInstrumenter( builder -> builder - .setCapturedRequestHeaders(CommonConfig.get().getClientRequestHeaders()) - .setCapturedResponseHeaders(CommonConfig.get().getClientResponseHeaders()) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()), - builder -> builder.setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()), + .setCapturedRequestHeaders(AgentCommonConfig.get().getClientRequestHeaders()) + .setCapturedResponseHeaders(AgentCommonConfig.get().getClientResponseHeaders()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()), + builder -> + builder.setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()), Function.identity(), Collections.emptyList()); CONNECTION_INSTRUMENTER = factory.createConnectionInstrumenter(); SSL_INSTRUMENTER = factory.createSslInstrumenter(); CLIENT_HANDLER_FACTORY = new NettyClientHandlerFactory( - INSTRUMENTER, CommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()); + INSTRUMENTER, AgentCommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()); } public static Instrumenter instrumenter() { diff --git a/instrumentation/netty/netty-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_1/NettyServerSingletons.java b/instrumentation/netty/netty-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_1/NettyServerSingletons.java index e99d1227721f..6203880260a8 100644 --- a/instrumentation/netty/netty-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_1/NettyServerSingletons.java +++ b/instrumentation/netty/netty-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_1/NettyServerSingletons.java @@ -7,7 +7,7 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.netty.v4_1.NettyServerTelemetry; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; public final class NettyServerSingletons { @@ -15,12 +15,12 @@ public final class NettyServerSingletons { SERVER_TELEMETRY = NettyServerTelemetry.builder(GlobalOpenTelemetry.get()) .setEmitExperimentalHttpServerEvents( - CommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) + AgentCommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) .setEmitExperimentalHttpServerMetrics( - CommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) - .setCapturedRequestHeaders(CommonConfig.get().getServerRequestHeaders()) - .setCapturedResponseHeaders(CommonConfig.get().getServerResponseHeaders()) + AgentCommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) + .setCapturedRequestHeaders(AgentCommonConfig.get().getServerRequestHeaders()) + .setCapturedResponseHeaders(AgentCommonConfig.get().getServerResponseHeaders()) .build(); } diff --git a/instrumentation/opentelemetry-extension-annotations-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extensionannotations/WithSpanInstrumentation.java b/instrumentation/opentelemetry-extension-annotations-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extensionannotations/WithSpanInstrumentation.java index f3c39511af12..4d99fcafbd3d 100644 --- a/instrumentation/opentelemetry-extension-annotations-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extensionannotations/WithSpanInstrumentation.java +++ b/instrumentation/opentelemetry-extension-annotations-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extensionannotations/WithSpanInstrumentation.java @@ -21,7 +21,7 @@ import io.opentelemetry.instrumentation.api.annotation.support.async.AsyncOperationEndSupport; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; import io.opentelemetry.javaagent.tooling.config.MethodsConfigurationParser; @@ -98,7 +98,7 @@ static ElementMatcher.Junction configureExcludedMethods() { Map> excludedMethods = MethodsConfigurationParser.parse( - InstrumentationConfig.get().getString(TRACE_ANNOTATED_METHODS_EXCLUDE_CONFIG)); + AgentInstrumentationConfig.get().getString(TRACE_ANNOTATED_METHODS_EXCLUDE_CONFIG)); for (Map.Entry> entry : excludedMethods.entrySet()) { String className = entry.getKey(); ElementMatcher.Junction matcher = diff --git a/instrumentation/opentelemetry-instrumentation-annotations-1.16/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/instrumentationannotations/AnnotationExcludedMethods.java b/instrumentation/opentelemetry-instrumentation-annotations-1.16/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/instrumentationannotations/AnnotationExcludedMethods.java index b25d6900f708..9bec0120fe70 100644 --- a/instrumentation/opentelemetry-instrumentation-annotations-1.16/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/instrumentationannotations/AnnotationExcludedMethods.java +++ b/instrumentation/opentelemetry-instrumentation-annotations-1.16/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/instrumentationannotations/AnnotationExcludedMethods.java @@ -9,7 +9,7 @@ import static net.bytebuddy.matcher.ElementMatchers.namedOneOf; import static net.bytebuddy.matcher.ElementMatchers.none; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.tooling.config.MethodsConfigurationParser; import java.util.Map; import java.util.Set; @@ -32,7 +32,7 @@ public static ElementMatcher.Junction configureExcludedMethod Map> excludedMethods = MethodsConfigurationParser.parse( - InstrumentationConfig.get().getString(TRACE_ANNOTATED_METHODS_EXCLUDE_CONFIG)); + AgentInstrumentationConfig.get().getString(TRACE_ANNOTATED_METHODS_EXCLUDE_CONFIG)); for (Map.Entry> entry : excludedMethods.entrySet()) { String className = entry.getKey(); ElementMatcher.Junction matcher = diff --git a/instrumentation/oshi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/oshi/MetricsRegistration.java b/instrumentation/oshi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/oshi/MetricsRegistration.java index 424ee503a640..742e20909781 100644 --- a/instrumentation/oshi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/oshi/MetricsRegistration.java +++ b/instrumentation/oshi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/oshi/MetricsRegistration.java @@ -8,7 +8,7 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.oshi.ProcessMetrics; import io.opentelemetry.instrumentation.oshi.SystemMetrics; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; @@ -23,7 +23,7 @@ public static void register() { observables.addAll(SystemMetrics.registerObservers(GlobalOpenTelemetry.get())); // ProcessMetrics don't follow the spec - if (InstrumentationConfig.get() + if (AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.oshi.experimental-metrics.enabled", false)) { observables.addAll(ProcessMetrics.registerObservers(GlobalOpenTelemetry.get())); } diff --git a/instrumentation/pekko/pekko-http-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/server/PekkoHttpServerSingletons.java b/instrumentation/pekko/pekko-http-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/server/PekkoHttpServerSingletons.java index 6128e5d13762..8618492181d6 100644 --- a/instrumentation/pekko/pekko-http-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/server/PekkoHttpServerSingletons.java +++ b/instrumentation/pekko/pekko-http-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/server/PekkoHttpServerSingletons.java @@ -15,7 +15,7 @@ import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRoute; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.instrumentation.pekkohttp.v1_0.PekkoHttpUtil; import org.apache.pekko.http.scaladsl.model.HttpRequest; import org.apache.pekko.http.scaladsl.model.HttpResponse; @@ -34,16 +34,16 @@ public final class PekkoHttpServerSingletons { .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter)) .addAttributesExtractor( HttpServerAttributesExtractor.builder(httpAttributesGetter) - .setCapturedRequestHeaders(CommonConfig.get().getServerRequestHeaders()) - .setCapturedResponseHeaders(CommonConfig.get().getServerResponseHeaders()) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setCapturedRequestHeaders(AgentCommonConfig.get().getServerRequestHeaders()) + .setCapturedResponseHeaders(AgentCommonConfig.get().getServerResponseHeaders()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .addOperationMetrics(HttpServerMetrics.get()) .addContextCustomizer( HttpServerRoute.builder(httpAttributesGetter) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()); - if (CommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) { + if (AgentCommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) { builder .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter)) .addOperationMetrics(HttpServerExperimentalMetrics.get()); diff --git a/instrumentation/pulsar/pulsar-2.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/telemetry/PulsarSingletons.java b/instrumentation/pulsar/pulsar-2.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/telemetry/PulsarSingletons.java index 498c075f68d6..1d05086ef401 100644 --- a/instrumentation/pulsar/pulsar-2.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/telemetry/PulsarSingletons.java +++ b/instrumentation/pulsar/pulsar-2.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/telemetry/PulsarSingletons.java @@ -23,8 +23,8 @@ import io.opentelemetry.instrumentation.api.internal.PropagatorBasedSpanLinksExtractor; import io.opentelemetry.instrumentation.api.internal.Timer; import io.opentelemetry.instrumentation.api.semconv.network.ServerAttributesExtractor; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.bootstrap.internal.ExperimentalConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; import io.opentelemetry.javaagent.instrumentation.pulsar.v2_8.VirtualFieldStore; import java.util.List; import java.util.concurrent.CompletableFuture; @@ -138,7 +138,7 @@ private static Instrumenter createProducerInstrumenter() { .addAttributesExtractor( ServerAttributesExtractor.create(new PulsarNetClientAttributesGetter())); - if (InstrumentationConfig.get() + if (AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.pulsar.experimental-span-attributes", false)) { builder.addAttributesExtractor(ExperimentalProducerAttributesExtractor.INSTANCE); } diff --git a/instrumentation/quartz-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/quartz/v2_0/QuartzSingletons.java b/instrumentation/quartz-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/quartz/v2_0/QuartzSingletons.java index f467c4d40acf..6d0b5c046575 100644 --- a/instrumentation/quartz-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/quartz/v2_0/QuartzSingletons.java +++ b/instrumentation/quartz-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/quartz/v2_0/QuartzSingletons.java @@ -7,14 +7,14 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.quartz.v2_0.QuartzTelemetry; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class QuartzSingletons { public static final QuartzTelemetry TELEMETRY = QuartzTelemetry.builder(GlobalOpenTelemetry.get()) .setCaptureExperimentalSpanAttributes( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.quartz.experimental-span-attributes", false)) .build(); diff --git a/instrumentation/r2dbc-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/r2dbc/v1_0/R2dbcSingletons.java b/instrumentation/r2dbc-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/r2dbc/v1_0/R2dbcSingletons.java index 9be60235bfc5..8ac63c9aa873 100644 --- a/instrumentation/r2dbc-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/r2dbc/v1_0/R2dbcSingletons.java +++ b/instrumentation/r2dbc-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/r2dbc/v1_0/R2dbcSingletons.java @@ -9,21 +9,22 @@ import io.opentelemetry.instrumentation.api.incubator.semconv.net.PeerServiceAttributesExtractor; import io.opentelemetry.instrumentation.r2dbc.v1_0.R2dbcTelemetry; import io.opentelemetry.instrumentation.r2dbc.v1_0.internal.R2dbcNetAttributesGetter; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class R2dbcSingletons { private static final R2dbcTelemetry TELEMETRY = R2dbcTelemetry.builder(GlobalOpenTelemetry.get()) .setStatementSanitizationEnabled( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean( "otel.instrumentation.r2dbc.statement-sanitizer.enabled", - CommonConfig.get().isStatementSanitizationEnabled())) + AgentCommonConfig.get().isStatementSanitizationEnabled())) .addAttributeExtractor( PeerServiceAttributesExtractor.create( - R2dbcNetAttributesGetter.INSTANCE, CommonConfig.get().getPeerServiceResolver())) + R2dbcNetAttributesGetter.INSTANCE, + AgentCommonConfig.get().getPeerServiceResolver())) .build(); public static R2dbcTelemetry telemetry() { diff --git a/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitInstrumenterHelper.java b/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitInstrumenterHelper.java index 604b2e732cb0..2f0c77addc01 100644 --- a/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitInstrumenterHelper.java +++ b/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitInstrumenterHelper.java @@ -13,7 +13,7 @@ import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Context; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes; import java.util.Map; @@ -21,7 +21,7 @@ public class RabbitInstrumenterHelper { static final AttributeKey RABBITMQ_COMMAND = AttributeKey.stringKey("rabbitmq.command"); private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.rabbitmq.experimental-span-attributes", false); private static final RabbitInstrumenterHelper INSTRUMENTER_HELPER = diff --git a/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitSingletons.java b/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitSingletons.java index 59490a798506..c8af3a8784d6 100644 --- a/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitSingletons.java +++ b/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitSingletons.java @@ -19,15 +19,15 @@ import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor; import io.opentelemetry.instrumentation.api.internal.PropagatorBasedSpanLinksExtractor; import io.opentelemetry.instrumentation.api.semconv.network.NetworkAttributesExtractor; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.bootstrap.internal.ExperimentalConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; import java.util.ArrayList; import java.util.List; public final class RabbitSingletons { private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.rabbitmq.experimental-span-attributes", false); private static final String instrumentationName = "io.opentelemetry.rabbitmq-2.7"; private static final Instrumenter channelInstrumenter = diff --git a/instrumentation/reactor/reactor-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactor/v3_1/HooksInstrumentation.java b/instrumentation/reactor/reactor-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactor/v3_1/HooksInstrumentation.java index aeb32f290435..0591db7569ea 100644 --- a/instrumentation/reactor/reactor-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactor/v3_1/HooksInstrumentation.java +++ b/instrumentation/reactor/reactor-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactor/v3_1/HooksInstrumentation.java @@ -10,7 +10,7 @@ import static net.bytebuddy.matcher.ElementMatchers.namedOneOf; import io.opentelemetry.instrumentation.reactor.v3_1.ContextPropagationOperator; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; import net.bytebuddy.asm.Advice; @@ -41,7 +41,7 @@ public static class ResetOnEachOperatorAdvice { public static void postStaticInitializer() { ContextPropagationOperator.builder() .setCaptureExperimentalSpanAttributes( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.reactor.experimental-span-attributes", false)) .build() .registerOnEachOperator(); diff --git a/instrumentation/reactor/reactor-kafka-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactor/kafka/v1_0/ReactorKafkaSingletons.java b/instrumentation/reactor/reactor-kafka-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactor/kafka/v1_0/ReactorKafkaSingletons.java index b5b8e309f58a..66b7ace29c92 100644 --- a/instrumentation/reactor/reactor-kafka-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactor/kafka/v1_0/ReactorKafkaSingletons.java +++ b/instrumentation/reactor/reactor-kafka-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactor/kafka/v1_0/ReactorKafkaSingletons.java @@ -9,8 +9,8 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.kafka.internal.KafkaInstrumenterFactory; import io.opentelemetry.instrumentation.kafka.internal.KafkaProcessRequest; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.bootstrap.internal.ExperimentalConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; final class ReactorKafkaSingletons { @@ -20,7 +20,7 @@ final class ReactorKafkaSingletons { new KafkaInstrumenterFactory(GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME) .setCapturedHeaders(ExperimentalConfig.get().getMessagingHeaders()) .setCaptureExperimentalSpanAttributes( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.kafka.experimental-span-attributes", false)) .setMessagingReceiveInstrumentationEnabled( ExperimentalConfig.get().messagingReceiveInstrumentationEnabled()) diff --git a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettySingletons.java b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettySingletons.java index be0e19fb22cf..955a27503a70 100644 --- a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettySingletons.java +++ b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettySingletons.java @@ -10,8 +10,8 @@ import io.opentelemetry.instrumentation.netty.v4.common.internal.client.NettyClientInstrumenterFactory; import io.opentelemetry.instrumentation.netty.v4.common.internal.client.NettyConnectionInstrumentationFlag; import io.opentelemetry.instrumentation.netty.v4.common.internal.client.NettyConnectionInstrumenter; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenters; import reactor.netty.http.client.HttpClientRequest; import reactor.netty.http.client.HttpClientResponse; @@ -21,7 +21,7 @@ public final class ReactorNettySingletons { private static final String INSTRUMENTATION_NAME = "io.opentelemetry.reactor-netty-1.0"; private static final boolean connectionTelemetryEnabled = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.reactor-netty.connection-telemetry.enabled", false); private static final Instrumenter INSTRUMENTER; @@ -42,8 +42,8 @@ public final class ReactorNettySingletons { ? NettyConnectionInstrumentationFlag.ENABLED : NettyConnectionInstrumentationFlag.DISABLED, NettyConnectionInstrumentationFlag.DISABLED, - CommonConfig.get().getPeerServiceResolver(), - CommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()); + AgentCommonConfig.get().getPeerServiceResolver(), + AgentCommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()); CONNECTION_INSTRUMENTER = instrumenterFactory.createConnectionInstrumenter(); } diff --git a/instrumentation/redisson/redisson-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/redisson/RedissonRequest.java b/instrumentation/redisson/redisson-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/redisson/RedissonRequest.java index 6b34e59e19c5..4d0bbc4606a7 100644 --- a/instrumentation/redisson/redisson-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/redisson/RedissonRequest.java +++ b/instrumentation/redisson/redisson-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/redisson/RedissonRequest.java @@ -11,7 +11,7 @@ import com.google.auto.value.AutoValue; import io.netty.buffer.ByteBuf; import io.opentelemetry.instrumentation.api.incubator.semconv.db.RedisCommandSanitizer; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; @@ -29,7 +29,7 @@ public abstract class RedissonRequest { private static final RedisCommandSanitizer sanitizer = - RedisCommandSanitizer.create(CommonConfig.get().isStatementSanitizationEnabled()); + RedisCommandSanitizer.create(AgentCommonConfig.get().isStatementSanitizationEnabled()); public static RedissonRequest create(InetSocketAddress address, Object command) { return new AutoValue_RedissonRequest(address, command); diff --git a/instrumentation/restlet/restlet-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/restlet/v1_1/RestletSingletons.java b/instrumentation/restlet/restlet-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/restlet/v1_1/RestletSingletons.java index 25a07e75f39c..0e2332b1e984 100644 --- a/instrumentation/restlet/restlet-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/restlet/v1_1/RestletSingletons.java +++ b/instrumentation/restlet/restlet-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/restlet/v1_1/RestletSingletons.java @@ -9,7 +9,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRouteGetter; import io.opentelemetry.instrumentation.restlet.v1_1.RestletTelemetry; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.bootstrap.servlet.ServletContextPath; import org.restlet.data.Request; import org.restlet.data.Response; @@ -18,9 +18,9 @@ public final class RestletSingletons { private static final Instrumenter INSTRUMENTER = RestletTelemetry.builder(GlobalOpenTelemetry.get()) - .setCapturedRequestHeaders(CommonConfig.get().getServerRequestHeaders()) - .setCapturedResponseHeaders(CommonConfig.get().getServerResponseHeaders()) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setCapturedRequestHeaders(AgentCommonConfig.get().getServerRequestHeaders()) + .setCapturedResponseHeaders(AgentCommonConfig.get().getServerResponseHeaders()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build() .getServerInstrumenter(); diff --git a/instrumentation/restlet/restlet-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/restlet/v2_0/RestletSingletons.java b/instrumentation/restlet/restlet-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/restlet/v2_0/RestletSingletons.java index 8e55012b8aaf..0b8f6607964c 100644 --- a/instrumentation/restlet/restlet-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/restlet/v2_0/RestletSingletons.java +++ b/instrumentation/restlet/restlet-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/restlet/v2_0/RestletSingletons.java @@ -13,7 +13,7 @@ import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor; import io.opentelemetry.instrumentation.restlet.v2_0.internal.RestletHttpAttributesGetter; import io.opentelemetry.instrumentation.restlet.v2_0.internal.RestletInstrumenterFactory; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.bootstrap.servlet.ServletContextPath; import java.util.Collections; import org.restlet.Request; @@ -25,18 +25,18 @@ public final class RestletSingletons { RestletInstrumenterFactory.newServerInstrumenter( GlobalOpenTelemetry.get(), HttpServerAttributesExtractor.builder(RestletHttpAttributesGetter.INSTANCE) - .setCapturedRequestHeaders(CommonConfig.get().getServerRequestHeaders()) - .setCapturedResponseHeaders(CommonConfig.get().getServerResponseHeaders()) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setCapturedRequestHeaders(AgentCommonConfig.get().getServerRequestHeaders()) + .setCapturedResponseHeaders(AgentCommonConfig.get().getServerResponseHeaders()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build(), HttpSpanNameExtractor.builder(RestletHttpAttributesGetter.INSTANCE) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build(), HttpServerRoute.builder(RestletHttpAttributesGetter.INSTANCE) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build(), Collections.emptyList(), - CommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()); + AgentCommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()); public static Instrumenter instrumenter() { return INSTRUMENTER; diff --git a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v4_8/RocketMqClientHooks.java b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v4_8/RocketMqClientHooks.java index 0528fdd52191..7c2b958ca4f9 100644 --- a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v4_8/RocketMqClientHooks.java +++ b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v4_8/RocketMqClientHooks.java @@ -7,8 +7,8 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.rocketmqclient.v4_8.RocketMqTelemetry; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.bootstrap.internal.ExperimentalConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; import org.apache.rocketmq.client.hook.ConsumeMessageHook; import org.apache.rocketmq.client.hook.SendMessageHook; @@ -19,7 +19,7 @@ public final class RocketMqClientHooks { RocketMqTelemetry.builder(GlobalOpenTelemetry.get()) .setCapturedHeaders(ExperimentalConfig.get().getMessagingHeaders()) .setCaptureExperimentalSpanAttributes( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean( "otel.instrumentation.rocketmq-client.experimental-span-attributes", false)) .build(); diff --git a/instrumentation/rxjava/rxjava-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rxjava/v2_0/TracingAssemblyActivation.java b/instrumentation/rxjava/rxjava-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rxjava/v2_0/TracingAssemblyActivation.java index bd1a4c1a6e6e..91f3b108b71a 100644 --- a/instrumentation/rxjava/rxjava-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rxjava/v2_0/TracingAssemblyActivation.java +++ b/instrumentation/rxjava/rxjava-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rxjava/v2_0/TracingAssemblyActivation.java @@ -6,7 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.rxjava.v2_0; import io.opentelemetry.instrumentation.rxjava.v2_0.TracingAssembly; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.util.concurrent.atomic.AtomicBoolean; public final class TracingAssemblyActivation { @@ -23,7 +23,7 @@ public static void activate(Class clz) { if (activated.get(clz).compareAndSet(false, true)) { TracingAssembly.builder() .setCaptureExperimentalSpanAttributes( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.rxjava.experimental-span-attributes", false)) .build() .enable(); diff --git a/instrumentation/rxjava/rxjava-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rxjava/v3_0/TracingAssemblyActivation.java b/instrumentation/rxjava/rxjava-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rxjava/v3_0/TracingAssemblyActivation.java index 69efa44cd3d1..2dd5a0696be7 100644 --- a/instrumentation/rxjava/rxjava-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rxjava/v3_0/TracingAssemblyActivation.java +++ b/instrumentation/rxjava/rxjava-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rxjava/v3_0/TracingAssemblyActivation.java @@ -6,7 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.rxjava.v3_0; import io.opentelemetry.instrumentation.rxjava.v3_0.TracingAssembly; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.util.concurrent.atomic.AtomicBoolean; public final class TracingAssemblyActivation { @@ -23,7 +23,7 @@ public static void activate(Class clz) { if (activated.get(clz).compareAndSet(false, true)) { TracingAssembly.builder() .setCaptureExperimentalSpanAttributes( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.rxjava.experimental-span-attributes", false)) .build() .enable(); diff --git a/instrumentation/rxjava/rxjava-3.1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rxjava/v3_1_1/TracingAssemblyActivation.java b/instrumentation/rxjava/rxjava-3.1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rxjava/v3_1_1/TracingAssemblyActivation.java index 79caeb74001d..ca5126be9338 100644 --- a/instrumentation/rxjava/rxjava-3.1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rxjava/v3_1_1/TracingAssemblyActivation.java +++ b/instrumentation/rxjava/rxjava-3.1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rxjava/v3_1_1/TracingAssemblyActivation.java @@ -6,7 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.rxjava.v3_1_1; import io.opentelemetry.instrumentation.rxjava.v3_1_1.TracingAssembly; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.util.concurrent.atomic.AtomicBoolean; public final class TracingAssemblyActivation { @@ -23,7 +23,7 @@ public static void activate(Class clz) { if (activated.get(clz).compareAndSet(false, true)) { TracingAssembly.builder() .setCaptureExperimentalSpanAttributes( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.rxjava.experimental-span-attributes", false)) .build() .enable(); diff --git a/instrumentation/servlet/servlet-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v2_2/Servlet2SpanNameExtractor.java b/instrumentation/servlet/servlet-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v2_2/Servlet2SpanNameExtractor.java index 40403d458a13..7091be708516 100644 --- a/instrumentation/servlet/servlet-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v2_2/Servlet2SpanNameExtractor.java +++ b/instrumentation/servlet/servlet-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v2_2/Servlet2SpanNameExtractor.java @@ -6,7 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.servlet.v2_2; import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.instrumentation.servlet.ServletAccessor; import io.opentelemetry.javaagent.instrumentation.servlet.ServletRequestContext; import java.util.Set; @@ -15,7 +15,7 @@ public class Servlet2SpanNameExtractor implements SpanNameExtractor> { private final ServletAccessor accessor; - private final Set knownMethods = CommonConfig.get().getKnownHttpRequestMethods(); + private final Set knownMethods = AgentCommonConfig.get().getKnownHttpRequestMethods(); public Servlet2SpanNameExtractor(ServletAccessor accessor) { this.accessor = accessor; diff --git a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/BaseServletHelper.java b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/BaseServletHelper.java index d485a2f7ea2b..076c43c1c9c3 100644 --- a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/BaseServletHelper.java +++ b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/BaseServletHelper.java @@ -14,7 +14,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.LocalRootSpan; import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRoute; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.bootstrap.servlet.AppServerBridge; import io.opentelemetry.javaagent.bootstrap.servlet.MappingResolver; import io.opentelemetry.javaagent.bootstrap.servlet.ServletContextPath; @@ -136,7 +136,7 @@ private void captureRequestParameters(Span serverSpan, REQUEST request) { * created by servlet instrumentation we call this method on exit from the last servlet or filter. */ private void captureEnduserId(Span serverSpan, REQUEST request) { - if (!CommonConfig.get().getEnduserConfig().isIdEnabled()) { + if (!AgentCommonConfig.get().getEnduserConfig().isIdEnabled()) { return; } diff --git a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletAdditionalAttributesExtractor.java b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletAdditionalAttributesExtractor.java index f39f3b9f2f1d..3ecebe26fe3b 100644 --- a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletAdditionalAttributesExtractor.java +++ b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletAdditionalAttributesExtractor.java @@ -11,8 +11,8 @@ import io.opentelemetry.api.common.AttributesBuilder; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.semconv.incubating.EnduserIncubatingAttributes; import java.security.Principal; import javax.annotation.Nullable; @@ -21,7 +21,7 @@ public class ServletAdditionalAttributesExtractor implements AttributesExtractor< ServletRequestContext, ServletResponseContext> { private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.servlet.experimental-span-attributes", false); private static final AttributeKey SERVLET_TIMEOUT = longKey("servlet.timeout"); @@ -44,7 +44,7 @@ public void onEnd( ServletRequestContext requestContext, @Nullable ServletResponseContext responseContext, @Nullable Throwable error) { - if (CommonConfig.get().getEnduserConfig().isIdEnabled()) { + if (AgentCommonConfig.get().getEnduserConfig().isIdEnabled()) { Principal principal = accessor.getRequestUserPrincipal(requestContext.request()); if (principal != null) { String name = principal.getName(); diff --git a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletInstrumenterBuilder.java b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletInstrumenterBuilder.java index a0024583fe0c..8aa9339e7c6b 100644 --- a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletInstrumenterBuilder.java +++ b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletInstrumenterBuilder.java @@ -20,7 +20,7 @@ import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRoute; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import java.util.ArrayList; import java.util.List; @@ -61,15 +61,15 @@ public Instrumenter, ServletResponseContext, ServletResponseContext> @@ -80,7 +80,7 @@ public Instrumenter, ServletResponseContext, ServletResponseContext(accessor); SpanNameExtractor> spanNameExtractor = HttpSpanNameExtractor.builder(httpAttributesGetter) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build(); return build(instrumentationName, accessor, spanNameExtractor, httpAttributesGetter); diff --git a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletRequestParametersExtractor.java b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletRequestParametersExtractor.java index dec1edbaecdf..cf3c36ecc8c2 100644 --- a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletRequestParametersExtractor.java +++ b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletRequestParametersExtractor.java @@ -11,7 +11,7 @@ import io.opentelemetry.api.common.AttributesBuilder; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.util.List; import java.util.Locale; import java.util.concurrent.ConcurrentHashMap; @@ -23,7 +23,7 @@ public class ServletRequestParametersExtractor implements AttributesExtractor< ServletRequestContext, ServletResponseContext> { private static final List CAPTURE_REQUEST_PARAMETERS = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getList( "otel.instrumentation.servlet.experimental.capture-request-parameters", emptyList()); diff --git a/instrumentation/spring/spring-batch-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/batch/v3_0/SpringBatchInstrumentationConfig.java b/instrumentation/spring/spring-batch-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/batch/v3_0/SpringBatchInstrumentationConfig.java index 0185b64750ed..5dac88c313fa 100644 --- a/instrumentation/spring/spring-batch-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/batch/v3_0/SpringBatchInstrumentationConfig.java +++ b/instrumentation/spring/spring-batch-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/batch/v3_0/SpringBatchInstrumentationConfig.java @@ -5,7 +5,7 @@ package io.opentelemetry.javaagent.instrumentation.spring.batch.v3_0; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class SpringBatchInstrumentationConfig { @@ -13,10 +13,10 @@ public final class SpringBatchInstrumentationConfig { // the item level instrumentation is very chatty so it's disabled by default private static final boolean ITEM_TRACING_ENABLED = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.spring-batch.item.enabled", false); private static final boolean CREATE_ROOT_SPAN_FOR_CHUNK = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.spring-batch.experimental.chunk.new-trace", false); public static String instrumentationName() { diff --git a/instrumentation/spring/spring-batch-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/batch/v3_0/job/JobSingletons.java b/instrumentation/spring/spring-batch-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/batch/v3_0/job/JobSingletons.java index 2a3acdf2eea9..1f75b22ea1b1 100644 --- a/instrumentation/spring/spring-batch-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/batch/v3_0/job/JobSingletons.java +++ b/instrumentation/spring/spring-batch-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/batch/v3_0/job/JobSingletons.java @@ -12,13 +12,13 @@ import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import org.springframework.batch.core.JobExecution; public class JobSingletons { private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.spring-batch.experimental-span-attributes", false); private static final Instrumenter INSTRUMENTER; diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/ConfigPropertiesBridge.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/ConfigPropertiesBridge.java index 0ec344eb172f..49d50f94cc5c 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/ConfigPropertiesBridge.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/ConfigPropertiesBridge.java @@ -5,7 +5,7 @@ package io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties; -import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.InstrumentationConfig; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; import java.time.Duration; @@ -13,7 +13,7 @@ import java.util.Map; import javax.annotation.Nullable; -final class ConfigPropertiesBridge implements CoreInstrumentationConfig { +final class ConfigPropertiesBridge implements InstrumentationConfig { private final ConfigProperties configProperties; diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java index b66bc5d20da3..692f7296b375 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java @@ -7,7 +7,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import io.opentelemetry.instrumentation.api.incubator.builder.internal.DefaultHttpClientInstrumenterBuilder; -import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreCommonConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.CommonConfig; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import java.util.function.Function; @@ -23,7 +23,7 @@ public static T configureBuilder( ConfigProperties config, T builder, Function> getBuilder) { - getBuilder.apply(builder).configure(new CoreCommonConfig(new ConfigPropertiesBridge(config))); + getBuilder.apply(builder).configure(new CommonConfig(new ConfigPropertiesBridge(config))); return builder; } } diff --git a/instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/gateway/v2_0/ServerWebExchangeHelper.java b/instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/gateway/v2_0/ServerWebExchangeHelper.java index cd337ae3a3d6..4bf8abe5fbad 100644 --- a/instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/gateway/v2_0/ServerWebExchangeHelper.java +++ b/instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/gateway/v2_0/ServerWebExchangeHelper.java @@ -11,7 +11,7 @@ import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.instrumenter.LocalRootSpan; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.util.regex.Pattern; import org.springframework.cloud.gateway.route.Route; import org.springframework.web.server.ServerWebExchange; @@ -38,7 +38,7 @@ public final class ServerWebExchangeHelper { static { CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean( "otel.instrumentation.spring-cloud-gateway.experimental-span-attributes", false); } diff --git a/instrumentation/spring/spring-integration-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/integration/v4_1/SpringIntegrationSingletons.java b/instrumentation/spring/spring-integration-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/integration/v4_1/SpringIntegrationSingletons.java index 25aa7e4e565a..19cbd73fcb2e 100644 --- a/instrumentation/spring/spring-integration-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/integration/v4_1/SpringIntegrationSingletons.java +++ b/instrumentation/spring/spring-integration-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/integration/v4_1/SpringIntegrationSingletons.java @@ -9,15 +9,15 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.spring.integration.v4_1.SpringIntegrationTelemetry; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.bootstrap.internal.ExperimentalConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; import java.util.List; import org.springframework.messaging.support.ChannelInterceptor; public final class SpringIntegrationSingletons { private static final List PATTERNS = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getList( "otel.instrumentation.spring-integration.global-channel-interceptor-patterns", singletonList("*")); @@ -26,7 +26,7 @@ public final class SpringIntegrationSingletons { SpringIntegrationTelemetry.builder(GlobalOpenTelemetry.get()) .setCapturedHeaders(ExperimentalConfig.get().getMessagingHeaders()) .setProducerSpanEnabled( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.spring-integration.producer.enabled", false)) .build() .newChannelInterceptor(); diff --git a/instrumentation/spring/spring-kafka-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/kafka/v2_7/SpringKafkaSingletons.java b/instrumentation/spring/spring-kafka-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/kafka/v2_7/SpringKafkaSingletons.java index a1e150bca3c0..fcf6f2d164b2 100644 --- a/instrumentation/spring/spring-kafka-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/kafka/v2_7/SpringKafkaSingletons.java +++ b/instrumentation/spring/spring-kafka-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/kafka/v2_7/SpringKafkaSingletons.java @@ -11,8 +11,8 @@ import io.opentelemetry.instrumentation.kafka.internal.KafkaReceiveRequest; import io.opentelemetry.instrumentation.spring.kafka.v2_7.SpringKafkaTelemetry; import io.opentelemetry.instrumentation.spring.kafka.v2_7.internal.SpringKafkaErrorCauseExtractor; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.bootstrap.internal.ExperimentalConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; public final class SpringKafkaSingletons { private static final String INSTRUMENTATION_NAME = "io.opentelemetry.spring-kafka-2.7"; @@ -21,7 +21,7 @@ public final class SpringKafkaSingletons { SpringKafkaTelemetry.builder(GlobalOpenTelemetry.get()) .setCapturedHeaders(ExperimentalConfig.get().getMessagingHeaders()) .setCaptureExperimentalSpanAttributes( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.kafka.experimental-span-attributes", false)) .setMessagingReceiveInstrumentationEnabled( ExperimentalConfig.get().messagingReceiveInstrumentationEnabled()) @@ -33,7 +33,7 @@ public final class SpringKafkaSingletons { new KafkaInstrumenterFactory(GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME) .setCapturedHeaders(ExperimentalConfig.get().getMessagingHeaders()) .setCaptureExperimentalSpanAttributes( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.kafka.experimental-span-attributes", false)) .setMessagingReceiveInstrumentationEnabled( ExperimentalConfig.get().messagingReceiveInstrumentationEnabled()) diff --git a/instrumentation/spring/spring-scheduling-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/scheduling/v3_1/SpringSchedulingSingletons.java b/instrumentation/spring/spring-scheduling-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/scheduling/v3_1/SpringSchedulingSingletons.java index a466707ac68d..d7d6ad54f818 100644 --- a/instrumentation/spring/spring-scheduling-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/scheduling/v3_1/SpringSchedulingSingletons.java +++ b/instrumentation/spring/spring-scheduling-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/scheduling/v3_1/SpringSchedulingSingletons.java @@ -12,12 +12,12 @@ import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class SpringSchedulingSingletons { private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.spring-scheduling.experimental-span-attributes", false); private static final Instrumenter INSTRUMENTER; diff --git a/instrumentation/spring/spring-security-config-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/security/config/v6_0/EnduserAttributesCapturerSingletons.java b/instrumentation/spring/spring-security-config-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/security/config/v6_0/EnduserAttributesCapturerSingletons.java index 819e8a41ae7a..9b4ab9416689 100644 --- a/instrumentation/spring/spring-security-config-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/security/config/v6_0/EnduserAttributesCapturerSingletons.java +++ b/instrumentation/spring/spring-security-config-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/security/config/v6_0/EnduserAttributesCapturerSingletons.java @@ -6,8 +6,8 @@ package io.opentelemetry.javaagent.instrumentation.spring.security.config.v6_0; import io.opentelemetry.instrumentation.spring.security.config.v6_0.EnduserAttributesCapturer; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public class EnduserAttributesCapturerSingletons { @@ -22,12 +22,12 @@ public static EnduserAttributesCapturer enduserAttributesCapturer() { private static EnduserAttributesCapturer createEndUserAttributesCapturerFromConfig() { EnduserAttributesCapturer capturer = new EnduserAttributesCapturer(); - capturer.setEnduserIdEnabled(CommonConfig.get().getEnduserConfig().isIdEnabled()); - capturer.setEnduserRoleEnabled(CommonConfig.get().getEnduserConfig().isRoleEnabled()); - capturer.setEnduserScopeEnabled(CommonConfig.get().getEnduserConfig().isScopeEnabled()); + capturer.setEnduserIdEnabled(AgentCommonConfig.get().getEnduserConfig().isIdEnabled()); + capturer.setEnduserRoleEnabled(AgentCommonConfig.get().getEnduserConfig().isRoleEnabled()); + capturer.setEnduserScopeEnabled(AgentCommonConfig.get().getEnduserConfig().isScopeEnabled()); String rolePrefix = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getString( "otel.instrumentation.spring-security.enduser.role.granted-authority-prefix"); if (rolePrefix != null) { @@ -35,7 +35,7 @@ private static EnduserAttributesCapturer createEndUserAttributesCapturerFromConf } String scopePrefix = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getString( "otel.instrumentation.spring-security.enduser.scope.granted-authority-prefix"); if (scopePrefix != null) { diff --git a/instrumentation/spring/spring-security-config-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/security/config/v6_0/servlet/SpringSecurityConfigServletInstrumentationModule.java b/instrumentation/spring/spring-security-config-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/security/config/v6_0/servlet/SpringSecurityConfigServletInstrumentationModule.java index 6e87a1ba17ca..926bd6d94103 100644 --- a/instrumentation/spring/spring-security-config-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/security/config/v6_0/servlet/SpringSecurityConfigServletInstrumentationModule.java +++ b/instrumentation/spring/spring-security-config-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/security/config/v6_0/servlet/SpringSecurityConfigServletInstrumentationModule.java @@ -9,7 +9,7 @@ import static java.util.Collections.singletonList; import com.google.auto.service.AutoService; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; @@ -33,7 +33,7 @@ public boolean defaultEnabled(ConfigProperties config) { * If any functionality not related to enduser attributes is added to this module, * then this check will need to move elsewhere to only guard the enduser attributes logic. */ - && CommonConfig.get().getEnduserConfig().isAnyEnabled(); + && AgentCommonConfig.get().getEnduserConfig().isAnyEnabled(); } @Override diff --git a/instrumentation/spring/spring-security-config-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/security/config/v6_0/webflux/SpringSecurityConfigWebFluxInstrumentationModule.java b/instrumentation/spring/spring-security-config-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/security/config/v6_0/webflux/SpringSecurityConfigWebFluxInstrumentationModule.java index a219a7eccbd3..4293e2b26d5d 100644 --- a/instrumentation/spring/spring-security-config-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/security/config/v6_0/webflux/SpringSecurityConfigWebFluxInstrumentationModule.java +++ b/instrumentation/spring/spring-security-config-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/security/config/v6_0/webflux/SpringSecurityConfigWebFluxInstrumentationModule.java @@ -8,7 +8,7 @@ import static java.util.Collections.singletonList; import com.google.auto.service.AutoService; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; @@ -32,7 +32,7 @@ public boolean defaultEnabled(ConfigProperties config) { * If any functionality not related to enduser attributes is added to this module, * then this check will need to move elsewhere to only guard the enduser attributes logic. */ - && CommonConfig.get().getEnduserConfig().isAnyEnabled(); + && AgentCommonConfig.get().getEnduserConfig().isAnyEnabled(); } @Override diff --git a/instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/v5_0/SpringWebfluxConfig.java b/instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/v5_0/SpringWebfluxConfig.java index 51035617c316..02c0cff4588f 100644 --- a/instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/v5_0/SpringWebfluxConfig.java +++ b/instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/v5_0/SpringWebfluxConfig.java @@ -5,12 +5,12 @@ package io.opentelemetry.javaagent.instrumentation.spring.webflux.v5_0; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class SpringWebfluxConfig { private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.spring-webflux.experimental-span-attributes", false); public static boolean captureExperimentalSpanAttributes() { diff --git a/instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/v5_0/client/WebClientHelper.java b/instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/v5_0/client/WebClientHelper.java index b5bd239c1388..b13e8a67a2e8 100644 --- a/instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/v5_0/client/WebClientHelper.java +++ b/instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/v5_0/client/WebClientHelper.java @@ -13,7 +13,7 @@ import io.opentelemetry.instrumentation.spring.webflux.v5_3.internal.ClientInstrumenterFactory; import io.opentelemetry.instrumentation.spring.webflux.v5_3.internal.WebClientHttpAttributesGetter; import io.opentelemetry.instrumentation.spring.webflux.v5_3.internal.WebClientTracingFilter; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import java.util.List; import java.util.function.Function; import org.springframework.web.reactive.function.client.ClientRequest; @@ -27,16 +27,16 @@ public final class WebClientHelper { GlobalOpenTelemetry.get(), builder -> builder - .setCapturedRequestHeaders(CommonConfig.get().getClientRequestHeaders()) - .setCapturedResponseHeaders(CommonConfig.get().getClientResponseHeaders()) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()), - builder -> builder.setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()), + .setCapturedRequestHeaders(AgentCommonConfig.get().getClientRequestHeaders()) + .setCapturedResponseHeaders(AgentCommonConfig.get().getClientResponseHeaders()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()), + builder -> builder.setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()), Function.identity(), singletonList( HttpClientPeerServiceAttributesExtractor.create( WebClientHttpAttributesGetter.INSTANCE, - CommonConfig.get().getPeerServiceResolver())), - CommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()); + AgentCommonConfig.get().getPeerServiceResolver())), + AgentCommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()); public static void addFilter(List exchangeFilterFunctions) { for (ExchangeFilterFunction filterFunction : exchangeFilterFunctions) { diff --git a/instrumentation/spring/spring-webmvc/spring-webmvc-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webmvc/ModelAndViewAttributesExtractor.java b/instrumentation/spring/spring-webmvc/spring-webmvc-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webmvc/ModelAndViewAttributesExtractor.java index ccfe2f8844b3..1dcece6a87d9 100644 --- a/instrumentation/spring/spring-webmvc/spring-webmvc-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webmvc/ModelAndViewAttributesExtractor.java +++ b/instrumentation/spring/spring-webmvc/spring-webmvc-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webmvc/ModelAndViewAttributesExtractor.java @@ -8,7 +8,7 @@ import io.opentelemetry.api.common.AttributesBuilder; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import javax.annotation.Nullable; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.View; @@ -16,7 +16,7 @@ public class ModelAndViewAttributesExtractor implements AttributesExtractor { private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.spring-webmvc.experimental-span-attributes", false); @Override diff --git a/instrumentation/spymemcached-2.12/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spymemcached/CompletionListener.java b/instrumentation/spymemcached-2.12/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spymemcached/CompletionListener.java index b83d15fc373a..b045a961be82 100644 --- a/instrumentation/spymemcached-2.12/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spymemcached/CompletionListener.java +++ b/instrumentation/spymemcached-2.12/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spymemcached/CompletionListener.java @@ -9,14 +9,14 @@ import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Context; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; public abstract class CompletionListener { private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.spymemcached.experimental-span-attributes", false); private static final String DB_COMMAND_CANCELLED = "spymemcached.command.cancelled"; diff --git a/instrumentation/tomcat/tomcat-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/common/TomcatInstrumenterFactory.java b/instrumentation/tomcat/tomcat-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/common/TomcatInstrumenterFactory.java index 816adf7cdb16..24f974f4c3ca 100644 --- a/instrumentation/tomcat/tomcat-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/common/TomcatInstrumenterFactory.java +++ b/instrumentation/tomcat/tomcat-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/common/TomcatInstrumenterFactory.java @@ -15,7 +15,7 @@ import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRoute; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.bootstrap.servlet.AppServerBridge; import io.opentelemetry.javaagent.instrumentation.servlet.ServletAccessor; import io.opentelemetry.javaagent.instrumentation.servlet.ServletErrorCauseExtractor; @@ -35,19 +35,19 @@ public static Instrumenter create( GlobalOpenTelemetry.get(), instrumentationName, HttpSpanNameExtractor.builder(httpAttributesGetter) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter)) .setErrorCauseExtractor(new ServletErrorCauseExtractor<>(accessor)) .addAttributesExtractor( HttpServerAttributesExtractor.builder(httpAttributesGetter) - .setCapturedRequestHeaders(CommonConfig.get().getServerRequestHeaders()) - .setCapturedResponseHeaders(CommonConfig.get().getServerResponseHeaders()) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setCapturedRequestHeaders(AgentCommonConfig.get().getServerRequestHeaders()) + .setCapturedResponseHeaders(AgentCommonConfig.get().getServerResponseHeaders()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .addContextCustomizer( HttpServerRoute.builder(httpAttributesGetter) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .addContextCustomizer( (context, request, attributes) -> @@ -56,7 +56,7 @@ public static Instrumenter create( .recordException() .init(context)) .addOperationMetrics(HttpServerMetrics.get()); - if (CommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) { + if (AgentCommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) { builder .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter)) .addOperationMetrics(HttpServerExperimentalMetrics.get()); diff --git a/instrumentation/twilio-6.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/twilio/TwilioSingletons.java b/instrumentation/twilio-6.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/twilio/TwilioSingletons.java index d47fdd2c60a1..3c6b3296e125 100644 --- a/instrumentation/twilio-6.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/twilio/TwilioSingletons.java +++ b/instrumentation/twilio-6.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/twilio/TwilioSingletons.java @@ -11,12 +11,12 @@ import io.opentelemetry.instrumentation.api.incubator.semconv.util.SpanNames; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class TwilioSingletons { private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.twilio.experimental-span-attributes", false); private static final Instrumenter INSTRUMENTER; diff --git a/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowSingletons.java b/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowSingletons.java index 0e75d616048b..cb4e9007afab 100644 --- a/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowSingletons.java +++ b/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowSingletons.java @@ -15,7 +15,7 @@ import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRoute; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor; import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.javaagent.bootstrap.servlet.AppServerBridge; import io.opentelemetry.javaagent.bootstrap.undertow.UndertowActiveHandlers; import io.undertow.server.HttpServerExchange; @@ -33,18 +33,18 @@ public final class UndertowSingletons { GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, HttpSpanNameExtractor.builder(httpAttributesGetter) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter)) .addAttributesExtractor( HttpServerAttributesExtractor.builder(httpAttributesGetter) - .setCapturedRequestHeaders(CommonConfig.get().getServerRequestHeaders()) - .setCapturedResponseHeaders(CommonConfig.get().getServerResponseHeaders()) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setCapturedRequestHeaders(AgentCommonConfig.get().getServerRequestHeaders()) + .setCapturedResponseHeaders(AgentCommonConfig.get().getServerResponseHeaders()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .addContextCustomizer( HttpServerRoute.builder(httpAttributesGetter) - .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods()) + .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods()) .build()) .addContextCustomizer( (context, request, attributes) -> { @@ -58,7 +58,7 @@ public final class UndertowSingletons { .init(context); }) .addOperationMetrics(HttpServerMetrics.get()); - if (CommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) { + if (AgentCommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) { builder .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter)) .addOperationMetrics(HttpServerExperimentalMetrics.get()); diff --git a/instrumentation/vertx/vertx-kafka-client-3.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/kafka/v3_6/VertxKafkaSingletons.java b/instrumentation/vertx/vertx-kafka-client-3.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/kafka/v3_6/VertxKafkaSingletons.java index 5b09afb40110..afdfe735b92b 100644 --- a/instrumentation/vertx/vertx-kafka-client-3.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/kafka/v3_6/VertxKafkaSingletons.java +++ b/instrumentation/vertx/vertx-kafka-client-3.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/kafka/v3_6/VertxKafkaSingletons.java @@ -10,8 +10,8 @@ import io.opentelemetry.instrumentation.kafka.internal.KafkaInstrumenterFactory; import io.opentelemetry.instrumentation.kafka.internal.KafkaProcessRequest; import io.opentelemetry.instrumentation.kafka.internal.KafkaReceiveRequest; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.bootstrap.internal.ExperimentalConfig; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; public final class VertxKafkaSingletons { @@ -25,7 +25,7 @@ public final class VertxKafkaSingletons { new KafkaInstrumenterFactory(GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME) .setCapturedHeaders(ExperimentalConfig.get().getMessagingHeaders()) .setCaptureExperimentalSpanAttributes( - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.kafka.experimental-span-attributes", false)) .setMessagingReceiveInstrumentationEnabled( ExperimentalConfig.get().messagingReceiveInstrumentationEnabled()); diff --git a/instrumentation/vertx/vertx-redis-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/redis/VertxRedisClientAttributesGetter.java b/instrumentation/vertx/vertx-redis-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/redis/VertxRedisClientAttributesGetter.java index da2cb4f6cf94..d662aa053ad6 100644 --- a/instrumentation/vertx/vertx-redis-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/redis/VertxRedisClientAttributesGetter.java +++ b/instrumentation/vertx/vertx-redis-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/redis/VertxRedisClientAttributesGetter.java @@ -7,7 +7,7 @@ import io.opentelemetry.instrumentation.api.incubator.semconv.db.DbClientAttributesGetter; import io.opentelemetry.instrumentation.api.incubator.semconv.db.RedisCommandSanitizer; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.opentelemetry.semconv.incubating.DbIncubatingAttributes; import javax.annotation.Nullable; @@ -16,7 +16,7 @@ public enum VertxRedisClientAttributesGetter INSTANCE; private static final RedisCommandSanitizer sanitizer = - RedisCommandSanitizer.create(CommonConfig.get().isStatementSanitizationEnabled()); + RedisCommandSanitizer.create(AgentCommonConfig.get().isStatementSanitizationEnabled()); @Override public String getSystem(VertxRedisClientRequest request) { diff --git a/instrumentation/vertx/vertx-redis-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/redis/VertxRedisClientSingletons.java b/instrumentation/vertx/vertx-redis-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/redis/VertxRedisClientSingletons.java index 090966f719ad..b5164522897c 100644 --- a/instrumentation/vertx/vertx-redis-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/redis/VertxRedisClientSingletons.java +++ b/instrumentation/vertx/vertx-redis-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/redis/VertxRedisClientSingletons.java @@ -18,7 +18,7 @@ import io.opentelemetry.instrumentation.api.semconv.network.NetworkAttributesExtractor; import io.opentelemetry.instrumentation.api.semconv.network.ServerAttributesExtractor; import io.opentelemetry.instrumentation.api.util.VirtualField; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.vertx.core.Future; import io.vertx.redis.client.Command; import io.vertx.redis.client.impl.RedisStandaloneConnection; @@ -52,7 +52,7 @@ public final class VertxRedisClientSingletons { .addAttributesExtractor( PeerServiceAttributesExtractor.create( VertxRedisClientNetAttributesGetter.INSTANCE, - CommonConfig.get().getPeerServiceResolver())); + AgentCommonConfig.get().getPeerServiceResolver())); INSTRUMENTER = builder.buildInstrumenter(SpanKindExtractor.alwaysClient()); } diff --git a/instrumentation/vertx/vertx-sql-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/sql/VertxSqlClientSingletons.java b/instrumentation/vertx/vertx-sql-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/sql/VertxSqlClientSingletons.java index 0167c7d9d28a..a77338e5c811 100644 --- a/instrumentation/vertx/vertx-sql-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/sql/VertxSqlClientSingletons.java +++ b/instrumentation/vertx/vertx-sql-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/sql/VertxSqlClientSingletons.java @@ -17,7 +17,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor; import io.opentelemetry.instrumentation.api.semconv.network.ServerAttributesExtractor; import io.opentelemetry.instrumentation.api.util.VirtualField; -import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; import io.vertx.core.Future; import io.vertx.core.Promise; import io.vertx.sqlclient.SqlConnectOptions; @@ -40,14 +40,14 @@ public final class VertxSqlClientSingletons { .addAttributesExtractor( SqlClientAttributesExtractor.builder(VertxSqlClientAttributesGetter.INSTANCE) .setStatementSanitizationEnabled( - CommonConfig.get().isStatementSanitizationEnabled()) + AgentCommonConfig.get().isStatementSanitizationEnabled()) .build()) .addAttributesExtractor( ServerAttributesExtractor.create(VertxSqlClientNetAttributesGetter.INSTANCE)) .addAttributesExtractor( PeerServiceAttributesExtractor.create( VertxSqlClientNetAttributesGetter.INSTANCE, - CommonConfig.get().getPeerServiceResolver())); + AgentCommonConfig.get().getPeerServiceResolver())); INSTRUMENTER = builder.buildInstrumenter(SpanKindExtractor.alwaysClient()); } diff --git a/instrumentation/xxl-job/xxl-job-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/xxljob/common/XxlJobInstrumenterFactory.java b/instrumentation/xxl-job/xxl-job-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/xxljob/common/XxlJobInstrumenterFactory.java index 4a5f713808e2..1544504bdac6 100644 --- a/instrumentation/xxl-job/xxl-job-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/xxljob/common/XxlJobInstrumenterFactory.java +++ b/instrumentation/xxl-job/xxl-job-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/xxljob/common/XxlJobInstrumenterFactory.java @@ -12,12 +12,12 @@ import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; public final class XxlJobInstrumenterFactory { private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.xxl-job.experimental-span-attributes", false); public static Instrumenter create(String instrumentationName) { diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/AgentCommonConfig.java similarity index 60% rename from javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java rename to javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/AgentCommonConfig.java index 3961170a6d88..e5ee4b396871 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/AgentCommonConfig.java @@ -5,19 +5,18 @@ package io.opentelemetry.javaagent.bootstrap.internal; -import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreCommonConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.CommonConfig; /** * This class is internal and is hence not for public use. Its APIs are unstable and can change at * any time. */ -public class CommonConfig { - private CommonConfig() {} +public class AgentCommonConfig { + private AgentCommonConfig() {} - private static final CoreCommonConfig instance = - new CoreCommonConfig(InstrumentationConfig.get()); + private static final CommonConfig instance = new CommonConfig(AgentInstrumentationConfig.get()); - public static CoreCommonConfig get() { + public static CommonConfig get() { return instance; } } diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/InstrumentationConfig.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/AgentInstrumentationConfig.java similarity index 60% rename from javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/InstrumentationConfig.java rename to javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/AgentInstrumentationConfig.java index bb3af4668d72..081050ef76ac 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/InstrumentationConfig.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/AgentInstrumentationConfig.java @@ -7,32 +7,32 @@ import static java.util.Objects.requireNonNull; -import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.InstrumentationConfig; import java.util.logging.Logger; /** * This class is internal and is hence not for public use. Its APIs are unstable and can change at * any time. */ -public class InstrumentationConfig { - private InstrumentationConfig() {} +public class AgentInstrumentationConfig { + private AgentInstrumentationConfig() {} - private static final Logger logger = Logger.getLogger(InstrumentationConfig.class.getName()); + private static final Logger logger = Logger.getLogger(AgentInstrumentationConfig.class.getName()); - private static final CoreInstrumentationConfig DEFAULT = new EmptyInstrumentationConfig(); + private static final InstrumentationConfig DEFAULT = new EmptyInstrumentationConfig(); // lazy initialized, so that javaagent can set it - private static volatile CoreInstrumentationConfig instance = DEFAULT; + private static volatile InstrumentationConfig instance = DEFAULT; /** * Sets the instrumentation configuration singleton. This method is only supposed to be called - * once, during the agent initialization, just before {@link InstrumentationConfig#get()} is used - * for the first time. + * once, during the agent initialization, just before {@link AgentInstrumentationConfig#get()} is + * used for the first time. * *

This method is internal and is hence not for public use. Its API is unstable and can change * at any time. */ - public static void internalInitializeConfig(CoreInstrumentationConfig config) { + public static void internalInitializeConfig(InstrumentationConfig config) { if (instance != DEFAULT) { logger.warning("InstrumentationConfig#instance was already set earlier"); return; @@ -41,7 +41,7 @@ public static void internalInitializeConfig(CoreInstrumentationConfig config) { } /** Returns the global instrumentation configuration. */ - public static CoreInstrumentationConfig get() { + public static InstrumentationConfig get() { return instance; } } diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/ConfiguredResourceAttributesHolder.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/ConfiguredResourceAttributesHolder.java index 77f2e7ac16fb..ea7c51ff436f 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/ConfiguredResourceAttributesHolder.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/ConfiguredResourceAttributesHolder.java @@ -28,7 +28,7 @@ public static Map getResourceAttributes() { public static void initialize(Attributes resourceAttribute) { List mdcResourceAttributes = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getList( "otel.instrumentation.common.mdc.resource-attributes", Collections.emptyList()); for (String key : mdcResourceAttributes) { diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/DeprecatedConfigProperties.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/DeprecatedConfigProperties.java index 33419774e9f0..2709a6ab0ea2 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/DeprecatedConfigProperties.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/DeprecatedConfigProperties.java @@ -8,7 +8,7 @@ import static java.util.Collections.emptyList; import static java.util.logging.Level.WARNING; -import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.InstrumentationConfig; import java.util.List; import java.util.logging.Logger; @@ -22,7 +22,7 @@ public final class DeprecatedConfigProperties { private static final Logger logger = Logger.getLogger(DeprecatedConfigProperties.class.getName()); public static boolean getBoolean( - CoreInstrumentationConfig config, + InstrumentationConfig config, String deprecatedPropertyName, String newPropertyName, boolean defaultValue) { @@ -32,14 +32,14 @@ public static boolean getBoolean( } public static List getList( - CoreInstrumentationConfig config, String deprecatedPropertyName, String newPropertyName) { + InstrumentationConfig config, String deprecatedPropertyName, String newPropertyName) { warnIfUsed(config, deprecatedPropertyName, newPropertyName); List value = config.getList(deprecatedPropertyName, emptyList()); return config.getList(newPropertyName, value); } private static void warnIfUsed( - CoreInstrumentationConfig config, String deprecatedPropertyName, String newPropertyName) { + InstrumentationConfig config, String deprecatedPropertyName, String newPropertyName) { if (config.getString(deprecatedPropertyName) != null) { logger.log( WARNING, diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/EmptyInstrumentationConfig.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/EmptyInstrumentationConfig.java index 4251d19ff45b..303931c5b674 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/EmptyInstrumentationConfig.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/EmptyInstrumentationConfig.java @@ -5,13 +5,13 @@ package io.opentelemetry.javaagent.bootstrap.internal; -import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.InstrumentationConfig; import java.time.Duration; import java.util.List; import java.util.Map; import javax.annotation.Nullable; -final class EmptyInstrumentationConfig implements CoreInstrumentationConfig { +final class EmptyInstrumentationConfig implements InstrumentationConfig { @Nullable @Override diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/ExperimentalConfig.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/ExperimentalConfig.java index 4f0b57fd75cb..736229de4ecb 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/ExperimentalConfig.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/ExperimentalConfig.java @@ -7,7 +7,7 @@ import static java.util.Collections.emptyList; -import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.InstrumentationConfig; import java.util.List; /** @@ -17,9 +17,9 @@ public final class ExperimentalConfig { private static final ExperimentalConfig instance = - new ExperimentalConfig(InstrumentationConfig.get()); + new ExperimentalConfig(AgentInstrumentationConfig.get()); - private final CoreInstrumentationConfig config; + private final InstrumentationConfig config; private final List messagingHeaders; /** Returns the global agent configuration. */ @@ -27,7 +27,7 @@ public static ExperimentalConfig get() { return instance; } - public ExperimentalConfig(CoreInstrumentationConfig config) { + public ExperimentalConfig(InstrumentationConfig config) { this.config = config; messagingHeaders = config.getList("otel.instrumentation.messaging.experimental.capture-headers", emptyList()); diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/JavaagentHttpClientInstrumenters.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/JavaagentHttpClientInstrumenters.java index dfeaaf169ee1..e7331c550fff 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/JavaagentHttpClientInstrumenters.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/JavaagentHttpClientInstrumenters.java @@ -56,6 +56,9 @@ public static Instrumenter create( private static Instrumenter create( DefaultHttpClientInstrumenterBuilder builder, Consumer> builderCustomizer) { - return builder.configure(CommonConfig.get()).setBuilderCustomizer(builderCustomizer).build(); + return builder + .configure(AgentCommonConfig.get()) + .setBuilderCustomizer(builderCustomizer) + .build(); } } diff --git a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentInstaller.java b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentInstaller.java index 19d06f834f2e..54c6938c96d9 100644 --- a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentInstaller.java +++ b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentInstaller.java @@ -26,8 +26,8 @@ import io.opentelemetry.javaagent.bootstrap.http.HttpServerResponseCustomizer; import io.opentelemetry.javaagent.bootstrap.http.HttpServerResponseCustomizerHolder; import io.opentelemetry.javaagent.bootstrap.http.HttpServerResponseMutator; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.bootstrap.internal.ConfiguredResourceAttributesHolder; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; import io.opentelemetry.javaagent.extension.AgentListener; import io.opentelemetry.javaagent.extension.ignore.IgnoredTypesConfigurer; import io.opentelemetry.javaagent.tooling.asyncannotationsupport.WeakRefAsyncOperationEndStrategies; @@ -122,7 +122,7 @@ private static void installBytebuddyAgent( installOpenTelemetrySdk(extensionClassLoader); ConfigProperties sdkConfig = AutoConfigureUtil.getConfig(autoConfiguredSdk); - InstrumentationConfig.internalInitializeConfig(new ConfigPropertiesBridge(sdkConfig)); + AgentInstrumentationConfig.internalInitializeConfig(new ConfigPropertiesBridge(sdkConfig)); copyNecessaryConfigToSystemProperties(sdkConfig); setBootstrapPackages(sdkConfig, extensionClassLoader); diff --git a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/config/ConfigPropertiesBridge.java b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/config/ConfigPropertiesBridge.java index 12812e63e4e1..de6b3baca6b3 100644 --- a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/config/ConfigPropertiesBridge.java +++ b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/config/ConfigPropertiesBridge.java @@ -5,7 +5,7 @@ package io.opentelemetry.javaagent.tooling.config; -import io.opentelemetry.instrumentation.api.incubator.config.internal.CoreInstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.InstrumentationConfig; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; import java.time.Duration; @@ -13,7 +13,7 @@ import java.util.Map; import javax.annotation.Nullable; -public final class ConfigPropertiesBridge implements CoreInstrumentationConfig { +public final class ConfigPropertiesBridge implements InstrumentationConfig { private final ConfigProperties configProperties; diff --git a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/field/FieldBackedImplementationInstaller.java b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/field/FieldBackedImplementationInstaller.java index 3a2f065769fe..5c1e69063fd3 100644 --- a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/field/FieldBackedImplementationInstaller.java +++ b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/field/FieldBackedImplementationInstaller.java @@ -14,7 +14,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import io.opentelemetry.javaagent.bootstrap.InstrumentationHolder; import io.opentelemetry.javaagent.bootstrap.VirtualFieldDetector; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.tooling.HelperInjector; import io.opentelemetry.javaagent.tooling.TransformSafeLogger; import io.opentelemetry.javaagent.tooling.instrumentation.InstrumentationModuleInstaller; @@ -64,7 +64,7 @@ final class FieldBackedImplementationInstaller implements VirtualFieldImplementa TransformSafeLogger.getLogger(FieldBackedImplementationInstaller.class); private static final boolean FIELD_INJECTION_ENABLED = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.javaagent.experimental.field-injection.enabled", true); private final Class instrumenterClass; diff --git a/muzzle/src/main/java/io/opentelemetry/javaagent/tooling/muzzle/AgentCachingPoolStrategy.java b/muzzle/src/main/java/io/opentelemetry/javaagent/tooling/muzzle/AgentCachingPoolStrategy.java index afc19d21511b..a9385f8bd45c 100644 --- a/muzzle/src/main/java/io/opentelemetry/javaagent/tooling/muzzle/AgentCachingPoolStrategy.java +++ b/muzzle/src/main/java/io/opentelemetry/javaagent/tooling/muzzle/AgentCachingPoolStrategy.java @@ -9,7 +9,7 @@ import io.opentelemetry.instrumentation.api.internal.cache.Cache; import io.opentelemetry.javaagent.bootstrap.InstrumentationHolder; import io.opentelemetry.javaagent.bootstrap.VirtualFieldAccessorMarker; -import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.lang.instrument.Instrumentation; import java.lang.ref.WeakReference; import java.lang.reflect.Method; @@ -53,7 +53,7 @@ public class AgentCachingPoolStrategy implements AgentBuilder.PoolStrategy { // others to avoid creation of synthetic accessors private static final boolean REFLECTION_ENABLED = - InstrumentationConfig.get() + AgentInstrumentationConfig.get() .getBoolean("otel.instrumentation.internal-reflection.enabled", true); private static final Method findLoadedClassMethod = getFindLoadedClassMethod(); From 34da2eba80c4db8b1fc04466087d7ee624d55df6 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Tue, 2 Jul 2024 11:30:27 +0200 Subject: [PATCH 21/23] encapsulate field --- .../web/RestClientBeanPostProcessor.java | 2 +- .../web/RestTemplateInstrumentation.java | 2 +- .../web/v3_1/SpringWebTelemetryBuilder.java | 2 +- .../web/v3_1/internal/WebTelemetryUtil.java | 18 ++++++++++++++++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientBeanPostProcessor.java b/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientBeanPostProcessor.java index 74b7eaf86646..6cb053d1d22d 100644 --- a/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientBeanPostProcessor.java +++ b/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientBeanPostProcessor.java @@ -57,7 +57,7 @@ private static RestClient addRestClientInterceptorIfNotPresent( static ClientHttpRequestInterceptor getInterceptor( OpenTelemetry openTelemetry, ConfigProperties config) { return InstrumentationConfigUtil.configureBuilder( - config, SpringWebTelemetry.builder(openTelemetry), WebTelemetryUtil.GET_BUILDER) + config, SpringWebTelemetry.builder(openTelemetry), WebTelemetryUtil.getBuilder()) .build() .newInterceptor(); } diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java index 55e6bc68ba67..7bad3eb91eff 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java @@ -25,7 +25,7 @@ static RestTemplate addIfNotPresent( ClientHttpRequestInterceptor instrumentationInterceptor = InstrumentationConfigUtil.configureBuilder( - config, SpringWebTelemetry.builder(openTelemetry), WebTelemetryUtil.GET_BUILDER) + config, SpringWebTelemetry.builder(openTelemetry), WebTelemetryUtil.getBuilder()) .build() .newInterceptor(); diff --git a/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/SpringWebTelemetryBuilder.java b/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/SpringWebTelemetryBuilder.java index a4edb71a0aa8..6e8827b3b09c 100644 --- a/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/SpringWebTelemetryBuilder.java +++ b/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/SpringWebTelemetryBuilder.java @@ -24,7 +24,7 @@ public final class SpringWebTelemetryBuilder { private final DefaultHttpClientInstrumenterBuilder builder; static { - WebTelemetryUtil.GET_BUILDER = SpringWebTelemetryBuilder::getBuilder; + WebTelemetryUtil.setGetBuilder(SpringWebTelemetryBuilder::getBuilder); } SpringWebTelemetryBuilder(OpenTelemetry openTelemetry) { diff --git a/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java b/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java index 6b919455b2c8..7eadf7f523f4 100644 --- a/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java +++ b/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java @@ -19,9 +19,23 @@ public class WebTelemetryUtil { private WebTelemetryUtil() {} // allows access to the private field for the spring starter - @SuppressWarnings("ConstantField") + private static Function< + SpringWebTelemetryBuilder, + DefaultHttpClientInstrumenterBuilder> + getBuilder; + public static Function< SpringWebTelemetryBuilder, DefaultHttpClientInstrumenterBuilder> - GET_BUILDER; + getBuilder() { + return getBuilder; + } + + public static void setGetBuilder( + Function< + SpringWebTelemetryBuilder, + DefaultHttpClientInstrumenterBuilder> + getBuilder) { + WebTelemetryUtil.getBuilder = getBuilder; + } } From d43d21e3df2c8e9ab3c4d6f1706817b0258ebee4 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Tue, 2 Jul 2024 13:52:40 +0200 Subject: [PATCH 22/23] encapsulate field --- .../web/RestClientBeanPostProcessor.java | 4 +++- .../web/RestTemplateInstrumentation.java | 4 +++- .../spring/web/v3_1/SpringWebTelemetryBuilder.java | 2 +- .../spring/web/v3_1/internal/WebTelemetryUtil.java | 12 ++++++------ 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientBeanPostProcessor.java b/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientBeanPostProcessor.java index 6cb053d1d22d..469fdfadd741 100644 --- a/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientBeanPostProcessor.java +++ b/instrumentation/spring/spring-boot-autoconfigure-3/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestClientBeanPostProcessor.java @@ -57,7 +57,9 @@ private static RestClient addRestClientInterceptorIfNotPresent( static ClientHttpRequestInterceptor getInterceptor( OpenTelemetry openTelemetry, ConfigProperties config) { return InstrumentationConfigUtil.configureBuilder( - config, SpringWebTelemetry.builder(openTelemetry), WebTelemetryUtil.getBuilder()) + config, + SpringWebTelemetry.builder(openTelemetry), + WebTelemetryUtil.getBuilderExtractor()) .build() .newInterceptor(); } diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java index 7bad3eb91eff..deb84cfcc23b 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/web/RestTemplateInstrumentation.java @@ -25,7 +25,9 @@ static RestTemplate addIfNotPresent( ClientHttpRequestInterceptor instrumentationInterceptor = InstrumentationConfigUtil.configureBuilder( - config, SpringWebTelemetry.builder(openTelemetry), WebTelemetryUtil.getBuilder()) + config, + SpringWebTelemetry.builder(openTelemetry), + WebTelemetryUtil.getBuilderExtractor()) .build() .newInterceptor(); diff --git a/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/SpringWebTelemetryBuilder.java b/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/SpringWebTelemetryBuilder.java index 6e8827b3b09c..3eab8e96bf61 100644 --- a/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/SpringWebTelemetryBuilder.java +++ b/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/SpringWebTelemetryBuilder.java @@ -24,7 +24,7 @@ public final class SpringWebTelemetryBuilder { private final DefaultHttpClientInstrumenterBuilder builder; static { - WebTelemetryUtil.setGetBuilder(SpringWebTelemetryBuilder::getBuilder); + WebTelemetryUtil.setBuilderExtractor(SpringWebTelemetryBuilder::getBuilder); } SpringWebTelemetryBuilder(OpenTelemetry openTelemetry) { diff --git a/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java b/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java index 7eadf7f523f4..443fdc86585e 100644 --- a/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java +++ b/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/internal/WebTelemetryUtil.java @@ -22,20 +22,20 @@ private WebTelemetryUtil() {} private static Function< SpringWebTelemetryBuilder, DefaultHttpClientInstrumenterBuilder> - getBuilder; + builderExtractor; public static Function< SpringWebTelemetryBuilder, DefaultHttpClientInstrumenterBuilder> - getBuilder() { - return getBuilder; + getBuilderExtractor() { + return builderExtractor; } - public static void setGetBuilder( + public static void setBuilderExtractor( Function< SpringWebTelemetryBuilder, DefaultHttpClientInstrumenterBuilder> - getBuilder) { - WebTelemetryUtil.getBuilder = getBuilder; + builderExtractor) { + WebTelemetryUtil.builderExtractor = builderExtractor; } } From badfcd511db375a5ad8cb2acb79baf2c7a5a9cc4 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Tue, 2 Jul 2024 14:43:22 +0200 Subject: [PATCH 23/23] fix graalvm native --- .../AbstractOtelSpringStarterSmokeTest.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java b/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java index 4b2ff243d73e..ec9af70ca329 100644 --- a/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java +++ b/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java @@ -186,15 +186,19 @@ void shouldSendTelemetry() { // Log List exportedLogRecords = testing.getExportedLogRecords(); assertThat(exportedLogRecords).as("No log record exported.").isNotEmpty(); - LogRecordData firstLog = exportedLogRecords.get(0); - assertThat(firstLog.getBody().asString()) - .as("Should instrument logs") - .startsWith("Starting ") - .contains(this.getClass().getSimpleName()); - assertThat(firstLog.getAttributes().asMap()) - .as("Should capture code attributes") - .containsEntry( - CodeIncubatingAttributes.CODE_NAMESPACE, "org.springframework.boot.StartupInfoLogger"); + if (System.getProperty("org.graalvm.nativeimage.imagecode") == null) { + // log records differ in native image mode due to different startup timing + LogRecordData firstLog = exportedLogRecords.get(0); + assertThat(firstLog.getBody().asString()) + .as("Should instrument logs") + .startsWith("Starting ") + .contains(this.getClass().getSimpleName()); + assertThat(firstLog.getAttributes().asMap()) + .as("Should capture code attributes") + .containsEntry( + CodeIncubatingAttributes.CODE_NAMESPACE, + "org.springframework.boot.StartupInfoLogger"); + } } @Test