All Projects → nelkinda → health-go

nelkinda / health-go

Licence: MIT license
A golang implementation of the upcoming IETF RFC Health Check Response Format for HTTP APIs

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to health-go

gatus
⛑ Automated service health dashboard
Stars: ✭ 3,018 (+9635.48%)
Mutual labels:  health, uptime
Mining-Minds
Mining Minds is a collection of services, tools and techniques working collaboratively to investigate on human’s daily routines to provide a personalized well-being and health-care support
Stars: ✭ 43 (+38.71%)
Mutual labels:  healthcheck, health
aarogya seva
A beautiful 😍 covid-19 app with self - assessment and more.
Stars: ✭ 118 (+280.65%)
Mutual labels:  healthcheck, health
go-health
❤️ Health check your applications and dependencies
Stars: ✭ 91 (+193.55%)
Mutual labels:  healthcheck, health
kirby3-doctor
Plugin to check health of your CMS installation
Stars: ✭ 19 (-38.71%)
Mutual labels:  health
nodejs-health-checker
This is a Node package that allows you to track the health of your application providing readiness and liveness functionalities.
Stars: ✭ 34 (+9.68%)
Mutual labels:  healthcheck
watcher
watcher(守望者)提供java应用暴露监控/健康检查的能力。
Stars: ✭ 65 (+109.68%)
Mutual labels:  healthcheck
environmental-exposure-ontology
Modular environmental exposures ontology
Stars: ✭ 20 (-35.48%)
Mutual labels:  health
disfetch
Yet another *nix distro fetching program, but less complex.
Stars: ✭ 45 (+45.16%)
Mutual labels:  uptime
tdee-calculator
TDEE Calculator is a composer library that calculates how much energy (calories) are burned daily given the weight, height and age or Lean Body Mass.
Stars: ✭ 16 (-48.39%)
Mutual labels:  health
uptime-card
Minimalistic uptime card for Home Assistant Lovelace UI
Stars: ✭ 152 (+390.32%)
Mutual labels:  uptime
uptimer
Uptimer is an open-source project, and a free discord bot that allows you to make your projects online 24/7 just by using a single cmd.
Stars: ✭ 21 (-32.26%)
Mutual labels:  uptime
react-health-check
Lightweight React hook for checking health of API services.
Stars: ✭ 28 (-9.68%)
Mutual labels:  health
uptime
GitHub Action to check the status of endpoints
Stars: ✭ 30 (-3.23%)
Mutual labels:  uptime
cht-android
A native Android container for Community Health Toolkit (CHT) applications
Stars: ✭ 21 (-32.26%)
Mutual labels:  health
upmail
Email notification hook for https://github.com/sourcegraph/checkup.
Stars: ✭ 62 (+100%)
Mutual labels:  uptime
nutrifacts.js
A library to calculate nutrition facts, smartly. No third party services or remote DBs involved.
Stars: ✭ 22 (-29.03%)
Mutual labels:  health
netcheck
A shell script to check and log when your internet connection goes down.
Stars: ✭ 138 (+345.16%)
Mutual labels:  uptime
webtorrent-health
💚 Get health info about a webtorrent file or magnet link
Stars: ✭ 27 (-12.9%)
Mutual labels:  health
furniture
The furniture R package contains table1 for publication-ready simple and stratified descriptive statistics, tableC for publication-ready correlation matrixes, and other tables #rstats
Stars: ✭ 43 (+38.71%)
Mutual labels:  health

health-go

Go

Golang implementation of the upcoming IETF RFC Health Check Response Format for HTTP APIs.

Usage

In your go program,

  1. Create the health Handler.
  2. Add the handler to your mux/server.
package main

import (
	"github.com/nelkinda/health-go"
	"net/http"
)

func main() {
	// 1. Create the health Handler.
	h := health.New(health.Health{Version: "1", ReleaseID: "1.0.0-SNAPSHOT"}) 

	// 2. Add the handler to your mux/server.
	http.HandleFunc("/health", h.Handler)
	
	// 3. Start your server.
	http.ListenAndServe(":80", nil)
}

Providing Checks

If is possible to provide checks. This library comes with the following checks predefined:

  • system uptime
  • process uptime
  • mongodb health
  • SendGrid health
  • sysinfo information (CPU Utilization, RAM, uptime, number of processes)

You can add any implementation of ChecksProvider to the varargs list of health.New().

package main

import (
	"context"
	"github.com/nelkinda/health-go"
	"github.com/nelkinda/health-go/checks/uptime"
	"github.com/nelkinda/health-go/checks/sysinfo"
	"github.com/nelkinda/health-go/checks/mongodb"
	"github.com/nelkinda/health-go/checks/sendgrid"
	"go.mongodb.org/mongo-driver/mongo"
	"go.mongodb.org/mongo-driver/mongo/options"
	"net/http"
	"time"
)

func main() {
	url := "mongodb://127.0.0.1:27017"
	client, _ := mongo.NewClient(options.Client().ApplyURI(url))
	_ = client.Connect(context.Background())
	h := health.New(
		health.Health{
			Version: "1",
			ReleaseID: "1.0.0-SNAPSHOT",
		},
		uptime.System(),
		uptime.Process(),
		mongodb.Health(url, client, time.Duration(10)*time.Second, time.Duration(40)*time.Microsecond),
		sendgrid.Health(),
		sysinfo.Health(),
	)
	http.HandleFunc("/health", h.Handler)
	http.ListenAndServe(":80", nil)
}

