outtherelabs / play-application-diagnostics

Application diagnostics endpoints for Play framework


Play Application Diagnostics

Travis-CI Coverage Dependencies Codacy Download Maven License

Application diagnostics endpoints for Play framework.


First add sbt-buildinfo to project/plugins.sbt:

addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.6.1")

Then for Play >= 2.5.x add the following to build.sbt:

// Application diagnostics library
libraryDependencies += "com.outtherelabs" %% "play-application-diagnostics" % "0.2.0"

// Package name for sbt-buildinfo
buildInfoPackage := "com.yourpackagenamehere"


To configure the diagnostics endpoints add the following to conf/application.conf:

## Application Diagnostics
# ~~~~~
# Play application diagnostics
application-diagnostics {
  token = "your-secret-diagnostics-token-here"
  build-info-package = "com.yourpackagenamehere"

Then add the endpoints routes to your conf/routes file:

GET     /health-check               com.outtherelabs.applicationdiagnostics.controllers.HealthCheckController.index
GET     /application-diagnostics    com.outtherelabs.applicationdiagnostics.controllers.ApplicationDiagnosticsController.index(token)

Health check response

If you have added the above configuration, then you should be able to now check the health of your application at localhost:9000/health-check

$ curl -i localhost:9000/health-check
HTTP/1.1 200 OK
Content-Length: 2
Content-Type: text/plain; charset=utf-8


Application diagnostics response

You should be able to now see the status of your application at localhost:9000/application-diagnostics

$ curl -i localhost:9000/application-diagnostics?token=your-secret-diagnostics-token-here
HTTP/1.1 200 OK
Content-Length: 51364
Content-Type: application/json

{"applicationDiagnostics":{"status":"UP", ...}