Skip to content

OpenTelemetry: OneWay client calls not closing the span#1465

Closed
dipsk2 wants to merge 5 commits intoapache:mainfrom
dipsk2:main
Closed

OpenTelemetry: OneWay client calls not closing the span#1465
dipsk2 wants to merge 5 commits intoapache:mainfrom
dipsk2:main

Conversation

@dipsk2
Copy link

@dipsk2 dipsk2 commented Oct 9, 2023

With OTel, it is required for every span must be closed by the one who started it. Not closing it causes issues in the e2e traces.

Added a condition in the OutInterceptor to close the span immediately if it is a one-way call since InInterceptor will never be invoked.

import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import org.apache.cxf.common.logging.LogUtils;
Copy link
Member

Choose a reason for hiding this comment

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

@dipsk2 could you please revert import and formatting changes? thank you

Copy link
Author

Choose a reason for hiding this comment

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

done

Copy link
Member

Choose a reason for hiding this comment

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

TY

@reta
Copy link
Member

reta commented Oct 11, 2023

@dipsk2 I was trying to reproduce the issue but no luck, could you please provide the test case or at least reproducer to it, thank you.

@dipsk2
Copy link
Author

dipsk2 commented Oct 12, 2023

@reta
I have created a small project here: https://github.com/dipsk2/cxf-client-otel-bug to help explain the issue.

There is a test (https://github.com/dipsk2/cxf-client-otel-bug/blob/main/src/test/java/org/example/cxfclientotelbug/CxfClientOtelBugApplicationTests.java) that can be executed to see the behaviour of one-way vs two-way calls.

The test also has comments explaining the observations.
Please have a look. Thank you.

@reta
Copy link
Member

reta commented Oct 14, 2023

@reta
I have created a small project here: https://github.com/dipsk2/cxf-client-otel-bug to help explain the issue.

Thanks a lot @dipsk2 , I think I could confidently confirm that there is an issue with out interceptors and one-way messages, the solution you are suggesting would address one particular case however I believe we need more robust approach in CXF to handle this particular invocation scenario. I will try to have some options drafted shortly. Thank you.

@dipsk2
Copy link
Author

dipsk2 commented Oct 16, 2023

Yes I thought so too, but this was the easiest solution I could think of - based on my limited knowledge of cxf itself.
Thanks for confirming the issue and looking forward to the fix. We are waiting for it.

@reta
Copy link
Member

reta commented Oct 17, 2023

Yes I thought so too, but this was the easiest solution I could think of - based on my limited knowledge of cxf itself. Thanks for confirming the issue and looking forward to the fix. We are waiting for it.

:+1, here we are #1472

@dipsk2
Copy link
Author

dipsk2 commented Oct 19, 2023

Closing this one in favor of #1472

@dipsk2 dipsk2 closed this Oct 19, 2023
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.

2 participants