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 a few ServerSpanNaming usages #4900

Merged
merged 2 commits into from
Dec 21, 2021

Conversation

mateuszrzeszutek
Copy link
Member

Another part of #442

I removed ServerSpanNaming usages from a couple instrumentations that seemed to set something other than the route there (my selection criteria were rather arbitrary though, basically "kinda looks like a route, and is not a webservice call"). I left tapestry & vaadin unchanged because they produse a sort-of route pointing to the template used.

Anyway, in the next PR I'll rename ServerSpanNaming and actually set the http.route attribute there.

@@ -31,8 +29,7 @@ public static void start(Message message) {
return;
}

ServerSpanNaming.updateServerSpanName(
parentContext, CONTROLLER, CxfServerSpanNaming.SERVER_SPAN_NAME, request);
CxfServerSpanNaming.updateServerSpanName(parentContext, request);
Copy link
Contributor

Choose a reason for hiding this comment

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

One problem with not using ServerSpanNaming.updateServerSpanName is that when there is an exception and request is dispatched to exception handling servlet it can overwrite the name set by the original request. ServerSpanNaming avoided it by disallowing name update when new name had the same or lower priority as the name set.

Copy link
Member Author

Choose a reason for hiding this comment

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

Does that really happen though? We don't really call updateServerSpanName at the end of processing; there's one invocation in finally block in OpenTelemetryHandlerMappingFilter in spring-webmvc, but it's a web controller framework - it won't run jax-ws code in a controller (probably).

Copy link
Contributor

Choose a reason for hiding this comment

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

In web.xml you can set error pages where container will dispatch when there is an exception or when request status is 500 or whatever. This error handler can be a servlet and could potentially also try to update server span name.

Copy link
Member Author

Choose a reason for hiding this comment

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

True, that's a valid scenario. Hmm, is this behavior that important, should we keep it? Or would it be fine to just ignore that case (since it's just jax-ws; and maybe jax-ws has its own exception handler interface or something)

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe that for jax-ws it is ok to ignore it. It needs to send errors back as a soap response so it can't use servlet error handling.

@@ -77,8 +74,6 @@ public static void startSpan(

Context parentContext = currentContext();
request = new JaxWsRequest(target.getClass(), methodName);
ServerSpanNaming.updateServerSpanName(
Copy link
Contributor

Choose a reason for hiding this comment

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

This would have been relevant only when request is handled by a jax-ws framework that we don't have integration with (or when framework instrumentation is disabled or when there is a bug that prevents it from working properly) because jax-ws framework instrumentation runs before it and already sets the name.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep -- and it sets a <class>.<method> span name, so I thought we won't lose that much (if anything) if I remove that.

@trask trask merged commit 9e3bd5c into open-telemetry:main Dec 21, 2021
@mateuszrzeszutek mateuszrzeszutek deleted the update-server-name branch January 3, 2022 09:23
RashmiRam pushed a commit to RashmiRam/opentelemetry-auto-instr-java that referenced this pull request May 23, 2022
* Remove a few ServerSpanNaming usages

* revert vaadin changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants