Library with Healtchecks to check a health of Ably services. Three checks are available:
- Ping check,
- Channel check,
- Timer check.
...
member this.ConfigureServices(services: IServiceCollection) =
...
let ably = new AblyRealtime ("apiKey")
...
services.AddHealthChecks()
.AddCheck(
"AblyPing",
AblyPingHealthCheck(
ably,
TimeSpan.FromSeconds 1.
)
)
.AddCheck(
"AblyChannel",
AblyChannelHealthCheck(
ably,
"ServiceName",
"ChannelName"
)
)
.AddCheck(
"AblyTimer",
AblyTimerHealthCheck(
ably,
"ServiceName",
"ChannelName",
TimeSpan.FromSeconds1.,
TimeSpan.FromSeconds1.
)
)
|> ignore
...
...
To get Healthchecks UI
member this.ConfigureServices(services: IServiceCollection) =
...
services
.AddHealthChecksUI(fun s ->
s
.SetEvaluationTimeInSeconds(60)
.AddHealthCheckEndpoint("Self", $"http://{Dns.GetHostName()}/health")
|> ignore)
.AddInMemoryStorage() |> ignore
...
member this.Configure(app: IApplicationBuilder, env: IWebHostEnvironment) =
...
...
app.UseEndpoints(fun endpoints ->
endpoints.MapControllers() |> ignore
endpoints.MapHealthChecksUI(fun setup ->
setup.UIPath <- "/ui-health"
setup.ApiPath <- "/api-ui-health"
) |> ignore
endpoints.MapHealthChecks(
"/health",
HealthCheckOptions(
Predicate = (fun _ -> true),
ResponseWriter = Func<HttpContext, HealthReport, Task>(fun (context) (c: HealthReport) -> UIResponseWriter.WriteHealthCheckUIResponse(context, c))
)
) |> ignore
) |> ignore
...
When configuring Ably Healthcheck's we need to provide a valid ApiKey
. Beyond of that some additional Capabilities and Restrictions could be required to make the HealthCheck's
work properly.
-
Channel Healthcheck
- requires
Publish
Capability, restricted at most to concrete channel (part of configuration),
- requires
-
Timer Healthcheck
- requires
Publish
andSubscribe
Capabilities, restricted at most to a concrete channel (part of configuration).
- requires
Do you want to contribute to this project? Have a look at our contributing guide.
Did you find a bug? Do you want to suggest a feature? Please file an issue here.