Skip to content

A simple way of monitoring application health in Kotlin.

License

Notifications You must be signed in to change notification settings

ximedes/healthservice-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Monitoring Application Health

A simple way of monitoring application health in Kotlin.

Playing with the demo:

  1. Start com.ximedes.HealthDemoKt.main()
  2. Visit http://localhost:8080/health to see health information
  3. Visit http://localhost:8080/pagehit to update the page hit counter

Using HealthService in your project:

Updating a single health item:

 HealthService.updateItem("pageHits", pageHits)

Registering a callback that gets called when health information is asked:

HealthService.registerCallback("myLiveStatusInformation") {
    "Your callback code goes here"
}

Getting health information as a sorted map:

HealthService.getCurrentHealth()

Exposing health information as a REST endpoint in ktor.io:

routing {
    get("/health") {
        call.respond(HttpStatusCode.OK, HealthService.getCurrentHealth())
    }
}

Have fun!

About

A simple way of monitoring application health in Kotlin.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages