{"id":28158495,"url":"https://github.com/indeedeng/libhealth","last_synced_at":"2026-03-18T01:35:08.987Z","repository":{"id":50091615,"uuid":"311762633","full_name":"indeedeng/libhealth","owner":"indeedeng","description":"flexible Golang healthchecking components","archived":false,"fork":false,"pushed_at":"2023-06-23T21:18:51.000Z","size":54,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-07T23:40:07.052Z","etag":null,"topics":["golang","healthcheck"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/indeedeng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-10T19:25:10.000Z","updated_at":"2023-06-07T00:39:42.000Z","dependencies_parsed_at":"2024-06-20T01:35:38.051Z","dependency_job_id":"eaa04770-bdb9-4f86-8a6a-32ba20657ee9","html_url":"https://github.com/indeedeng/libhealth","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indeedeng%2Flibhealth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indeedeng%2Flibhealth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indeedeng%2Flibhealth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indeedeng%2Flibhealth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indeedeng","download_url":"https://codeload.github.com/indeedeng/libhealth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254310502,"owners_count":22049471,"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","healthcheck"],"created_at":"2025-05-15T09:19:41.373Z","updated_at":"2026-03-18T01:35:03.951Z","avatar_url":"https://github.com/indeedeng.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"libhealth\n=========\n[![Go Report Card](https://goreportcard.com/badge/oss.indeed.com/go/libhealth)](https://goreportcard.com/report/oss.indeed.com/go/libhealth)\n[![Build Status](https://travis-ci.com/indeedeng/libhealth.svg?branch=master)](https://travis-ci.com/indeedeng/libhealth)\n[![GoDoc](https://godoc.org/oss.indeed.com/go/libhealth?status.svg)](https://godoc.org/oss.indeed.com/go/libhealth)\n[![NetflixOSS Lifecycle](https://img.shields.io/osslifecycle/indeedeng/libhealth.svg)](OSSMETADATA)\n[![GitHub](https://img.shields.io/github/license/indeedeng/libhealth.svg)](LICENSE)\n\nlibhealth is a Golang library that provides flexible components to report the current state of external systems\nthat an application depends on, as well as the current health of any internal aspects of the application.\n\n## components\n### dependency set\nMost applications have a set of dependencies whose health state needs to be tracked. A dependency set can\ncompute the health state of an application from health monitors and their associated urgency levels.\n\nThe final health state of an application is computed from their status and urgency. A weakly coupled component\nin a complete outage results in a MINOR healthcheck outage state. A more strongly coupled or required\ncomponent in an OUTAGE results in correspondingly higher outage states. The matrix below illustrates\nthe relationship between the \"urgency\" of a component and computed status.\n\n| Status \\ Urgency | REQUIRED | STRONG | WEAK   | NONE |\n| ---------------- | -------- | ------ | ------ | ---- |\n| OUTAGE           | OUTAGE   | MAJOR  | MINOR  | OK   |\n| MAJOR            | MAJOR    | MAJOR  | MINOR  | OK   |\n| MINOR            | MINOR    | MINOR  | MINOR  | OK   |\n| OK               | OK       | OK     | OK     | OK   |\n\n\nWhile applications can implement a dependency set of their own, a basic dependency set is provided which fits\nmost use cases. Applications typically need one basic dependency set, and libhealth will update monitors\nand track their state in background goroutines.\n\nExample:\n```go\nimport \t\"oss.indeed.com/go/libhealth\"\n\nfunc setupHealth() {\n\tdeps := libhealth.NewBasicDependencySet()\n\tdeps.Register(libhealth.NewMonitor(\n                                \"health-monitor-name\",\n                                \"monitor description\",\n                                \"https://docs/to/your/monitor\",\n                                libhealth.WEAK,\n                                func(ctx context.Context) libhealth.Health {\n                                    // calculate monitor health here\n                                    return libhealth.NewHealth(libhealth.OK, \"everything is fine\")\n                                }))\n}\n```\n\n### healthcheck endpoints\nTypical applications expose several healthcheck endpoints to an HTTP server for tracking their state.\nlibhealth provides two classes of endpoints: public \"info\" and private healthcheck endpoints. The\npublic endpoints are typically consumed by other software (e.g loadbalancers, HAProxy, nginx, etc).\nThey return a 200 or 500 status code and very simple json payload indicating the source of the response.\n\nAn example response to the /info endpoints is shown below:\n```json\n{\n  \"condition\" : \"OK\",\n  \"duration\" : 0,\n  \"hostname\" : \"aus-worker11\"\n}\n```\n\nThe private healthcheck endpoints expose significantly more information about the runtime and environment\nof the process to aid debugging outages, however these should only be exposed to whitelisted ips.\nIf this is not possible, consider only exposing endpoints for the less verbose public endpoints.\n\nA common pattern is to expose the following endpoints:\n```\n/info/healthcheck\n/info/healthcheck/live\n/private/healthcheck\n/private/healthcheck/live\n```\n\nHTTP handlers are provided by libhealth for serving each of these routes:\n```go\nimport \"oss.indeed.com/go/libhealth\"\n\nfunc healthRouter(d libhealth.DependencySet) *http.ServeMux {\n\trouter := http.NewServeMux()\n\trouter.Handle(\"/info/healthcheck\", libhealth.NewInfo(d))\n\trouter.Handle(\"/info/healthcheck/live\", libhealth.NewInfo(d))\n\trouter.Handle(\"/private/healthcheck\", libhealth.NewPrivate(\"my-app-name\", d))\n\trouter.Handle(\"/private/healthcheck/live\", libhealth.NewPrivate(\"my-app-name\", d))\n\treturn router\n}\n```\n\nAlternatively, you can use the helper function `WrapServeMux`, which will register all these handlers for you:\n```go\nimport \"oss.indeed.com/go/libhealth\"\n\n...\nrouter := http.NewServeMux()\nlibhealth.WrapServeMux(router, \"my-app-name\", dependencies)\n```\n\n# Contributing\n\nWe welcome contributions! Feel free to help make `libhealth` better.\n\n### Process\n\n- Open an issue and describe the desired feature / bug fix before making\nchanges. It's useful to get a second pair of eyes before investing development\neffort.\n- Make the change. If adding a new feature, remember to provide tests that\ndemonstrate the new feature works, including any error paths. If contributing\na bug fix, add tests that demonstrate the erroneous behavior is fixed.\n- Open a pull request. Automated CI tests will run. If the tests fail, please\nmake changes to fix the behavior, and repeat until the tests pass.\n- Once everything looks good, one of the indeedeng members will review the\nPR and provide feedback.\n\n# Maintainers\n\nThe `oss.indeed.com/go/libhealth` project is maintained by Indeed Engineering.\n\nWhile we are always busy helping people get jobs, we will try to respond to\nGitHub issues, pull requests, and questions within a couple of business days.\n\n# Code of Conduct\n\n`oss.indeed.com/go/libhealth` is governed by the [Contributer Covenant v1.4.1](CODE_OF_CONDUCT.md)\n\nFor more information please contact opensource@indeed.com.\n\n## License\n\nThe `oss.indeed.com/go/libhealth` project is open source under the [Apache 2.0](LICENSE) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findeedeng%2Flibhealth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findeedeng%2Flibhealth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findeedeng%2Flibhealth/lists"}