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

@Traced annotation doesn't work as documented in opentracing.adoc when combined with JAX-RS #15876

Closed
alexgroom opened this issue Mar 19, 2021 · 6 comments · Fixed by #15992
Closed

Comments

@alexgroom
Copy link

alexgroom commented Mar 19, 2021

I'm trying to combine use of JAX-RS and @Traced annotation in a single app and finding it hard to get any Jaeger output from the annotated calls but it works fine for the REST calls so my basic configuration of Jaeger seems fine.

Expected behavior

I would expect to see tracing generated from the non-REST annotated methods as described in the docs

REST endpoints are automatically traced. If you need to trace additional methods, you can use the org.eclipse.microprofile.opentracing.Traced annotation at class or method level.

This can be useful to trace incoming requests from non-REST calls (like request coming from a message) or to create spans inside a trace.

Actual behavior

Only JAX-RS generated REST calls output seen through Jaeger

To Reproduce

Here is my variant test app which is derived from a Red Hat Quarkus Lab, this includes the incremental lab steps.

https://github.com/alexgroom/quarkus-workshop-m1m2-labs

Full instructions on how to use this code along with Postgres config and mvn build is all well documented here:

http://quarkus-m2-labs-infra.6923.rh-us-east-1.openshiftapps.com/workshop/quarkus-lab/lab/tracing

I was actually trying to do the extra credit lab exercise at the end of this chapter and the lab guide author cannot provide a working solution to this.

Configuration

mvn clean package -DskipTests -f $CHE_PROJECTS_ROOT/quarkus-workshop-m1m2-labs &&
oc label dc/people app.kubernetes.io/part-of=people --overwrite &&
oc annotate dc/people app.openshift.io/connects-to=postgres-database --overwrite

Screenshots

(If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

OpenShift 4.6.4
JDK 11.0.8
CodeReadyWorkspaces (Che 7.24.2)

GraalVM version (if different from Java)

No Graalvm involved

Jaeger output

tracing

Test Script
curl http://people-user1-project./person/swpeople

Alex Groom
Specialist Solution Architect
agroom@redhat.com

@quarkus-bot
Copy link

quarkus-bot bot commented Mar 19, 2021

/cc @Ladicek, @geoand, @kenfinnigan

@Ladicek
Copy link
Contributor

Ladicek commented Mar 19, 2021

What classes or methods did you annotate @Traced and expect traces from them? I see in the GitHub repo that you added some @Traced annotations into the DataTable class, which won't work. The @Traced annotation is an interceptor binding, so it will only work when added on CDI beans (and/or their methods).

@Ladicek
Copy link
Contributor

Ladicek commented Mar 19, 2021

One thing that should be obvious but I found that it sometimes isn't: even if you made DataTable a CDI bean, tracing using @Traced would not work when you construct the DataTable instance yourself (new DataTable()). You'd have to let the CDI container create the instance for you.

@alexgroom
Copy link
Author

The actual base lab code leaves very little scope for using the annotation. But I took the documentation in its simplistic face value and did what it suggested and followed its example, it doesn't mention any limitations or requirements about CDI, but I suspected that might be the problem. Maybe a more complete worked example would be useful here showing the use of @Traced in a proper context which highlights the CDI constraints.

One of the problems with "magic" annotations is the full cost or complexity is very much hidden until it doesn't work and as far as I could find no diagnostic help.

@Ladicek
Copy link
Contributor

Ladicek commented Mar 19, 2021

I hear you, but I have to say that @Traced works as intended in this regard. We can only possibly fix the documentation.

@alexgroom
Copy link
Author

I think the documentation is the piece that is misleading here so please fix that. A more complete worked example here combining the JAX-RS built-in tracing with some annotated elements would also be great

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

Successfully merging a pull request may close this issue.

3 participants