Skip to content

Commit

Permalink
rename spring autoconfigure to autoconfigure-2 (open-telemetry#11800)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitlinger authored Jul 12, 2024
1 parent c1c76a1 commit e5af139
Show file tree
Hide file tree
Showing 81 changed files with 205 additions and 187 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class OtelInternalJavadoc extends BugChecker implements BugChecker.ClassT

@Override
public Description matchClass(ClassTree tree, VisitorState state) {
if (!isPublic(tree) || !isInternal(state)) {
if (!isPublic(tree) || !isInternal(state) || tree.getSimpleName().toString().endsWith("Test")) {
return Description.NO_MATCH;
}
String javadoc = getJavadoc(state);
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/intellij-setup-and-troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ If you are working on a specific instrumentation, you can load only the modules
For example, to load the modules for the Spring Boot autoconfigure instrumentation, run:

```shell
./docs/contributing/selectModules.kts instrumentation/spring/spring-boot-autoconfigure/
./docs/contributing/selectModules.kts instrumentation/spring/spring-boot-autoconfigure-2/
```

Install the [Kotlin executable](https://kotlinlang.org/docs/tutorials/command-line.html)
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/selectModules.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ main(args)

fun main(args: Array<String>) {
if (args.isEmpty()) {
println("Usage: ./docs/contributing/selectModules.kts instrumentation/spring/spring-boot-autoconfigure/ <module to include2> ...")
println("Usage: ./docs/contributing/selectModules.kts instrumentation/spring/spring-boot-autoconfigure-2/ <module to include2> ...")
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ plugins {
id("otel.library-instrumentation")
}

// Name the Spring Boot modules in accordance with https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.developing-auto-configuration.custom-starter
base.archivesName.set("opentelemetry-spring-boot")
base.archivesName.set("opentelemetry-autoconfigure-spring-boot-2")
group = "io.opentelemetry.instrumentation"

val springBootVersion = "2.7.18" // AutoConfiguration is added in 2.7.0, but can be used with older versions
Expand Down Expand Up @@ -33,9 +32,7 @@ dependencies {
implementation(project(":instrumentation:spring:spring-kafka-2.7:library"))
implementation(project(":instrumentation:spring:spring-web:spring-web-3.1:library"))
implementation(project(":instrumentation:spring:spring-webmvc:spring-webmvc-5.3:library"))
implementation(project(":instrumentation:spring:spring-webmvc:spring-webmvc-6.0:library"))
compileOnly("javax.servlet:javax.servlet-api:3.1.0")
compileOnly("jakarta.servlet:jakarta.servlet-api:5.0.0")
implementation(project(":instrumentation:spring:spring-webflux:spring-webflux-5.3:library"))
implementation(project(":instrumentation:micrometer:micrometer-1.5:library"))
implementation(project(":instrumentation:log4j:log4j-appender-2.17:library"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2;

import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.api.trace.TracerProvider;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.MapConverter;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.SdkEnabled;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtelResourceProperties;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtlpExporterProperties;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.PropagationProperties;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.SpringConfigProperties;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.resources.DistroVersionResourceProvider;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.resources.SpringResourceProvider;
import io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.MapConverter;
import io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.SdkEnabled;
import io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.properties.OtelResourceProperties;
import io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.properties.OtlpExporterProperties;
import io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.properties.PropagationProperties;
import io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.properties.SpringConfigProperties;
import io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.resources.DistroVersionResourceProvider;
import io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.resources.SpringResourceProvider;
import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk;
import io.opentelemetry.sdk.autoconfigure.internal.AutoConfigureUtil;
import io.opentelemetry.sdk.autoconfigure.internal.ComponentLoader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.internal;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal;

import io.opentelemetry.api.OpenTelemetry;
import java.lang.annotation.ElementType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.internal;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal;

import java.util.Map;
import org.springframework.context.annotation.Condition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.internal;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal;

import io.opentelemetry.sdk.autoconfigure.spi.internal.DefaultConfigProperties;
import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.internal;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal;

import org.springframework.boot.autoconfigure.condition.AnyNestedCondition;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.annotations;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.instrumentation.annotations;

import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.instrumentation.annotations.WithSpan;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.ConditionalOnEnabledInstrumentation;
import io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.ConditionalOnEnabledInstrumentation;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.DefaultParameterNameDiscoverer;
import org.springframework.core.ParameterNameDiscoverer;

/** Configures {@link WithSpanAspect} to trace bean methods annotated with {@link WithSpan}. */
/**
* Configures {@link WithSpanAspect} to trace bean methods annotated with {@link WithSpan}.
*
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
@ConditionalOnEnabledInstrumentation(module = "annotations")
@ConditionalOnClass(Aspect.class)
@Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.annotations;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.instrumentation.annotations;

import io.opentelemetry.api.OpenTelemetry;
import org.aspectj.lang.ProceedingJoinPoint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.annotations;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.instrumentation.annotations;

import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.instrumentation.annotations.WithSpan;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.annotations;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.instrumentation.annotations;

import io.opentelemetry.instrumentation.api.incubator.semconv.code.CodeAttributesGetter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.annotations;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.instrumentation.annotations;

import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.api.trace.Span;
Expand All @@ -28,7 +28,7 @@
* can not be applied to constructors.
*/
abstract class WithSpanAspect {
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.spring-boot-autoconfigure";
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.spring-boot-autoconfigure-2";

private final Instrumenter<JoinPointRequest, Object> instrumenter;
private final JoinPointRequest.Factory requestFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.annotations;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.instrumentation.annotations;

import io.opentelemetry.instrumentation.annotations.SpanAttribute;
import io.opentelemetry.instrumentation.api.annotation.support.ParameterAttributeNamesExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.jdbc;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.instrumentation.jdbc;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.instrumentation.jdbc.datasource.JdbcTelemetry;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.InstrumentationConfigUtil;
import io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.properties.InstrumentationConfigUtil;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import javax.sql.DataSource;
import org.springframework.aop.scope.ScopedProxyUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.jdbc;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.instrumentation.jdbc;

import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.ConditionalOnEnabledInstrumentation;
import io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.ConditionalOnEnabledInstrumentation;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import javax.sql.DataSource;
import org.springframework.beans.factory.ObjectProvider;
Expand All @@ -16,6 +16,10 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
@ConditionalOnEnabledInstrumentation(module = "jdbc")
@AutoConfiguration(after = DataSourceAutoConfiguration.class)
@ConditionalOnBean({DataSource.class})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.kafka;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.instrumentation.kafka;

import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.instrumentation.spring.kafka.v2_7.SpringKafkaTelemetry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.kafka;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.instrumentation.kafka;

import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.instrumentation.kafkaclients.v2_6.KafkaTelemetry;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.ConditionalOnEnabledInstrumentation;
import io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.ConditionalOnEnabledInstrumentation;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
Expand All @@ -17,6 +17,10 @@
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
import org.springframework.kafka.core.KafkaTemplate;

/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
@ConditionalOnEnabledInstrumentation(module = "kafka")
@ConditionalOnClass({KafkaTemplate.class, ConcurrentKafkaListenerContainerFactory.class})
@Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.logging;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.instrumentation.logging;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
Expand All @@ -13,6 +13,10 @@
import org.springframework.context.event.GenericApplicationListener;
import org.springframework.core.ResolvableType;

/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
public class LogbackAppenderApplicationListener implements GenericApplicationListener {

private static final Class<?>[] SOURCE_TYPES = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.logging;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.instrumentation.logging;

import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.logging;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.instrumentation.logging;

import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.ConditionalOnEnabledInstrumentation;
import io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.ConditionalOnEnabledInstrumentation;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
@Configuration
@SuppressWarnings("OtelPrivateConstructorForUtilityClass")
public class OpenTelemetryAppenderAutoConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.micrometer;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.instrumentation.micrometer;

import io.micrometer.core.instrument.Clock;
import io.micrometer.core.instrument.MeterRegistry;
import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.instrumentation.micrometer.v1_5.OpenTelemetryMeterRegistry;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.ConditionalOnEnabledInstrumentation;
import io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.ConditionalOnEnabledInstrumentation;
import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
Expand All @@ -19,6 +19,10 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
@ConditionalOnEnabledInstrumentation(module = "micrometer", enabledByDefault = false)
@AutoConfigureAfter(MetricsAutoConfiguration.class)
@AutoConfigureBefore(CompositeMeterRegistryAutoConfiguration.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,24 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.mongo;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.instrumentation.mongo;

import com.mongodb.MongoClientSettings;
import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.instrumentation.mongo.v3_1.MongoTelemetry;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.ConditionalOnEnabledInstrumentation;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.InstrumentationConfigUtil;
import io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.ConditionalOnEnabledInstrumentation;
import io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.properties.InstrumentationConfigUtil;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.mongo.MongoClientSettingsBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
@ConditionalOnBean(OpenTelemetry.class)
@ConditionalOnClass(MongoClientSettings.class)
@ConditionalOnEnabledInstrumentation(module = "mongo")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.r2dbc;
package io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.instrumentation.r2dbc;

import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.ConditionalOnEnabledInstrumentation;
import io.opentelemetry.instrumentation.spring.autoconfigure.v2.internal.ConditionalOnEnabledInstrumentation;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.r2dbc.spi.ConnectionFactory;
import org.springframework.beans.factory.ObjectProvider;
Expand All @@ -15,6 +15,10 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
@ConditionalOnBean(OpenTelemetry.class)
@ConditionalOnClass(ConnectionFactory.class)
@ConditionalOnEnabledInstrumentation(module = "r2dbc")
Expand Down
Loading

0 comments on commit e5af139

Please sign in to comment.