Skip to content

Commit

Permalink
Merge pull request #4883 from MeroRai/FISH-333
Browse files Browse the repository at this point in the history
FISH-333 Add Payara HealthCheck Service checkers to MicroProfile Health Readiness Checks
  • Loading branch information
MeroRai authored Oct 4, 2020
2 parents f44fa70 + d80f726 commit d90d20d
Show file tree
Hide file tree
Showing 45 changed files with 964 additions and 325 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2016-2018 Payara Foundation and/or its affiliates. All rights reserved.
* Copyright (c) [2016-2020] Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -72,6 +72,14 @@ public HealthCheckResultStatus getStatus() {
return status;
}

public String getMessage() {
return message;
}

public Exception getException() {
return exception;
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
# Copyright (c) [2017-2018] Payara Foundation and/or its affiliates. All rights reserved.
# Copyright (c) [2017-2020] Payara Foundation and/or its affiliates. All rights reserved.
#
# The contents of this file are subject to the terms of either the GNU
# General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -77,6 +77,8 @@ healthcheck.checker.configuration.enabledLabel=Enabled
healthcheck.checker.configuration.enabledLabelHelpText=Enables or Disables the checker.
healthcheck.checker.configuration.dynamicLabel=Dynamic
healthcheck.checker.configuration.dynamicLabelHelpText=If checked, the HealthCheck Service will be restarted dynamically.
healthcheck.checker.configuration.addToMicroProfileHealthLabel=Add checker to MicroProfile Health
healthcheck.checker.configuration.addToMicroProfileHealthHelpText=Adds the checker to MicroProfile Health and exposes the checkers health result to MicroProfile Health endpoint.
healthcheck.checker.configuration.nameLabel=Name
healthcheck.checker.configuration.nameLabelHelpText=The name of the checker.
healthcheck.checker.configuration.timeLabel=Time
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
<!--

DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright (c) [2017-2020] Payara Foundation and/or its affiliates. All rights reserved.

Copyright (c) 2017 Payara Foundation and/or its affiliatess.
All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common Development
and Distribution License("CDDL") (collectively, the "License"). You
may not use this file except in compliance with the License. You can
obtain a copy of the License at
https://github.com/payara/Payara/blob/master/LICENSE.txt
See the License for the specific
language governing permissions and limitations under the License.

The contents of this file are subject to the terms of the Common Development
and Distribution License("CDDL") (collectively, the "License"). You
may not use this file except in compliance with the License. You can
obtain a copy of the License at
https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
or packager/legal/LICENSE.txt. See the License for the specific
language governing permissions and limitations under the License.
When distributing the software, include this License Header Notice in each
file and include the License file at glassfish/legal/LICENSE.txt.

When distributing the software, include this License Header Notice in each
file and include the License file at packager/legal/LICENSE.txt.
GPL Classpath Exception:
The Payara Foundation designates this particular file as subject to the "Classpath"
exception as provided by the Payara Foundation in the GPL Version 2 section of the License
file that accompanied this code.

Modifications:
If applicable, add the following below the License Header, with the fields
enclosed by brackets [] replaced by your own identifying information:
"Portions Copyright [year] [name of copyright owner]"

Contributor(s):
If you wish your version of this file to be governed by only the CDDL or
only the GPL Version 2, indicate your decision by adding "[Contributor]
elects to include this software in this distribution under the [CDDL or GPL
Version 2] license." If you don't indicate a single choice of license, a
recipient has the option to distribute your version of this file under
either the CDDL, the GPL Version 2 or to extend the choice of license to
its licensees as provided above. However, if you add GPL Version 2 code
and therefore, elected the GPL Version 2 license, then the option applies
only if the new code is made subject to such option by the copyright
holder.
-->

<!initPage
Expand All @@ -37,11 +57,15 @@
value="#{requestScope.resp.data.subReports.get(2).extraProperties.connectionPool}");
mapPut(map="#{pageSession.valueMap}" key="target" value="#{pageSession.configName}");

setPageSessionAttribute(key="convertToFalseList", value={"enabled", "dynamic"});
setPageSessionAttribute(key="convertToFalseList", value={"enabled", "dynamic", "addToMicroProfileHealth"});
if (#{pageSession.valueMap['enabled']}=true) {
setPageSessionAttribute(key="enabledSelected", value="true");
}

if (#{pageSession.valueMap['addToMicroProfileHealth']}=true) {
setPageSessionAttribute(key="addToMicroProfileHealthSelected", value="true");
}

