Skip to content

Commit

Permalink
Merge pull request #3125 from Cousjava/PAYARA-2479-health-check-checker
Browse files Browse the repository at this point in the history
PAYARA-2479 PAYARA-3118 MP health check checker
  • Loading branch information
Cousjava committed Oct 29, 2018
2 parents 6a21a26 + 75a8393 commit 4d4d4c2
Show file tree
Hide file tree
Showing 17 changed files with 936 additions and 14 deletions.
@@ -1,6 +1,6 @@
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
# Copyright (c) [2017] Payara Foundation and/or its affiliates. All rights reserved.
# Copyright (c) [2017-2018] 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 @@ -70,6 +70,8 @@ healthcheck.configuration.stuckThreadsCheckerTabTitle=Stuck Threads
healthcheck.configuration.stuckThreadsCheckerTabTitleToolTip=Configures the Stuck Threads HealthCheck.
healthcheck.configuration.garbageCollectorCheckerTabTitle=Garbage Collector
healthcheck.configuration.garbageCollectorCheckerTabTitleToolTip=Configures the Garbage Collector HealthCheck.
healthcheck.configuration.microprofileHealthcheckCheckerTabTitle=MicroProfile Healthcheck Checker
healthcheck.configuration.microprofileHealthcheckCheckerTabTitleToolTip=Configures the MicroProfile Healthcheck HealthCheck

healthcheck.checker.configuration.enabledLabel=Enabled
healthcheck.checker.configuration.enabledLabelHelpText=Enables or Disables the checker.
Expand Down Expand Up @@ -119,6 +121,11 @@ healthcheck.checker.configuration.hoggingThreads.retryCountLabelHelpText=Number
healthcheck.checker.configuration.garbageCollector.pageTitle=Garbage Collector
healthcheck.checker.configuration.garbageCollector.pageTitleHelpText=Configuration options for the Garbage Collector HealthCheck.

healthcheck.checker.configuration.microprofileHealthcheckChecker.pageTitle=Microprofile Healthcheck Checker
healthcheck.checker.configuration.microprofileHealthcheckChecker.pageTitleHelpText=Configuration options for the Microprofile Healthcheck HealthCheck.</br>Checks the status of the Microprofile Healthcheck endpoint for all instances in the domain
healthcheck.checker.configuration.microprofileHealthcheckChecker.timeoutLabel=Timeout
healthcheck.checker.configuration.microprofileHealthcheckChecker.timeoutLabelHelpText=Time in milliseconds before an instance is considered nonresponsive

healthcheck.checker.configuration.stuckThreads.pageTitle=Stuck Threads
healthcheck.checker.configuration.stuckThreads.pageTitleHelpText=Configuration options for the Stuck Threads HealthCheck.
healthcheck.checker.configuration.stuckThreads.timeThresholdLabel=Threshold time
Expand Down
@@ -0,0 +1,129 @@
<!--

Copyright (c) 2018 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
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.

When distributing the software, include this License Header Notice in each
file and include the License file at glassfish/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
setResourceBundle(key="i18nhx" bundle="fish.payara.admingui.healthcheck.Strings");
/>
<!composition template="/templates/default.layout"
guiTitle="$resource{i18nhx.healthcheck.checker.configuration.microprofileHealthcheckChecker.pageTitle}">

<!define name="content">

<event>
<!beforeCreate
getRequestValue(key="configName" value="#{pageSession.configName}");
setPageSessionAttribute(key="HEALTHCHECK_CONFIG_URL",
value="#{sessionScope.REST_URL}/configs/config/#{pageSession.configName}/health-check-service-configuration");

gf.restRequest(endpoint="#{pageSession.HEALTHCHECK_CONFIG_URL}/get-healthcheck-configuration?target=#{pageSession.configName}"
method="GET" result="#{requestScope.resp}");
setPageSessionAttribute(key="valueMap",
value="#{requestScope.resp.data.subReports.get(4).extraProperties.mpHealth}");
mapPut(map="#{pageSession.valueMap}" key="target" value="#{pageSession.configName}");

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

setPageSessionAttribute(key="dynamic", value="true");
/>
</event>