Sample Output (no configured checks)

{
   "releaseId" : "1.0.0-SNAPSHOT",
   "status" : "pass",
   "version" : "1"
}

Sample Output: mongodb

{
   "releaseId" : "1.0.0-SNAPSHOT",
   "status" : "pass",
   "version" : "1",
   "checks" : {
      "mongodb:responseTime" : [
         {
            "componentId" : "mongodb://127.0.0.1:27017",
            "observedUnit" : "ns",
            "time" : "2020-03-08T16:48:01.594380018Z",
            "observedValue" : 147640,
            "status" : "pass"
         }
      ]
   }
}

Sample Output: sendgrid

{
   "status" : "pass",
   "version" : "1",
   "releaseId" : "1.0.0-SNAPSHOT",
   "checks" : {
      "SendGrid" : [
         {
            "status" : "pass",
            "time" : "2020-03-08T16:45:34.427704957Z"
         }
      ]
   }
}

Sample Output: uptime

{
   "status" : "pass",
   "releaseId" : "1.0.0-SNAPSHOT",
   "version" : "1",
   "checks" : {
      "uptime" : [
         {
            "time" : "2020-03-08T16:39:36.409862824Z",
            "observedValue" : 15312,
            "status" : "pass",
            "componentType" : "system",
            "observedUnit" : "s"
         },
         {
            "observedValue" : 6.365804997,
            "time" : "2020-03-08T16:39:36.409871632Z",
            "observedUnit" : "s",
            "componentType" : "process",
            "status" : "pass"
         }
      ]
   }
}

Sample Output: sysinfo

{
   "checks" : {
      "memory:utilization" : [
         {
            "componentType" : "system",
            "componentId" : "Total Ram",
            "observedValue" : 16694185984,
            "status" : "pass",
            "time" : "2020-03-08T16:37:37.559642943Z",
            "observedUnit" : "1 bytes"
         },
         {
            "componentId" : "Free Ram",
            "componentType" : "system",
            "observedValue" : 672645120,
            "status" : "pass",
            "time" : "2020-03-08T16:37:37.559642943Z",
            "observedUnit" : "1 bytes"
         },
         {
            "observedUnit" : "1 bytes",
            "time" : "2020-03-08T16:37:37.559642943Z",
            "observedValue" : 190525440,
            "status" : "pass",
            "componentType" : "system",
            "componentId" : "Shared Ram"
         },
         {
            "componentType" : "system",
            "componentId" : "Buffer Ram",
            "observedValue" : 660090880,
            "status" : "pass",
            "time" : "2020-03-08T16:37:37.559642943Z",
            "observedUnit" : "1 bytes"
         },
         {
            "componentType" : "system",
            "componentId" : "Total Swap",
            "status" : "pass",
            "observedValue" : 18207465472,
            "time" : "2020-03-08T16:37:37.559642943Z",
            "observedUnit" : "1 bytes"
         },
         {
            "observedUnit" : "1 bytes",
            "time" : "2020-03-08T16:37:37.559642943Z",
            "observedValue" : 18204581888,
            "status" : "pass",
            "componentId" : "Free Swap",
            "componentType" : "system"
         },
         {
            "componentType" : "system",
            "componentId" : "Total High",
            "status" : "pass",
            "observedValue" : 0,
            "time" : "2020-03-08T16:37:37.559642943Z",
            "observedUnit" : "1 bytes"
         },
         {
            "status" : "pass",
            "observedValue" : 0,
            "componentId" : "Free High",
            "componentType" : "system",
            "observedUnit" : "1 bytes",
            "time" : "2020-03-08T16:37:37.559642943Z"
         }
      ],
      "uptime" : [
         {
            "time" : "2020-03-08T16:37:37.559642943Z",
            "observedUnit" : "s",
            "componentType" : "system",
            "observedValue" : 15193,
            "status" : "pass"
         }
      ],
      "cpu:utilization" : [
         {
            "componentType" : "system",
            "componentId" : "1 minute",
            "status" : "pass",
            "observedValue" : 0,
            "time" : "2020-03-08T16:37:37.559642943Z",
            "observedUnit" : "%"
         },
         {
            "componentId" : "5 minutes",
            "componentType" : "system",
            "observedValue" : 0,
            "status" : "pass",
            "time" : "2020-03-08T16:37:37.559642943Z",
            "observedUnit" : "%"
         },
         {
            "componentType" : "system",
            "componentId" : "15 minutes",
            "observedValue" : 0,
            "status" : "pass",
            "time" : "2020-03-08T16:37:37.559642943Z",
            "observedUnit" : "%"
         },
         {
            "status" : "pass",
            "observedValue" : 1449,
            "componentId" : "Processes",
            "componentType" : "system",
            "time" : "2020-03-08T16:37:37.559642943Z"
         }
      ],
      "hostname" : [
         {
            "observedValue" : "Nelkinda-Blade-Stealth-2",
            "status" : "pass",
            "componentId" : "hostname",
            "componentType" : "system",
            "time" : "2020-03-08T16:37:37.559642943Z"
         }
      ]
   },
   "version" : "1",
   "releaseId" : "1.0.0-SNAPSHOT",
   "status" : "pass"
}

References

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].