Skip to content

Commit d73304b

Browse files
authored
remove support for deprecated @WithSpan annotation from spring starter (#10530)
1 parent 4d70bb3 commit d73304b

File tree

9 files changed

+423
-639
lines changed

9 files changed

+423
-639
lines changed

instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/annotations/InstrumentationAnnotationsAutoConfiguration.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,4 @@ public class InstrumentationAnnotationsAutoConfiguration {
3030
InstrumentationWithSpanAspect otelInstrumentationWithSpanAspect(OpenTelemetry openTelemetry) {
3131
return new InstrumentationWithSpanAspect(openTelemetry, parameterNameDiscoverer);
3232
}
33-
34-
@Bean
35-
@SuppressWarnings("deprecation") // instrumenting deprecated class for backwards compatibility
36-
@ConditionalOnClass(io.opentelemetry.extension.annotations.WithSpan.class)
37-
SdkExtensionWithSpanAspect otelSdkExtensionWithSpanAspect(OpenTelemetry openTelemetry) {
38-
return new SdkExtensionWithSpanAspect(openTelemetry, parameterNameDiscoverer);
39-
}
4033
}

instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/annotations/JoinPointRequest.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -69,25 +69,4 @@ public JoinPointRequest create(JoinPoint joinPoint) {
6969
return new JoinPointRequest(joinPoint, method, spanName, spanKind);
7070
}
7171
}
72-
73-
static final class SdkExtensionAnnotationFactory implements Factory {
74-
75-
@Override
76-
@SuppressWarnings("deprecation") // instrumenting deprecated class for backwards compatibility
77-
public JoinPointRequest create(JoinPoint joinPoint) {
78-
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
79-
Method method = methodSignature.getMethod();
80-
81-
// in rare cases, when interface method does not have annotations but the implementation does,
82-
// and the AspectJ factory is configured to proxy interfaces, this class will receive the
83-
// abstract interface method (without annotations) instead of the implementation method (with
84-
// annotations); these defaults prevent NPEs in this scenario
85-
io.opentelemetry.extension.annotations.WithSpan annotation =
86-
method.getDeclaredAnnotation(io.opentelemetry.extension.annotations.WithSpan.class);
87-
String spanName = annotation != null ? annotation.value() : "";
88-
SpanKind spanKind = annotation != null ? annotation.kind() : SpanKind.INTERNAL;
89-
90-
return new JoinPointRequest(joinPoint, method, spanName, spanKind);
91-
}
92-
}
9372
}

instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/annotations/SdkExtensionWithSpanAspect.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/annotations/WithSpanAspect.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
import org.springframework.core.ParameterNameDiscoverer;
2020

2121
/**
22-
* Uses Spring-AOP to wrap methods marked by {@link WithSpan} (or the deprecated {@link
23-
* io.opentelemetry.extension.annotations.WithSpan}) in a {@link Span}.
22+
* Uses Spring-AOP to wrap methods marked by {@link WithSpan} in a {@link Span}.
2423
*
2524
* <p>Ensure methods annotated with {@link WithSpan} are implemented on beans managed by the Spring
2625
* container.

instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/annotations/WithSpanAspectParameterAttributeNamesExtractor.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,4 @@ public String spanAttributeName(Parameter parameter) {
7373
return annotation == null ? null : annotation.value();
7474
}
7575
}
76-
77-
static final class SdkExtensionAnnotationAttributeNameSupplier
78-
implements SpanAttributeNameSupplier {
79-
80-
@Nullable
81-
@Override
82-
@SuppressWarnings("deprecation") // instrumenting deprecated class for backwards compatibility
83-
public String spanAttributeName(Parameter parameter) {
84-
io.opentelemetry.extension.annotations.SpanAttribute annotation =
85-
parameter.getDeclaredAnnotation(
86-
io.opentelemetry.extension.annotations.SpanAttribute.class);
87-
return annotation == null ? null : annotation.value();
88-
}
89-
}
9076
}

0 commit comments

Comments
 (0)