<sun:form id="propertyForm">
#include "/common/shared/alertMsg_1.inc"
#include "/healthcheck/healthcheck/healthcheckConfigTabs.inc
<sun:title id="propertyContentPage" title="$resource{i18nhx.healthcheck.checker.configuration.microprofileHealthcheckChecker.pageTitle}"
helpText="$resource{i18nhx.healthcheck.checker.configuration.microprofileHealthcheckChecker.pageTitleHelpText}" >
<!facet pageButtonsTop>
<sun:panelGroup id="topButtons">
<sun:button id="saveButton" text="$resource{i18n.button.Save}"
onClick="if (guiValidate('#{reqMsg}','#{reqInt}','#{reqPort}')) submitAndDisable(this, '$resource{i18n.button.Processing}'); return false;" >
<!command
mapPut(map="#{pageSession.valueMap}" key="enabled" value="#{pageSession.enabledSelected}");
mapPut(map="#{pageSession.valueMap}" key="dynamic" value="#{pageSession.dynamic}");
prepareSuccessfulMsg();
gf.updateEntity(endpoint="#{pageSession.HEALTHCHECK_CONFIG_URL}/healthcheck-mp-configure"
attrs="#{pageSession.valueMap}" convertToFalse="#{pageSession.convertToFalseList}");
/>
</sun:button>
</sun:panelGroup>
</facet>
</sun:title>
<sun:propertySheet id="propertySheet">
#include "/common/shared/configNameSection.inc"
<sun:propertySheetSection id="mpHealthcheckCheckerProps">
<sun:property id="enabledProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}"
label="$resource{i18nhx.healthcheck.configuration.enabledLabel}"
helpText="$resource{i18nhx.healthcheck.configuration.enabledLabelHelpText}">
<sun:checkbox id="enabledBox" selected="#{pageSession.enabledSelected}" selectedValue="true" />
</sun:property>
<sun:property id="dynamicProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}"
label="$resource{i18nhx.healthcheck.configuration.dynamicLabel}"
helpText="$resource{i18nhx.healthcheck.configuration.dynamicLabelHelpText}">
<sun:checkbox id="dynamicBox" selected="#{pageSession.dynamic}" 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}">
<sun:textField id="nameField" columns="$int{40}" maxLength="250" text="#{pageSession.valueMap['checkerName']}"/>
</sun:property>
<sun:property id="timeProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}"
label="$resource{i18nhx.healthcheck.checker.configuration.timeLabel}"
helpText="$resource{i18nhx.healthcheck.checker.configuration.timeLabelHelpText}">
<sun:textField id="timeField" columns="$int{40}" maxLength="250" styleClass="integer"
text="#{pageSession.valueMap['time']}"/>
</sun:property>
<sun:property id="unitProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}"
label="$resource{i18nhx.healthcheck.checker.configuration.unitLabel}"
helpText="$resource{i18nhx.healthcheck.checker.configuration.unitLabelHelpText}">
<sun:dropDown id="unitDropdown" selected="#{pageSession.valueMap['unit']}"
labels={"NANOSECONDS", "MICROSECONDS", "MILLISECONDS", "SECONDS", "MINUTES", "HOURS", "DAYS"} />
</sun:property>
<sun:property id="thresholdTimeProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}"
label="$resource{i18nhx.healthcheck.checker.configuration.microprofileHealthcheckChecker.timeoutLabel}"
helpText="$resource{i18nhx.healthcheck.checker.configuration.microprofileHealthcheckChecker.timeoutLabelHelpText}">
<sun:textField id="timeField" columns="$int{40}" maxLength="250" styleClass="integer"
text="#{pageSession.valueMap['timeout']}"/>
</sun:property>
</sun:propertySheetSection>
</sun:propertySheet>
</sun:form>
</define>
</composition>
@@ -1,6 +1,6 @@
<!--
Copyright (c) 2017 Payara Foundation and/or its affiliates. All rights reserved.
Copyright (c) 2017-2018 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 @@ -114,5 +114,15 @@
gf.redirect(page="#{request.contextPath}/healthcheck/healthcheck/checkers/garbageCollectorCheckerConfiguration.jsf?configName=#{configName}");
/>
</sun:tab>

<sun:tab id="healthcheckMicroprofileHealthcheckCheckerTab" immediate="true"
text="$resource{i18nhx.healthcheck.configuration.microprofileHealthcheckCheckerTabTitle}"
toolTip="$resource{i18nhx.healthcheck.configuration.microprofileHealthcheckCheckerTabTitleToolTip}"
visible="#{pageSession.configName == 'server-config'}">
<!command
setSessionAttribute(key="healthcheckConfigTab" value="healthcheckMicroprofileHealthcheckCheckerTab");
gf.redirect(page="#{request.contextPath}/healthcheck/healthcheck/checkers/mphealthcheckConfiguration.jsf?configName=#{configName}");
/>
</sun:tab>
</sun:tabSet>

