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

Health doc updates #7828

Merged
merged 2 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 21 additions & 17 deletions docs/mp/guides/health.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////

Copyright (c) 2019, 2022 Oracle and/or its affiliates.
Copyright (c) 2019, 2023 Oracle and/or its affiliates.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -51,8 +51,7 @@ mvn -U archetype:generate -DinteractiveMode=false \

=== Using the Built-In Health Checks

Helidon has a set of built-in health checks that are automatically enabled to report various
health check statuses that are commonly used:
Helidon has a set of built-in health checks:

* deadlock detection
* available disk space
Expand All @@ -61,10 +60,14 @@ health check statuses that are commonly used:
The following example will demonstrate how to use the built-in health checks. These examples are all executed
from the root directory of your project (helidon-quickstart-mp).

[source,xml]
.Include dependency for the built-in health checks
include::{rootdir}/mp/health.adoc[tag=built-in-health-checks-depc]

[source,bash]
.Build the application, skipping unit tests, then run it:
.Build the application then run it:
----
mvn package -DskipTests=true
mvn package
java -jar target/helidon-quickstart-mp.jar
----

Expand Down Expand Up @@ -488,9 +491,9 @@ The example below will change the root path.
.Create a file named `application.yaml` in the `resources` directory with the following contents:
----
health:
web-context: "myhealth" // <1>
endpoint: "/myhealth" // <1>
----
<1> The web-context specifies a new root path for the health endpoint.
<1> The `endpoint` settings specifies the root path for the health endpoint.

[source,bash]
.Build and run the application, then verify that the health endpoint is using the new `/myhealth` root:
Expand All @@ -507,20 +510,21 @@ The following example will change the root path and the health port.
.Update application.yaml to use a different port and root path for the health endpoint:
----
server:
port: 8080 // <1>
host: "localhost"
port: 8080 // <1>
sockets:
health: // <2>
port: 8081 // <3>
bind-address: "localhost"
- name: "admin" // <2>
port: 8081 // <3>
features:
observe:
sockets: "admin" // <4>
health:
routing: "health" // <4>
web-context: "myhealth"
endpoint: "/myhealth" // <5>

----
<1> The default port for the application.
<2> The name of the new socket, it can be any name, this example uses `health`.
<3> The port for the new health socket.
<4> The health endpoint routing uses the new socket `health`.
<2> The name of the new socket, it can be any name, this example uses `admin`.
<3> The port for the `admin` socket.
<4> The health endpoint, as part of Helidon's observability support, uses the socket `admin`.


[source,bash]
Expand Down
22 changes: 12 additions & 10 deletions docs/mp/health.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,15 @@ If full control over the dependencies is required, and you want to minimize the
To enable built-in health checks add the following dependency
(or use the xref:introduction/microprofile.adoc[helidon-microprofile bundle] )

//tag::built-in-health-checks-depc[]
[source,xml]
----
<dependency>
<groupId>io.helidon.health</groupId>
<artifactId>helidon-health-checks</artifactId>
</dependency>
----

//end::built-in-health-checks-depc[]

== Usage

Expand Down Expand Up @@ -154,7 +155,7 @@ The class responsible for configuration is:

include::{rootdir}/config/io_helidon_webserver_observe_health_HealthObserver.adoc[leveloffset=+1,tag=config]

Current properties may be set in `application.yaml` or in `microprofile-config.properties` with `health` prefix.
Properties may be set in `application.yaml` or in `microprofile-config.properties`, in both cases using the `health` prefix.

For example, you can specify a custom port and root context for the root health endpoint path.
However, you cannot use different ports, such as http://localhost:8080/myhealth and http://localhost:8081/myhealth/live.
Expand All @@ -163,18 +164,18 @@ The example below will change the root path.
[source,properties]
.Create a file named `microprofile-config.properties` in the `resources/META-INF` directory with the following contents:
----
health.web-context=myhealth #<1>
health.endpoint=/myhealth #<1>
----
<1> The web-context specifies a new root path for the health endpoint.
<1> The `endpoint` setting specifies the root path for the health endpoint.

== Examples

Generate Helidon MP Quickstart project following these xref:guides/quickstart.adoc[Instruction]
Generate Helidon MP Quickstart project following these xref:guides/quickstart.adoc[instructions].

=== Using the Built-In Health Checks

Helidon has a set of built-in health checks that are enabled to report various
health check statuses that are commonly used:
Helidon has a set of built-in health checks which report various
ljamen marked this conversation as resolved.
Show resolved Hide resolved
conditions:

* deadlock detection
* available disk space
Expand All @@ -183,6 +184,10 @@ health check statuses that are commonly used:
The following example will demonstrate how to use the built-in health checks. These examples are all executed
from the root directory of your project (helidon-quickstart-mp).

[source,xml]
.Include the built-in health checks dependency in your `pom.xml`:
include::{rootdir}/mp/health.adoc[tag=built-in-health-checks-depc]

[source,bash]
.Build the application, then run it:
----
Expand Down Expand Up @@ -282,9 +287,6 @@ curl http://localhost:8080/health/live
}
----

Full example code is available link:{helidon-github-tree-url}/examples/microprofile[here].


=== Custom Readiness Health Checks

You can add a readiness check to indicate that the application is ready to be used. In this
Expand Down