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

Ensure that the name generated in opentelemetry matches the endpoint being called #44523

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jcuero
Copy link

@jcuero jcuero commented Nov 15, 2024

When combining multiple unis, the operationName field retains the last uni processed instead of retaining the value it was initialized with.

This comment was marked as resolved.

Copy link

quarkus-bot bot commented Nov 15, 2024

/cc @brunobat (opentelemetry), @radcortez (opentelemetry)

@geoand geoand changed the title Fix: Ensuring that the name generated in opentelemetry matches the endpoint being called Ensure that the name generated in opentelemetry matches the endpoint being called Nov 15, 2024
@geoand
Copy link
Contributor

geoand commented Nov 15, 2024

Thanks a lot for this!

I agree the problem needs to be fixed, but I am not convinced this is the proper solution. I will spend some time looking into it as I think the way ClientObservabilityHandler is being used was incorrect from the start.

Comment on lines +50 to +70
private HandlerChain(ClientRestHandler clientCaptureCurrentContextRestHandler,
ClientRestHandler clientSwitchToRequestContextRestHandler, ClientRestHandler clientSendHandler,
ClientRestHandler clientSetResponseEntityRestHandler, ClientRestHandler clientResponseCompleteRestHandler,
ClientRestHandler clientErrorHandler) {
this.clientCaptureCurrentContextRestHandler = clientCaptureCurrentContextRestHandler;
this.clientSwitchToRequestContextRestHandler = clientSwitchToRequestContextRestHandler;
this.clientSendHandler = clientSendHandler;
this.clientSetResponseEntityRestHandler = clientSetResponseEntityRestHandler;
this.clientResponseCompleteRestHandler = clientResponseCompleteRestHandler;
this.clientErrorHandler = clientErrorHandler;
}

private HandlerChain newInstance() {
return new HandlerChain(clientCaptureCurrentContextRestHandler, clientSwitchToRequestContextRestHandler,
clientSendHandler, clientSetResponseEntityRestHandler, clientResponseCompleteRestHandler, clientErrorHandler);
}

HandlerChain setPreClientSendHandler(ClientRestHandler preClientSendHandler) {
this.preClientSendHandler = preClientSendHandler;
return this;
HandlerChain newHandlerChain = newInstance();
newHandlerChain.preClientSendHandler = preClientSendHandler;
return newHandlerChain;
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't the changes here alone be enough to fix the problem? Asking because the change to ClientRequestContextImpl don't seem necessary (although the might be correct)

@@ -15,16 +12,18 @@
import org.jboss.resteasy.reactive.common.jaxrs.ConfigurationImpl;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please avoid star imports

@geoand
Copy link
Contributor

geoand commented Nov 15, 2024

I am also interested to know if CI passed on your fork with this change

Copy link
Contributor

@brunobat brunobat left a comment

Choose a reason for hiding this comment

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

This makes sense to me and the test is thorough.
Left just a minor thingy.

client.helloGet("Naruto"),
client.helloGet("Goku"),
client.helloGetUniExecutor())
.combinedWith((s, s2, s3, s4) -> s + " and " + s2 + " and " + s3 + " and " + s4);
Copy link
Contributor

Choose a reason for hiding this comment

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

'combinedWith(io. smallrye. mutiny. tuples. Functions. Function4<T1,T2,T3,T4,O>)' is deprecated and marked for removal. Can you please use something else?

Comment on lines -69 to +68
Context ctxt = Vertx.currentContext();
if (ctxt != null && VertxContext.isDuplicatedContext(ctxt)) {
this.context = ctxt;
} else {
Context current = client.vertx.getOrCreateContext();
this.context = VertxContext.createNewDuplicatedContext(current);
}
Context current = client.vertx.getOrCreateContext();
this.context = VertxContext.createNewDuplicatedContext(current);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm actually unsure of this. I would really like to know if the tests pass without this change

Copy link
Contributor

@brunobat brunobat Nov 15, 2024

Choose a reason for hiding this comment

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

It fails, I tried the test with the main changes.

Copy link
Contributor

@geoand geoand Nov 15, 2024

Choose a reason for hiding this comment

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

Well, I am not confident about this change at all, at least until somebody convinces me that it needs to be this way. I would like to understand why this is needed.

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

Successfully merging this pull request may close these issues.

Traces are generated with an inconsistent operationName value when combining multiple unis
3 participants