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

PAYARA-3829 MicroProfile Healthcheck 2.1 implementation #4254

Merged
merged 3 commits into from
Oct 21, 2019
Merged

PAYARA-3829 MicroProfile Healthcheck 2.1 implementation #4254

merged 3 commits into from
Oct 21, 2019

Conversation

jGauravGupta
Copy link
Contributor

@jGauravGupta jGauravGupta commented Oct 6, 2019

Description

MicroProfile Healthcheck 2.0 and 2.1 implementation:

  • Message body of Health check response was modified, outcome and state replaced by status [Breaking Change]
  • Introduction of Health checks for @Liveness and @Readiness on /health/ready and /health/live endpoints
  • To enable the backward compatibility (outcome and state not replaced by status in JSON payload) of /health endpoint set the value of MP_HEALTH_BACKWARD_COMPATIBILITY_ENABLED MP config property to true.
  • /health is deprecated and return combines Health checks data of @Liveness , @Readiness and @Health.

Important Info

Dependant PRs

payara/MicroProfile-TCK-Runners#59

Testing

New tests

Microprofile HealthCheck TCK v2.1

Test suites executed

  • Payara Microprofile TCKs Runner - HealthCheck TCK v1.0 where mp.health.enable-backward-compatibility=true
  • Payara Microprofile TCKs Runner - HealthCheck TCK v2.1

@jGauravGupta jGauravGupta added this to the 5.194 milestone Oct 6, 2019
Copy link
Contributor

@jbee jbee left a comment

Choose a reason for hiding this comment

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

I only have a rough understanding of MP Health so don't take my comments as gospel. It might just be me being confused or picky. What I would like to see overall is a nicer more consistent handling of the 3 types of checks where the type specific part is extracted to e.g. the enum so that the rest of the code can be generic to avoid repeatedly making switches or if-else blocks doing slightly different things for the 3 types we have. Some of my suggestions might help to understand what I mean but I don't think just following all of them would give something fully consistent either. They are more thoughts I had when looking at the particular situations.

…named to MP_HEALTH_BACKWARD_COMPATIBILITY_ENABLED
@jGauravGupta
Copy link
Contributor Author

jenkins test please

Copy link
Member

@Pandrex247 Pandrex247 left a comment

Choose a reason for hiding this comment

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

Looks good, but one quibble.

Tested using my MicroProfileOnMicro app deployed against DAS (after updating health example to 2.1)

@PostConstruct
public void postConstruct() {
if (events == null) {
events = Globals.getDefaultBaseServiceLocator().getService(Events.class);
}
events.register(this);
this.backwardCompEnabled = ConfigProvider.getConfig()
Copy link
Member

Choose a reason for hiding this comment

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

Should this also be checked on each invocation?
As it is, it's not dynamic which slightly defeats one of the purposes of MP Config.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I purposely added this snippet to PostConstruct method instead of each invocation for very minor optimization. Do you think, end-user will need to change MP_HEALTH_BACKWARD_COMPATIBILITY_ENABLED property value dynamically?

Copy link
Member

Choose a reason for hiding this comment

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

In 95% of cases, probably not.
But it's the fact that by being only checked in the postconstruct it essentially means that a restart is required if you want to change this. We can't however actually indicate that, because since it's MP config the option can be defined outside of Payara, so we have no way to check if it has changed except by, well, running this exact check :P

It's probably fine as is, we'd just need to make sure to explicitly document this case.

@MarkWareham MarkWareham merged commit b590f73 into payara:master Oct 21, 2019
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.

5 participants