From 798bdd5569e282b385100270aa25c2976071070d Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Tue, 2 Jul 2024 15:49:39 +0200 Subject: [PATCH] config properties support for spring starter clients (#11605) --- .../DefaultHttpClientInstrumenterBuilder.java | 21 ++++ .../config}/internal/CommonConfig.java | 10 +- .../config}/internal/EnduserConfig.java | 2 +- .../internal/InstrumentationConfig.java | 54 ++------- .../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 +- .../javaagent-unit-tests/build.gradle.kts | 1 + .../extannotations/IncludeTest.java | 2 +- .../ExternalAnnotationInstrumentation.java | 7 +- .../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 | 5 +- .../SpanDecoratingContextDataInjector.java | 12 +- .../mdc/v1_2/LoggingEventInstrumentation.java | 14 +-- .../appender/v1_0/LogbackSingletons.java | 5 +- .../logback/mdc/v1_0/LogbackSingletons.java | 13 ++- .../mdc/v1_0/LoggingEventInstrumentation.java | 4 +- .../methods/MethodInstrumentationModule.java | 4 +- .../micrometer/v1_5/MicrometerSingletons.java | 5 +- .../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 +- .../build.gradle.kts | 1 + .../web/RestClientBeanPostProcessor.java | 27 ++++- ...lientInstrumentationAutoConfiguration.java | 13 ++- ...tInstrumentationAutoConfigurationTest.java | 6 + .../web/RestTemplateBeanPostProcessor.java | 12 +- .../web/RestTemplateInstrumentation.java | 14 ++- ...ngWebInstrumentationAutoConfiguration.java | 11 +- .../properties/ConfigPropertiesBridge.java | 105 ++++++++++++++++++ .../properties/InstrumentationConfigUtil.java | 29 +++++ ...itional-spring-configuration-metadata.json | 27 +++++ ...bInstrumentationAutoConfigurationTest.java | 6 + .../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 +- .../web/v3_1/SpringWebTelemetryBuilder.java | 9 ++ .../web/v3_1/internal/WebTelemetryUtil.java | 41 +++++++ .../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 +- .../bootstrap/internal/AgentCommonConfig.java | 22 ++++ .../internal/AgentInstrumentationConfig.java | 47 ++++++++ .../ConfiguredResourceAttributesHolder.java | 2 +- .../internal/DeprecatedConfigProperties.java | 1 + .../internal/EmptyInstrumentationConfig.java | 3 +- .../internal/ExperimentalConfig.java | 3 +- .../JavaagentHttpClientInstrumenters.java | 21 +--- javaagent-tooling/build.gradle.kts | 1 + .../javaagent/tooling/AgentInstaller.java | 4 +- .../config/ConfigPropertiesBridge.java | 4 +- .../FieldBackedImplementationInstaller.java | 4 +- muzzle/build.gradle.kts | 1 + .../muzzle/AgentCachingPoolStrategy.java | 4 +- .../smoketest/OtelSpringStarterSmokeTest.java | 12 +- .../AbstractOtelSpringStarterSmokeTest.java | 45 +++++--- .../src/main/resources/application.yaml | 3 + 158 files changed, 869 insertions(+), 540 deletions(-) rename {javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap => instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config}/internal/CommonConfig.java (94%) rename {javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap => instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config}/internal/EnduserConfig.java (97%) rename {javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap => instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config}/internal/InstrumentationConfig.java (63%) create mode 100644 instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/ConfigPropertiesBridge.java create mode 100644 instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java 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 create mode 100644 javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/AgentCommonConfig.java create mode 100644 javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/AgentInstrumentationConfig.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..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,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.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; @@ -29,6 +30,7 @@ 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 +194,23 @@ public Instrumenter build() { public OpenTelemetry getOpenTelemetry() { return openTelemetry; } + + @CanIgnoreReturnValue + public DefaultHttpClientInstrumenterBuilder configure(CommonConfig config) { + set(config::getKnownHttpRequestMethods, this::setKnownMethods); + set(config::getClientRequestHeaders, this::setCapturedRequestHeaders); + set(config::getClientResponseHeaders, this::setCapturedResponseHeaders); + set(config::getPeerServiceResolver, this::setPeerServiceResolver); + set( + config::shouldEmitExperimentalHttpClientTelemetry, + this::setEmitExperimentalHttpClientMetrics); + return this; + } + + private static void set(Supplier supplier, Consumer consumer) { + T t = supplier.get(); + if (t != null) { + consumer.accept(t); + } + } } diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CommonConfig.java similarity index 94% rename from javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java rename to instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CommonConfig.java index f6d5a5479001..23875d7e8b5f 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CommonConfig.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.bootstrap.internal; +package io.opentelemetry.instrumentation.api.incubator.config.internal; import static java.util.Collections.emptyMap; @@ -21,12 +21,6 @@ */ public final class CommonConfig { - private static final CommonConfig instance = new CommonConfig(InstrumentationConfig.get()); - - public static CommonConfig get() { - return instance; - } - private final PeerServiceResolver peerServiceResolver; private final List clientRequestHeaders; private final List clientResponseHeaders; @@ -41,7 +35,7 @@ public static CommonConfig get() { private final String loggingSpanIdKey; private final String loggingTraceFlagsKey; - CommonConfig(InstrumentationConfig config) { + public CommonConfig(InstrumentationConfig config) { peerServiceResolver = PeerServiceResolver.create( config.getMap("otel.instrumentation.common.peer-service-mapping", emptyMap())); 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/config/internal/EnduserConfig.java similarity index 97% 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/config/internal/EnduserConfig.java index fbde1c90aaa2..b44057c75f90 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/config/internal/EnduserConfig.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.bootstrap.internal; +package io.opentelemetry.instrumentation.api.incubator.config.internal; import java.util.Objects; diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/InstrumentationConfig.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/InstrumentationConfig.java similarity index 63% rename from javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/InstrumentationConfig.java rename to instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/InstrumentationConfig.java index fc4b7aabc6c2..8ce777b270a7 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/InstrumentationConfig.java +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/InstrumentationConfig.java @@ -3,15 +3,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.bootstrap.internal; +package io.opentelemetry.instrumentation.api.incubator.config.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 java.util.logging.Logger; import javax.annotation.Nullable; /** @@ -28,72 +26,44 @@ *

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 { - - private static final Logger logger = Logger.getLogger(InstrumentationConfig.class.getName()); - - private static final InstrumentationConfig DEFAULT = new EmptyInstrumentationConfig(); - - // lazy initialized, so that javaagent can set it - 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. - * - *

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) { - if (instance != DEFAULT) { - logger.warning("InstrumentationConfig#instance was already set earlier"); - return; - } - instance = requireNonNull(config); - } - - /** Returns the global instrumentation configuration. */ - public static InstrumentationConfig get() { - return instance; - } +public interface InstrumentationConfig { /** * 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); + 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); + 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); + 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); + 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); + 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); + double getDouble(String name, double defaultValue); /** * Returns a duration-valued configuration property or {@code defaultValue} if a property with @@ -113,13 +83,13 @@ public static InstrumentationConfig get() { * *

Examples: 10s, 20ms, 5000 */ - public abstract Duration getDuration(String name, Duration defaultValue); + 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) { + default List getList(String name) { return getList(name, emptyList()); } @@ -128,7 +98,7 @@ public List getList(String 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); + List getList(String name, List defaultValue); /** * Returns a map-valued configuration property or {@code defaultValue} if a property with name @@ -136,5 +106,5 @@ public List getList(String name) { * 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); + Map getMap(String name, Map defaultValue); } 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/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..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.javaagent.bootstrap.internal.InstrumentationConfig; +import io.opentelemetry.instrumentation.api.incubator.config.internal.InstrumentationConfig; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; 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..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,9 +17,10 @@ import io.opentelemetry.context.Context; import io.opentelemetry.context.Scope; +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; @@ -78,7 +79,7 @@ public class ExternalAnnotationInstrumentation implements TypeInstrumentation { public ExternalAnnotationInstrumentation() { Set additionalTraceAnnotations = - configureAdditionalTraceAnnotations(InstrumentationConfig.get()); + configureAdditionalTraceAnnotations(AgentInstrumentationConfig.get()); if (additionalTraceAnnotations.isEmpty()) { classLoaderOptimization = none(); @@ -146,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 3c228dafa1f5..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,9 +9,10 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.logs.LogRecordBuilder; +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; @@ -30,7 +31,7 @@ public final class Log4jHelper { private static final boolean captureExperimentalAttributes; static { - InstrumentationConfig 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 23d3ff8f44ab..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,8 +7,9 @@ import static java.util.Collections.emptyList; +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 { @@ -16,7 +17,7 @@ public final class LogbackSingletons { private static final LoggingEventMapper mapper; static { - InstrumentationConfig 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 8416c35fe9f2..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,15 +7,16 @@ import io.micrometer.core.instrument.MeterRegistry; import io.opentelemetry.api.GlobalOpenTelemetry; +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 { - InstrumentationConfig 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-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..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 @@ -6,7 +6,10 @@ 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.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; import org.springframework.http.client.ClientHttpRequestInterceptor; @@ -15,23 +18,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 +53,14 @@ private static RestClient addRestClientInterceptorIfNotPresent( }) .build(); } + + static ClientHttpRequestInterceptor getInterceptor( + OpenTelemetry openTelemetry, ConfigProperties config) { + return InstrumentationConfigUtil.configureBuilder( + config, + SpringWebTelemetry.builder(openTelemetry), + WebTelemetryUtil.getBuilderExtractor()) + .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())); } } 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/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..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 @@ -7,7 +7,10 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; 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; import org.springframework.web.client.RestTemplate; @@ -17,9 +20,16 @@ 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(); + InstrumentationConfigUtil.configureBuilder( + config, + SpringWebTelemetry.builder(openTelemetry), + WebTelemetryUtil.getBuilderExtractor()) + .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/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..49d50f94cc5c --- /dev/null +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/ConfigPropertiesBridge.java @@ -0,0 +1,105 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties; + +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; +import java.util.List; +import java.util.Map; +import javax.annotation.Nullable; + +final class ConfigPropertiesBridge implements InstrumentationConfig { + + 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/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 new file mode 100644 index 000000000000..692f7296b375 --- /dev/null +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/InstrumentationConfigUtil.java @@ -0,0 +1,29 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +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.CommonConfig; +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 + * any time. + */ +public class InstrumentationConfigUtil { + private InstrumentationConfigUtil() {} + + @CanIgnoreReturnValue + public static T configureBuilder( + ConfigProperties config, + T builder, + Function> getBuilder) { + getBuilder.apply(builder).configure(new CommonConfig(new ConfigPropertiesBridge(config))); + return builder; + } +} 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/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-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..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 @@ -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.setBuilderExtractor(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..443fdc86585e --- /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,41 @@ +/* + * 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() {} + + // allows access to the private field for the spring starter + private static Function< + SpringWebTelemetryBuilder, + DefaultHttpClientInstrumenterBuilder> + builderExtractor; + + public static Function< + SpringWebTelemetryBuilder, + DefaultHttpClientInstrumenterBuilder> + getBuilderExtractor() { + return builderExtractor; + } + + public static void setBuilderExtractor( + Function< + SpringWebTelemetryBuilder, + DefaultHttpClientInstrumenterBuilder> + builderExtractor) { + WebTelemetryUtil.builderExtractor = builderExtractor; + } +} 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/AgentCommonConfig.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/AgentCommonConfig.java new file mode 100644 index 000000000000..e5ee4b396871 --- /dev/null +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/AgentCommonConfig.java @@ -0,0 +1,22 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.bootstrap.internal; + +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 AgentCommonConfig { + private AgentCommonConfig() {} + + private static final CommonConfig instance = new CommonConfig(AgentInstrumentationConfig.get()); + + public static CommonConfig get() { + return instance; + } +} diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/AgentInstrumentationConfig.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/AgentInstrumentationConfig.java new file mode 100644 index 000000000000..081050ef76ac --- /dev/null +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/AgentInstrumentationConfig.java @@ -0,0 +1,47 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.bootstrap.internal; + +import static java.util.Objects.requireNonNull; + +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 AgentInstrumentationConfig { + private AgentInstrumentationConfig() {} + + private static final Logger logger = Logger.getLogger(AgentInstrumentationConfig.class.getName()); + + private static final InstrumentationConfig DEFAULT = new EmptyInstrumentationConfig(); + + // lazy initialized, so that javaagent can set it + 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 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(InstrumentationConfig config) { + if (instance != DEFAULT) { + logger.warning("InstrumentationConfig#instance was already set earlier"); + return; + } + instance = requireNonNull(config); + } + + /** Returns the global instrumentation configuration. */ + 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 002bf787c99c..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,6 +8,7 @@ import static java.util.Collections.emptyList; import static java.util.logging.Level.WARNING; +import io.opentelemetry.instrumentation.api.incubator.config.internal.InstrumentationConfig; 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 ede916b3b6ad..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,12 +5,13 @@ package io.opentelemetry.javaagent.bootstrap.internal; +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 extends InstrumentationConfig { +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 fe3779ab2550..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,6 +7,7 @@ import static java.util.Collections.emptyList; +import io.opentelemetry.instrumentation.api.incubator.config.internal.InstrumentationConfig; import java.util.List; /** @@ -16,7 +17,7 @@ public final class ExperimentalConfig { private static final ExperimentalConfig instance = - new ExperimentalConfig(InstrumentationConfig.get()); + new ExperimentalConfig(AgentInstrumentationConfig.get()); private final InstrumentationConfig config; private final List messagingHeaders; 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..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 @@ -12,7 +12,6 @@ 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 @@ -57,21 +56,9 @@ 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(AgentCommonConfig.get()) + .setBuilderCustomizer(builderCustomizer) + .build(); } } 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/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 c690921de4a8..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.javaagent.bootstrap.internal.InstrumentationConfig; +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 extends InstrumentationConfig { +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/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. 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(); 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..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 @@ -21,17 +21,20 @@ import io.opentelemetry.sdk.autoconfigure.spi.internal.DefaultConfigProperties; import io.opentelemetry.sdk.logs.data.LogRecordData; import io.opentelemetry.sdk.resources.Resource; +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; 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; 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; @@ -183,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 @@ -227,14 +234,18 @@ 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 span, String path) { + span.hasKind(SpanKind.CLIENT) + .hasAttributesSatisfying( + satisfies(UrlAttributes.URL_FULL, a -> a.endsWith(path)), + // this attribute is set by the experimental http instrumentation + satisfies( + HttpIncubatingAttributes.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: