Library for adding
/health endpoint checks for Akka Http applications.
Provides a default
/health endpoint that checks:
- that the memory state is healthy
- that there is enough available disk space
A load balancer like AWS ELB can be configured to call the health endpoint and it could decide to destroy any unhealthy instances.
This is not a metrics library. Please take a look at Kamon if you are looking for a metrics and tracing library that's well suited for akka-http applications.
Adding the dependency
resolvers += Resolver.jcenterRepo libraryDependencies += "io.github.lhotari" %% "akka-http-health" % "1.0.8"
The library gets published on bintray/jcenter and synchronized from there to Sonatype OSS for staging to Maven central (starting since version
1.0.7). It's recommended to use the jcenter repository since new releases will be available there instantly.
The route instance created by calling
io.github.lhotari.akka.http.health.HealthEndpoint.createDefaultHealthRoute() will handle
/health with default settings. Append that route instance to the desired route binding.
Because of security concerns, it is generally adviced to serve the health endpoint on a separate port that isn't exposed to the public.
For customization, use the trait
io.github.lhotari.akka.http.health.HealthEndpoint and override protected methods. Calling the
createHealthRoute() method creates the route instance.
Pull requests are welcome.
Some basic guidelines:
- A few unit tests would help a lot as well - someone has to do that before the PR gets merged.
- Please rebase the pull request branch against the current master.
- When writing a commit message please follow these conventions.
- If you are fixing an existing issue please add
Fixes gh-XXXXat the end of the commit message (where
XXXXis the issue number).
- Add the license header to each source code file (see existing source code files for an example)
The library is Open Source Software released under the MIT license. See the LICENSE file for details.