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

Fix instructions for enabling JSON-P for Health-Checks. #2528

Merged
merged 2 commits into from
Nov 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 8 additions & 17 deletions docs/se/health/01_health.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -134,29 +134,22 @@ HealthSupport health = HealthSupport.builder()
.build();
----

NOTE: Health check requires the `JSON-P` support to be enabled. See the example
below.

=== Example

[source,java]
.Register a custom health check:
----
HealthSupport health = HealthSupport.builder()
.addLiveness(() -> HealthCheckResponse.named("exampleHealthCheck")
.up()
.withData("time", System.currentTimeMillis())
.build()) // <1>
.build()) // <.>
.build();

Routing.builder()
.register(JsonSupport.create()) // <2>
.register(health) // <3>
.register(health) // <.>
.build();
----
<1> Add a custom health check. This example returns `UP` and current time.
<2> Enable support for `JSON`.
<3> Register health support with web server routing (adds the `/health`
<.> Add a custom health check. This example returns `UP` and current time.
<.> Register health support with web server routing (adds the `/health`
endpoint).

TIP: Balance collecting a lot of information with the need to avoid overloading
Expand Down Expand Up @@ -192,18 +185,16 @@ A set of built-in health checks can be optionally enabled to report various
[source,java]
----
HealthSupport health = HealthSupport.builder()
.addLiveness(HealthChecks.healthChecks()) // <1>
.addLiveness(HealthChecks.healthChecks()) // <.>
.build();

Routing.builder()
.register(JsonSupport.create()) // <2>
.register(health) // <3>
.register(health) // <.>
.build();
----
<1> Add built-in health checks (requires the `helidon-health-checks`
<.> Add built-in health checks (requires the `helidon-health-checks`
dependency).
<2> Register the `JSON-P` support in the WebServer routing.
<3> Register the created health support with web server routing (adds the
<.> Register the created health support with web server routing (adds the
`/health` endpoint).

[source,json]
Expand Down