Giter Club home page Giter Club logo

ex_health's Introduction

ExHealth ExHealth

A health check utility for any OTP application

Build Status codecov

ExHealth runs a supervised GenServer that performs routine health checks which are configurable to your application. Check out ExHealth.Plug for integrating the result into a web endpoint which yields a JSON response like:

{
   last_check:"2018-09-18T06:43:53.773719Z",
   result:{
      check_results:[
         [
            "Database",
            "ok"
         ],
         [
            "PhoenixExampleWeb_Endpoint",
            "ok"
         ]
      ],
      msg:"healthy"
   }
}

Installation

Add ex_health to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_health, "~> 0.1.0"}
  ]
end

Ensure ex_health is started alongside your application by adding this to your mix.exs

def application do
  [applications: [:ex_health]]
end

Getting Started

Configuration for ExHealth must be present the Application environment. This can be done by updating the :ex_health values in your config/config.exs:

config :ex_health,
  module: MyApplication.HealthChecks,
  interval_ms: 1000 # Interval between checks in milliseconds

Then you must define a module MyApplication.HealthChecks with some checks:

defmodule MyApplication.HealthChecks do
  process_check(MyApplication.CacheServer)

  test "Redis" do
    MyRedis.ping() # This should return :ok | {:error, "Message"}
  end
end

Online Documentation

Please see the documentation for ExHealth at https://hexdocs.pm/ex_health

Offline Documentation

You can generate documentation by running the following:

$ mix docs

You can find examples in examples/

Contributing

Pull requests are welcome. The best way to get started is to check out CONTRIBUTING.

Once you have the repo cloned, just run

$ mix deps.get

and then you can start ExHealth with CLI:

$ iex -S mix

License

See LICENSE for more information.

by Herman Singh of Matched Pattern

ex_health's People

Contributors

kartstig avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.