-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Properly construct instance of LateBoundBatchSpanProcessor #34545
Conversation
/cc @brunobat (opentelemetry), @radcortez (opentelemetry) |
So what we are doing now is initializing everything at runtime, correct? (instead of the split we had before, where we created a few things at static init). |
Correct, the bean initialization is not forced at build time anymore |
This makes everything much simpler. Not sure about the increased startup time... Most likely not noticeable. |
No rush! |
This comment has been minimized.
This comment has been minimized.
If it gets merged, should it be backported? |
I dunno, I'm on the fence... |
I think we can hold this until 3.3. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to create a new test before approving this PR.
...telemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/TracerRecorder.java
Show resolved
Hide resolved
@radcortez @gsmet I'd like this back-ported to 3.2.* because these changes affect core parts of the extension and 3.2.* will run for a long time, potentially causing complex merges in the future. |
If we want this backported, we probably should do it as soon as possible instead of waiting for late 3.2.z releases |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's be pragmatic then.
I'll not be able to do this while at the RivieraDev conf.
Any iD generator issue can be dealt in this new issue: #34668
I'm going to have to redo this one unfortunately since there are plenty of conflicts... Furthermore, this will conflict with #34647 |
Here is my proposal for this one: I redo it after #34647 is in, in order to avoid additional conflicts. WDYT? |
Sure. |
This now turns out to be harder. I'm looking into how it can be done. |
Should be working now |
But there is another thing I want to improve if possible |
Should be good to go now |
In future, I would like to move the creation of the |
This comment has been minimized.
This comment has been minimized.
Oh, I didn't know about those tests... |
The JDBC telemetry stuff is pretty broken (it only worked by accident before) so I need to see what can be done... |
Those tests are a bit brittle but beware that they end up finding a lot of problems. |
The tests themselves are great and they indeed show a real problem here. |
This is now done entirely in a CDI producer method which is then fully initialized when OpenTelemetry autoconfigures itself Fixes: quarkusio#29987 (which with newer Quarkus versions is even more problematic)
The JDBC failures are now fixed. In general, there were (and probably still are) a lot of timing issues that relate to when the various CDI beans are constructed and obtained. |
Ok @geoand. The interdependencies with vert.x in |
Yes it would. But it's not something we need to do right now - it can wait for the other stuff I want to do around telemetry |
✔️ The latest workflow run for the pull request has completed successfully. It should be safe to merge provided you have a look at the other checks in the summary. |
All tests pass so this is good from my end. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @geoand !
This is now done entirely in a CDI producer method which is then fully initialized when OpenTelemetry autoconfigures itself
Fixes: #29987 (which with newer Quarkus versions is even more problematic)
Detailed explanation:
OpenTelemetry
has not yet been created by CDI. This could happen because there was not declaration of the need for that bean when constructing the DataSource bean, only programmatic lookup.LateBoundBatchSpanProcessor
to a synthetic bean - prior to this commit theLateBoundBatchSpanProcessor
bean was created from a CDI producer but was then "updated" by a recorder. These two operations are obviously not "atomic", meaning that theOpenTelemetry
bean that consumedLateBoundBatchSpanProcessor
would see the bean in the intermediate state - where it was created but not updated.BeanContainer
in recorder methds.Arc.container()...
in recorder methods as these are extremely sensitive to timing issues - by utilizing synthetic beans and theBeanContainer
in recorder methods we overcome this problem.SpanProcessor
s ofOpenTelemetry
even more reasonable. We essentially only includeLateBoundBatchSpanProcessor
in theOpenTelemetry
bean if a delegate has been set.Future work: The creation of the
OpenTelemetry
can be done via a synthetic bean as this allows us complete control over the injection points and does not suffer from any bean creating timing issues (assuming of course the creation is done properly).This would essentially take what is not done in
OpenTelemetryProducer
and move it into a recorder method that includes all the creation logic (including the logic that currently resides in the synthetic bean forLateBoundBatchSpanProcessor
)