setPageSessionAttribute(key="dynamic", value="true");
/>
</event>
Expand All @@ -58,9 +82,10 @@
<!command
mapPut(map="#{pageSession.valueMap}" key="enabled" value="#{pageSession.enabledSelected}");
mapPut(map="#{pageSession.valueMap}" key="dynamic" value="#{pageSession.dynamic}");
mapPut(map="#{pageSession.valueMap}" key="serviceName" value="healthcheck-cpool");
mapPut(map="#{pageSession.valueMap}" key="addToMicroProfileHealth" value="#{pageSession.addToMicroProfileHealthSelected}");
mapPut(map="#{pageSession.valueMap}" key="serviceName" value="connection-pool");
prepareSuccessfulMsg();
gf.updateEntity(endpoint="#{pageSession.HEALTHCHECK_CONFIG_URL}/healthcheck-service-configure-checker-with-thresholds"
gf.updateEntity(endpoint="#{pageSession.HEALTHCHECK_CONFIG_URL}/set-healthcheck-service-configuration"
attrs="#{pageSession.valueMap}" convertToFalse="#{pageSession.convertToFalseList}");
/>
</sun:button>
Expand All @@ -80,6 +105,11 @@
helpText="$resource{i18nhx.healthcheck.configuration.dynamicLabelHelpText}">
<sun:checkbox id="dynamicBox" selected="#{pageSession.dynamic}" selectedValue="true" />
</sun:property>
<sun:property id="addToMicroProfileHealthProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}"
label="$resource{i18nhx.healthcheck.checker.configuration.addToMicroProfileHealthLabel}"
helpText="$resource{i18nhx.healthcheck.checker.configuration.addToMicroProfileHealthHelpText}">
<sun:checkbox id="addToMicroProfileHealthBox" selected="#{pageSession.addToMicroProfileHealthSelected}" selectedValue="true" />
</sun:property>
<sun:property id="nameProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}"
label="$resource{i18nhx.healthcheck.checker.configuration.nameLabel}"
helpText="$resource{i18nhx.healthcheck.checker.configuration.nameLabelHelpText}">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
<!--

DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright (c) [2017-2020] Payara Foundation and/or its affiliates. All rights reserved.

Copyright (c) 2017 Payara Foundation and/or its affiliatess.
All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common Development
and Distribution License("CDDL") (collectively, the "License"). You
may not use this file except in compliance with the License. You can
obtain a copy of the License at
https://github.com/payara/Payara/blob/master/LICENSE.txt
See the License for the specific
language governing permissions and limitations under the License.

The contents of this file are subject to the terms of the Common Development
and Distribution License("CDDL") (collectively, the "License"). You
may not use this file except in compliance with the License. You can
obtain a copy of the License at
https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
or packager/legal/LICENSE.txt. See the License for the specific
language governing permissions and limitations under the License.
When distributing the software, include this License Header Notice in each
file and include the License file at glassfish/legal/LICENSE.txt.

When distributing the software, include this License Header Notice in each
file and include the License file at packager/legal/LICENSE.txt.
GPL Classpath Exception:
The Payara Foundation designates this particular file as subject to the "Classpath"
exception as provided by the Payara Foundation in the GPL Version 2 section of the License
file that accompanied this code.

Modifications:
If applicable, add the following below the License Header, with the fields
enclosed by brackets [] replaced by your own identifying information:
"Portions Copyright [year] [name of copyright owner]"

Contributor(s):
If you wish your version of this file to be governed by only the CDDL or
only the GPL Version 2, indicate your decision by adding "[Contributor]
elects to include this software in this distribution under the [CDDL or GPL
Version 2] license." If you don't indicate a single choice of license, a
recipient has the option to distribute your version of this file under
either the CDDL, the GPL Version 2 or to extend the choice of license to
its licensees as provided above. However, if you add GPL Version 2 code
and therefore, elected the GPL Version 2 license, then the option applies
only if the new code is made subject to such option by the copyright
holder.
-->

<!initPage
Expand All @@ -37,11 +57,15 @@
value="#{requestScope.resp.data.subReports.get(2).extraProperties.cpuUsage}");
mapPut(map="#{pageSession.valueMap}" key="target" value="#{pageSession.configName}");

setPageSessionAttribute(key="convertToFalseList", value={"enabled", "dynamic"});
setPageSessionAttribute(key="convertToFalseList", value={"enabled", "dynamic", "addToMicroProfileHealth"});
if (#{pageSession.valueMap['enabled']}=true) {
setPageSessionAttribute(key="enabledSelected", value="true");
}

if (#{pageSession.valueMap['addToMicroProfileHealth']}=true) {
setPageSessionAttribute(key="addToMicroProfileHealthSelected", value="true");
}

