-
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
Allow smallrye-health to return DOWN response compliant with rfc9457 #43209
Conversation
xstefank
commented
Sep 11, 2024
•
edited by geoand
Loading
edited by geoand
- Fixes Allow smallrye-health to return DOWN response compliant with rfc9457 #43125
5c1c54f
to
7eb6e84
Compare
This comment has been minimized.
This comment has been minimized.
🎊 PR Preview b8c5a62 has been successfully built and deployed to https://quarkus-pr-main-43209-preview.surge.sh/version/main/guides/
|
This comment has been minimized.
This comment has been minimized.
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.
Nice!
...alth/runtime/src/main/java/io/quarkus/smallrye/health/runtime/SmallRyeHealthHandlerBase.java
Outdated
Show resolved
Hide resolved
...th/runtime/src/main/java/io/quarkus/smallrye/health/runtime/SmallRyeHealthRuntimeConfig.java
Outdated
Show resolved
Hide resolved
9b70379
to
add3364
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@@ -22,8 +31,14 @@ | |||
|
|||
public abstract class SmallRyeHealthHandlerBase implements Handler<RoutingContext> { | |||
|
|||
static boolean problemDetails = false; |
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.
Now that I think of it, this should be volatile
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.
why please?
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.
The reason is that SmallRyeHealthHandlerBase.problemDetails
is set by the main thread (although there is no strict contract for this, this is how it works in practice), but the field is read from an event loop thread (but potentially by any thread).
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.
Just wondering how much of a potentially unnecessary performance cost it has given that it's only written once. This could be avoided by instead passing it to a constructor of the handler. But maybe the performance cost of it being volatile
is negligible.
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.
Obviously the best solution (for more than just performance) is to have final fields.
Given that this is not on the hot path, I wouldn't worry much about the (tiny) performance hit
If we want a solution that sets up the field in the constructor, I can have
a look at some point
…On Fri, Sep 13, 2024, 09:23 Jan Martiska ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
extensions/smallrye-health/runtime/src/main/java/io/quarkus/smallrye/health/runtime/SmallRyeHealthHandlerBase.java
<#43209 (comment)>:
> @@ -22,8 +31,14 @@
public abstract class SmallRyeHealthHandlerBase implements Handler<RoutingContext> {
+ static boolean problemDetails = false;
Just wondering how much of a potentially unnecessary performance cost it
has given that it's only written once. This could be avoided by instead
passing it to a constructor of the handler. But maybe the performance cost
of it being volatile is negligible.
—
Reply to this email directly, view it on GitHub
<#43209 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABBMDP5QDI3NUSLCMUVR743ZWKAFXAVCNFSM6AAAAABOAI6PM6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDGMBSGIYTCMRSHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
@geoand I was thinking about it but this is a base class so we would need to go trough 7-8 subclasses to pass it in constructor. So I opted for a field. |
Okay, makes sense. Let's just use a volatile |
add3364
to
636939a
Compare
Status for workflow
|
Status for workflow
|
This is more a new feature than a fix. We could backport it at some point if there is a strong demand but I would rather have it released in 3.16 first. |