{"id":15366332,"url":"https://github.com/talento90/go-health","last_synced_at":"2026-03-10T15:32:36.996Z","repository":{"id":30391994,"uuid":"121421127","full_name":"Talento90/go-health","owner":"Talento90","description":":heart: Health check your applications and dependencies","archived":false,"fork":false,"pushed_at":"2022-01-19T10:53:34.000Z","size":22,"stargazers_count":97,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-17T12:48:46.052Z","etag":null,"topics":["golang","health","healthcheck","monitor"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Talento90.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-13T18:40:54.000Z","updated_at":"2024-09-11T21:25:54.000Z","dependencies_parsed_at":"2022-08-07T15:15:23.481Z","dependency_job_id":null,"html_url":"https://github.com/Talento90/go-health","commit_stats":null,"previous_names":["talento90/health"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Talento90%2Fgo-health","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Talento90%2Fgo-health/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Talento90%2Fgo-health/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Talento90%2Fgo-health/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Talento90","download_url":"https://codeload.github.com/Talento90/go-health/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248975299,"owners_count":21192199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","health","healthcheck","monitor"],"created_at":"2024-10-01T13:18:33.312Z","updated_at":"2026-03-10T15:32:36.951Z","avatar_url":"https://github.com/Talento90.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# health\n\n[![Build Status](https://travis-ci.org/Talento90/go-health.svg?branch=master)](https://travis-ci.org/Talento90/go-health) [![Go Report Card](https://goreportcard.com/badge/github.com/Talento90/go-health)](https://goreportcard.com/report/github.com/Talento90/go-health) [![codecov](https://codecov.io/gh/Talento90/go-health/branch/master/graph/badge.svg)](https://codecov.io/gh/Talento90/go-health)\n[![GoDoc](https://godoc.org/github.com/Talento90/go-health?status.svg)](https://godoc.org/github.com/Talento90/go-health)\n\nHealth package simplifies the way you add health check to your service.\n\nFor a real application using `go-health` please check [ImgArt](https://github.com/Talento90/imgart)\n\n## Supported Features\n\n- Service [health status](https://godoc.org/github.com/Talento90/go-health#Status)\n- Graceful Shutdown Pattern\n- Health check external dependencies\n- HTTP Handler out of the box that returns the health status\n\n## Installation\n\n```\ngo get -u github.com/Talento90/go-health\n```\n\n## How to use\n\n```go\n    // Create a new instance of Health\n    h := New(\"service-name\", Options{CheckersTimeout: time.Second * 1})\n\n    // Register external dependencies\n    h.RegisterChecker(\"redis\", redisDb)\n    h.RegisterChecker(\"mongo\", mongoDb)\n    h.RegisterChecker(\"external_api\", api)\n\n    // Get service health status\n    s := h.GetStatus()\n\n    // Listen interrupt OS signals for graceful shutdown\n    var gracefulShutdown = make(chan os.Signal)\n\n    signal.Notify(gracefulShutdown, syscall.SIGTERM)\n    signal.Notify(gracefulShutdown, syscall.SIGINT)\n\n    go func() {\n    \u003c-gracefulShutdown\n        h.Shutdown()\n\n        // Close Databases gracefully\n        // Close HttpServer gracefully\n    }\n\n\n    // if you have an http server you can register the default handler\n    // ServeHTTP return 503 (Service Unavailable) if service is shutting down\n    http.HandleFunc(\"/health\", h.ServeHTTP)\n```\n\n## Response Example\n\n```json\n{\n    \"service\":\"imgart\",\n    \"up_time\":\"14m5.788341028s\",\n    \"start_time\":\"2018-03-11T17:02:33Z\",\n    \"memory\":{\n        \"current\":{\n            \"total_alloc\":8359984,\n            \"heap_alloc\":2285896,\n            \"rss\":5767168\n        },\n        \"initial\":{\n            \"total_alloc\":7784792,\n            \"heap_alloc\":1754064,\n            \"rss\":5701632\n        },\n        \"diff\":{\n            \"total_alloc\":575192,\n            \"heap_alloc\":531832,\n            \"rss\":65536\n        }\n    },\n    \"go_routines\":21,\n    \"is_shutting_down\":false,\n    \"health_checkers\":{\n        \"mongo\":{\n            \"status\":\"CHECKED\",\n            \"response_time\":\"573.813µs\"\n        },\n        \"redis\":{\n            \"status\":\"CHECKED\",\n            \"error\":{\n                \"Syscall\":\"getsockopt\",\n                \"Err\":113\n            },\n            \"response_time\":\"93.526014ms\"\n        },\n        \"external_api\": {\n            \"status\":\"TIMEOUT\",\n            \"response_time\":\"1.2s\"\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftalento90%2Fgo-health","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftalento90%2Fgo-health","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftalento90%2Fgo-health/lists"}