2 changes: 1 addition & 1 deletion appserver/admingui/war/src/main/webapp/WEB-INF/sun-web.xml
Expand Up @@ -61,6 +61,6 @@
<parameter-encoding default-charset="UTF-8" />
</locale-charset-info>

<class-loader delegate="true" extra-class-path="WEB-INF/extra/webui-jsf-suntheme-4.0.2.10.payara-p12.jar:WEB-INF/extra/dojo-ajax-nodemo-0.4.4.jar:WEB-INF/extra/webui-jsf-4.0.2.10.payara-p12.jar:WEB-INF/extra/commons-fileupload-1.3.3.jar:WEB-INF/extra/commons-io-2.5.jar:WEB-INF/extra/json-1.0.jar:WEB-INF/extra/prototype-1.5.0.jar" />
<class-loader delegate="true" extra-class-path="WEB-INF/extra/webui-jsf-suntheme-4.0.2.10.payara-p13.jar:WEB-INF/extra/dojo-ajax-nodemo-0.4.4.jar:WEB-INF/extra/webui-jsf-4.0.2.10.payara-p13.jar:WEB-INF/extra/commons-fileupload-1.3.3.jar:WEB-INF/extra/commons-io-2.5.jar:WEB-INF/extra/json-1.0.jar:WEB-INF/extra/prototype-1.5.0.jar" />

</sun-web-app>
5 changes: 5 additions & 0 deletions appserver/packager/microprofile-package/pom.xml
Expand Up @@ -207,6 +207,11 @@
<artifactId>microprofile-healthcheck</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>fish.payara.appserver</groupId>
<artifactId>healthcheck-checker</artifactId>
<version>${project.version}</version>
</dependency>

<!-- REST Client -->
<dependency>
Expand Down
101 changes: 101 additions & 0 deletions appserver/payara-appserver-modules/healthcheck-checker/pom.xml
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright (c) [2018] 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
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.
When distributing the software, include this License Header Notice in each
file and include the License.
When distributing the software, include this License Header Notice in each
file and include the License file at glassfish/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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.glassfish.main</groupId>
<artifactId>payara-appserver-modules</artifactId>
<version>5.184-SNAPSHOT</version>
</parent>
<groupId>fish.payara.appserver</groupId>
<artifactId>healthcheck-checker</artifactId>
<packaging>glassfish-jar</packaging>
<name>Healthcheck Checker</name>
<description>Microprofile Healthcheck Checker</description>

<dependencies>
<dependency>
<groupId>fish.payara.payara-modules</groupId>
<artifactId>healthcheck-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>fish.payara.payara-modules</groupId>
<artifactId>notification-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.health</groupId>
<artifactId>microprofile-health-api</artifactId>
<version>${microprofile-healthcheck.version}</version>
</dependency>
<dependency>
<groupId>fish.payara.microprofile.healthcheck</groupId>
<artifactId>microprofile-healthcheck</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.main.admin</groupId>
<artifactId>config-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>fish.payara.admingui</groupId>
<artifactId>console-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>fish.payara.micro</groupId>
<artifactId>payara-micro-service</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>${javaee.api.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,72 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) [2018] 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
* 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.
*
* When distributing the software, include this License Header Notice in each
* file and include the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/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.
*/
package fish.payara.healthcheck.mphealth;

import fish.payara.nucleus.healthcheck.HealthCheckExecutionOptions;
import java.util.concurrent.TimeUnit;

/**
* Execution Options for the Microprofile Healthcheck checker.
*
* This contains the timeout for getting the healthcheck from the remote endpoint
* @author jonathan coustick
* @since 5.184
*/
public class HealthCheckTimeoutExecutionOptions extends HealthCheckExecutionOptions {

private final long timeout;

public HealthCheckTimeoutExecutionOptions(boolean enabled, long time, TimeUnit unit, long timeout) {
super(enabled, time, unit);
this.timeout = timeout;
}

/**
* The timeout for getting a response from the remove server
* @return The connection timeout in milliseconds
*/
public long getTimeout() {
return timeout;
}

}

0 comments on commit 4d4d4c2

Please sign in to comment.