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

Add code attributes to spring webflux controller spans and remove spring-webflux.handler.type #12887

Merged
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public Class<?> getCodeClass(Object handler) {
@Nullable
@Override
public String getMethodName(Object handler) {
if (handler instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod) handler;
return handlerMethod.getMethod().getName();
}
Comment on lines +28 to +31
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

return "handle";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ void basicGetTest(Parameter parameter) {
span.hasKind(SpanKind.INTERNAL)
.hasParent(trace.getSpan(0))
.hasAttributesSatisfyingExactly(
equalTo(CODE_FUNCTION, "handle"),
satisfies(
CODE_FUNCTION,
parameter.annotatedMethod == null
? val -> val.isEqualTo("handle")
: val -> val.isEqualTo(parameter.annotatedMethod)),
satisfies(
CODE_NAMESPACE,
parameter.annotatedMethod == null
Expand Down Expand Up @@ -259,7 +263,11 @@ void getAsyncResponseTest(Parameter parameter) {
span.hasKind(SpanKind.INTERNAL)
.hasParent(trace.getSpan(0))
.hasAttributesSatisfyingExactly(
equalTo(CODE_FUNCTION, "handle"),
satisfies(
CODE_FUNCTION,
parameter.annotatedMethod == null
? val -> val.isEqualTo("handle")
: val -> val.isEqualTo(parameter.annotatedMethod)),
satisfies(
CODE_NAMESPACE,
parameter.annotatedMethod == null
Expand Down Expand Up @@ -366,7 +374,11 @@ void createSpanDuringHandlerFunctionTest(Parameter parameter) {
span.hasKind(SpanKind.INTERNAL)
.hasParent(trace.getSpan(0))
.hasAttributesSatisfyingExactly(
equalTo(CODE_FUNCTION, "handle"),
satisfies(
CODE_FUNCTION,
parameter.annotatedMethod == null
? val -> val.isEqualTo("handle")
: val -> val.isEqualTo(parameter.annotatedMethod)),
satisfies(
CODE_NAMESPACE,
parameter.annotatedMethod == null
Expand Down Expand Up @@ -548,7 +560,11 @@ void getToBadEndpointTest(Parameter parameter) {
EXCEPTION_STACKTRACE,
val -> val.isInstanceOf(String.class))))
.hasAttributesSatisfyingExactly(
equalTo(CODE_FUNCTION, "handle"),
satisfies(
CODE_FUNCTION,
parameter.annotatedMethod == null
? val -> val.isEqualTo("handle")
: val -> val.isEqualTo(parameter.annotatedMethod)),
satisfies(
CODE_NAMESPACE,
parameter.annotatedMethod == null
Expand Down Expand Up @@ -695,7 +711,11 @@ void multipleGetsToDelayingRoute(Parameter parameter) {
span.hasKind(SpanKind.INTERNAL)
.hasParent(trace.getSpan(0))
.hasAttributesSatisfyingExactly(
equalTo(CODE_FUNCTION, "handle"),
satisfies(
CODE_FUNCTION,
parameter.annotatedMethod == null
? val -> val.isEqualTo("handle")
: val -> val.isEqualTo(parameter.annotatedMethod)),
satisfies(
CODE_NAMESPACE,
parameter.annotatedMethod == null
Expand Down