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

Resteasy server span naming #2900

Merged
merged 2 commits into from
May 6, 2021

Conversation

laurit
Copy link
Contributor

@laurit laurit commented May 3, 2021

Currently jax-rs server span naming relies on instrumenting all jax-rs methods in JaxRsAnnotationsInstrumentation and when such a method is called JaxRsAnnotationsTracer tries to figure out a suitable server span name by finding @Path annotations on the called method and class. If @Path annotation is not found on called class it searches class hierarchy for @Path annotation and similarly if @Path is not found on called method it searches class hierarchy for a method that current method overrides.

Unfortunately current implementation does not detect all jax-rs methods. For example

@Path("test-resource-super")
class JaxRsSuperClassTestResource extends JaxRsSuperClassTestResourceSuper {
}

class JaxRsSuperClassTestResourceSuper {
  @GET
  Object call() {
    "ok"
  }
}

JaxRsSuperClassTestResourceSuper.call doesn't get instrumented and

class JaxRsInterfaceClassTestResource extends JaxRsInterfaceClassTestResourceSuper implements JaxRsInterface {
}

@Path("test-resource-interface")
interface JaxRsInterface {
  @Path("call")
  @GET
  Object call()
}

class JaxRsInterfaceClassTestResourceSuper {
  Object call() {
    "ok"
  }
}

JaxRsInterfaceClassTestResourceSuper.call doesn't get instrumented.

This pr implements resteasy specific integration for setting server span name. Resteasy invoker object is associated with the path for which it was created and when the invoker is used that path is set as server span name. This pr also adds support for subresource locators.

@iNikem
Copy link
Contributor

iNikem commented May 5, 2021

@laurit Please rebase

@laurit laurit force-pushed the resteasy-server-span-name branch from 3b70aec to fc291e1 Compare May 5, 2021 08:02
@laurit laurit force-pushed the resteasy-server-span-name branch from fc291e1 to d1cf7db Compare May 6, 2021 11:01
@laurit laurit merged commit 1fba628 into open-telemetry:main May 6, 2021
@laurit laurit deleted the resteasy-server-span-name branch May 6, 2021 12:05
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.

4 participants