https://github.com/ably-labs/ably.healthcheck
Add Ably healthchecks to your .NET projects with this NuGet package.
https://github.com/ably-labs/ably.healthcheck
ably dotnet health-check
Last synced: 4 months ago
JSON representation
Add Ably healthchecks to your .NET projects with this NuGet package.
- Host: GitHub
- URL: https://github.com/ably-labs/ably.healthcheck
- Owner: ably-labs
- License: apache-2.0
- Created: 2021-06-20T13:48:21.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-09-04T23:03:48.000Z (almost 2 years ago)
- Last Synced: 2025-02-05T02:47:20.055Z (5 months ago)
- Topics: ably, dotnet, health-check
- Language: F#
- Homepage:
- Size: 95.7 KB
- Stars: 0
- Watchers: 8
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Ably.Heathcheck
* NuGet Status [](https://www.nuget.org/packages/Ably.Healthcheck)
Library with Healtchecks to check a health of [Ably](https://ably.com/) services.
Three checks are available:- Ping check,
- Channel check,
- Timer check.# How to add healthchecks
```fsharp
...
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
```fsharp
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(fun (context) (c: HealthReport) -> UIResponseWriter.WriteHealthCheckUIResponse(context, c))
)
) |> ignore
) |> ignore
...
```## Required capabilities and restrictions
When configuring Ably Healthcheck's we need to provide a valid `ApiKey`. Beyond of that some additional [Capabilities and Restrictions](https://ably.com/docs/core-features/authentication#capability-operations) could be required to make the `HealthCheck's` work properly.
- `Channel Healthcheck`
- requires `Publish` Capability, restricted at most to concrete channel (part of configuration),
- `Timer Healthcheck`
- requires `Publish` and `Subscribe` Capabilities, restricted at most to a concrete channel (part of configuration).## Contributing
Do you want to contribute to this project? Have a look at our [contributing guide](./CONTRIBUTING.md).
## Issues
Did you find a bug? Do you want to suggest a feature? Please file an issue [here](https://github.com/ably-labs/Ably.Healthcheck/issues/new/choose).
## More info
- [Join our Discord server](https://discord.gg/q89gDHZcBK)
- [Follow us on Twitter](https://twitter.com/ablyrealtime)
- [Use our SDKs](https://github.com/ably/)
- [Visit our website](https://ably.com)---
[](https://ably.com)