Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove support for deprecated @WithSpan annotation from spring starter #10530

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,4 @@ public class InstrumentationAnnotationsAutoConfiguration {
InstrumentationWithSpanAspect otelInstrumentationWithSpanAspect(OpenTelemetry openTelemetry) {
return new InstrumentationWithSpanAspect(openTelemetry, parameterNameDiscoverer);
}

@Bean
@SuppressWarnings("deprecation") // instrumenting deprecated class for backwards compatibility
@ConditionalOnClass(io.opentelemetry.extension.annotations.WithSpan.class)
SdkExtensionWithSpanAspect otelSdkExtensionWithSpanAspect(OpenTelemetry openTelemetry) {
return new SdkExtensionWithSpanAspect(openTelemetry, parameterNameDiscoverer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,4 @@ public JoinPointRequest create(JoinPoint joinPoint) {
return new JoinPointRequest(joinPoint, method, spanName, spanKind);
}
}

static final class SdkExtensionAnnotationFactory implements Factory {

@Override
@SuppressWarnings("deprecation") // instrumenting deprecated class for backwards compatibility
public JoinPointRequest create(JoinPoint joinPoint) {
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
Method method = methodSignature.getMethod();

// in rare cases, when interface method does not have annotations but the implementation does,
// and the AspectJ factory is configured to proxy interfaces, this class will receive the
// abstract interface method (without annotations) instead of the implementation method (with
// annotations); these defaults prevent NPEs in this scenario
io.opentelemetry.extension.annotations.WithSpan annotation =
method.getDeclaredAnnotation(io.opentelemetry.extension.annotations.WithSpan.class);
String spanName = annotation != null ? annotation.value() : "";
SpanKind spanKind = annotation != null ? annotation.kind() : SpanKind.INTERNAL;

return new JoinPointRequest(joinPoint, method, spanName, spanKind);
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
import org.springframework.core.ParameterNameDiscoverer;

/**
* Uses Spring-AOP to wrap methods marked by {@link WithSpan} (or the deprecated {@link
* io.opentelemetry.extension.annotations.WithSpan}) in a {@link Span}.
* Uses Spring-AOP to wrap methods marked by {@link WithSpan} in a {@link Span}.
*
* <p>Ensure methods annotated with {@link WithSpan} are implemented on beans managed by the Spring
* container.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,4 @@ public String spanAttributeName(Parameter parameter) {
return annotation == null ? null : annotation.value();
}
}

static final class SdkExtensionAnnotationAttributeNameSupplier
implements SpanAttributeNameSupplier {

@Nullable
@Override
@SuppressWarnings("deprecation") // instrumenting deprecated class for backwards compatibility
public String spanAttributeName(Parameter parameter) {
io.opentelemetry.extension.annotations.SpanAttribute annotation =
parameter.getDeclaredAnnotation(
io.opentelemetry.extension.annotations.SpanAttribute.class);
return annotation == null ? null : annotation.value();
}
}
}
Loading
Loading