Class HealthCheck
java.lang.Object
codes.grow.packages.skywalking.core.HealthCheck
Implements the
health() contract (SPEC section 2.4): never throws for an unhealthy or
unreachable service, only for CancelledException and ConfigException.-
Method Summary
Modifier and TypeMethodDescriptionstatic HealthStatuscheck(HttpTransport transport, String path) Probes an endpoint once (no retries) and maps the outcome to aHealthStatus.static CompletableFuture<HealthStatus> checkAsync(HttpTransport transport, String path) Asynchronous variant ofcheck(codes.grow.packages.skywalking.core.HttpTransport, java.lang.String).static HealthStatusMaps a transport error tounreachable.static HealthStatusMaps a health response: 2xx is healthy; the word comes from a JSONstatusfield (ok/unhealthywhen absent); other string fields become details.
-
Method Details
-
check
Probes an endpoint once (no retries) and maps the outcome to aHealthStatus.- Parameters:
transport- transport of the clientpath- health path, e.g./health- Returns:
- the status
-
checkAsync
Asynchronous variant ofcheck(codes.grow.packages.skywalking.core.HttpTransport, java.lang.String).- Parameters:
transport- transport of the clientpath- health path- Returns:
- a future with the status (failed only for cancellation and configuration errors)
-
fromResponse
Maps a health response: 2xx is healthy; the word comes from a JSONstatusfield (ok/unhealthywhen absent); other string fields become details.- Parameters:
resp- the response- Returns:
- the status
-
fromError
Maps a transport error tounreachable.- Parameters:
e- the error- Returns:
- an unhealthy status with the redacted reason
-