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

Implement withSpan method utilities for Mutiny #44411

Closed
brunobat opened this issue Nov 11, 2024 · 8 comments · Fixed by #45478
Closed

Implement withSpan method utilities for Mutiny #44411

brunobat opened this issue Nov 11, 2024 · 8 comments · Fixed by #45478

Comments

@brunobat
Copy link
Contributor

brunobat commented Nov 11, 2024

Description

This is an issue to create an utility class to make it easier to create custom OpenTelemetry spans when using Mutiny.
See Superheroes utility class: https://github.com/jan-peremsky/quarkus-reactive-otel/blob/c74043d388ec4df155f466f1d6938931c3389b70/src/main/java/com/fng/ewallet/pex/Tracer.java

Copy link

quarkus-bot bot commented Nov 11, 2024

/cc @cescoffier (mutiny), @jponge (mutiny)

@arn-ivu
Copy link
Contributor

arn-ivu commented Dec 19, 2024

I have simplified and unit-tested the utility by Jan Peremsky to use mutiny only. You can find it here: https://github.com/arn-ivu/MutinyTracingHelper/blob/main/src/main/java/de/ivu/arn/helper/MutinyTracingHelper.java
Maybe this spares someone else from having to understand all the details.

I am not 100% sure what kind of utility you envision for the official quarkus extension @brunobat. If it's similar to what I did here, I would be happy to open a PR.

@brunobat
Copy link
Contributor Author

That can help @arn-ivu. Let me ask @cescoffier and @edeandrea if they like the approach you followed.

@edeandrea
Copy link
Contributor

I guess I'm not sure what problem we are trying to solve? Using @WithSpan and @SpanAttributes on methods returning reactive types seems to work fine.

@brunobat
Copy link
Contributor Author

This doesn't use the annotations and should allow the creation of spans from Mutiny pipelines.

@edeandrea
Copy link
Contributor

Gotcha. What @arn-ivu is doing looks very similar to what I did in https://github.com/quarkusio/quarkus-super-heroes/blob/main/event-statistics/src/main/java/io/quarkus/sample/superheroes/statistics/listener/SuperStats.java

I would think though that this utility class wouldn't need to be a CDI bean, and therefore no need for @ApplicationScoped? Just a utility class with some static helper methods?

I didn't give it a thorough code review nor did I look at the tests.

@arn-ivu
Copy link
Contributor

arn-ivu commented Jan 7, 2025

Hi, happy new year everyone :-)

I have originally uses a CDI-Bean in order to inject the tracer, but I agree that static helper methods make more sense. I have pushed an update to https://github.com/arn-ivu/MutinyTracingHelper/blob/main/src/main/java/de/ivu/arn/helper/MutinyTracingHelper.java

If you would like me to add this code to quarkus-opentelemetry I would appreaciate a hint where (i.e. in what project/packet) it should go (I am not very familiar with the quarkus code base)

@brunobat
Copy link
Contributor Author

brunobat commented Jan 7, 2025

@arn-ivu, I believe it should live in the quarkus-opentelemetry extension itself, pretty much like the CDI utilities, under a new package inside the tracing:
https://github.com/quarkusio/quarkus/tree/main/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing

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

Successfully merging a pull request may close this issue.

3 participants