setPageSessionAttribute(key="dynamic", value="true");
/>
</event>
Expand All @@ -58,9 +82,10 @@
<!command
mapPut(map="#{pageSession.valueMap}" key="enabled" value="#{pageSession.enabledSelected}");
mapPut(map="#{pageSession.valueMap}" key="dynamic" value="#{pageSession.dynamic}");
mapPut(map="#{pageSession.valueMap}" key="serviceName" value="healthcheck-cpu");
mapPut(map="#{pageSession.valueMap}" key="addToMicroProfileHealth" value="#{pageSession.addToMicroProfileHealthSelected}");
mapPut(map="#{pageSession.valueMap}" key="serviceName" value="cpu-usage");
prepareSuccessfulMsg();
gf.updateEntity(endpoint="#{pageSession.HEALTHCHECK_CONFIG_URL}/healthcheck-service-configure-checker-with-thresholds"
gf.updateEntity(endpoint="#{pageSession.HEALTHCHECK_CONFIG_URL}/set-healthcheck-service-configuration"
attrs="#{pageSession.valueMap}" convertToFalse="#{pageSession.convertToFalseList}");
/>
</sun:button>
Expand All @@ -80,6 +105,11 @@
helpText="$resource{i18nhx.healthcheck.configuration.dynamicLabelHelpText}">
<sun:checkbox id="dynamicBox" selected="#{pageSession.dynamic}" selectedValue="true" />
</sun:property>
<sun:property id="addToMicroProfileHealthProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}"
label="$resource{i18nhx.healthcheck.checker.configuration.addToMicroProfileHealthLabel}"
helpText="$resource{i18nhx.healthcheck.checker.configuration.addToMicroProfileHealthHelpText}">
<sun:checkbox id="addToMicroProfileHealthBox" selected="#{pageSession.addToMicroProfileHealthSelected}" selectedValue="true" />
</sun:property>
<sun:property id="nameProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}"
label="$resource{i18nhx.healthcheck.checker.configuration.nameLabel}"
helpText="$resource{i18nhx.healthcheck.checker.configuration.nameLabelHelpText}">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--

Copyright (c) 2017 Payara Foundation and/or its affiliates. All rights reserved.
Copyright (c) [2017-2020] Payara Foundation and/or its affiliates. All rights reserved.

The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -57,11 +57,15 @@
value="#{requestScope.resp.data.subReports.get(0).extraProperties.garbageCollector}");
mapPut(map="#{pageSession.valueMap}" key="target" value="#{pageSession.configName}");

setPageSessionAttribute(key="convertToFalseList", value={"enabled", "dynamic"});
setPageSessionAttribute(key="convertToFalseList", value={"enabled", "dynamic", "addToMicroProfileHealth"});
if (#{pageSession.valueMap['enabled']}=true) {
setPageSessionAttribute(key="enabledSelected", value="true");
}

if (#{pageSession.valueMap['addToMicroProfileHealth']}=true) {
setPageSessionAttribute(key="addToMicroProfileHealthSelected", value="true");
}

setPageSessionAttribute(key="dynamic", value="true");
/>
</event>
Expand All @@ -78,9 +82,10 @@
<!command
mapPut(map="#{pageSession.valueMap}" key="enabled" value="#{pageSession.enabledSelected}");
mapPut(map="#{pageSession.valueMap}" key="dynamic" value="#{pageSession.dynamic}");
mapPut(map="#{pageSession.valueMap}" key="serviceName" value="healthcheck-gc");
mapPut(map="#{pageSession.valueMap}" key="addToMicroProfileHealth" value="#{pageSession.addToMicroProfileHealthSelected}");
mapPut(map="#{pageSession.valueMap}" key="serviceName" value="garbage-collector");
prepareSuccessfulMsg();
gf.updateEntity(endpoint="#{pageSession.HEALTHCHECK_CONFIG_URL}/healthcheck-service-configure-checker-with-thresholds"
gf.updateEntity(endpoint="#{pageSession.HEALTHCHECK_CONFIG_URL}/set-healthcheck-service-configuration"
attrs="#{pageSession.valueMap}" convertToFalse="#{pageSession.convertToFalseList}");
/>
</sun:button>
Expand All @@ -100,6 +105,11 @@
helpText="$resource{i18nhx.healthcheck.configuration.dynamicLabelHelpText}">
<sun:checkbox id="dynamicBox" selected="#{pageSession.dynamic}" selectedValue="true" />
</sun:property>
<sun:property id="addToMicroProfileHealthProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}"
label="$resource{i18nhx.healthcheck.checker.configuration.addToMicroProfileHealthLabel}"
helpText="$resource{i18nhx.healthcheck.checker.configuration.addToMicroProfileHealthHelpText}">
<sun:checkbox id="addToMicroProfileHealthBox" selected="#{pageSession.addToMicroProfileHealthSelected}" selectedValue="true" />
</sun:property>
<sun:property id="nameProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}"
label="$resource{i18nhx.healthcheck.checker.configuration.nameLabel}"
helpText="$resource{i18nhx.healthcheck.checker.configuration.nameLabelHelpText}">
Expand Down
Loading

0 comments on commit d90d20d

Please sign in to comment.