Skip to content

Commit

Permalink
Fix instructions for enabling JSON-P for Health-Checks. (#2528)
Browse files Browse the repository at this point in the history
* Fix instructions for enabling JSON-P.

* Remove unnecessary steps.
  • Loading branch information
michael-simons authored Nov 24, 2020
1 parent 4d632cc commit b30f67c
Showing 1 changed file with 8 additions and 17 deletions.
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

0 comments on commit b30f67c

Please sign in to comment.