{"id":21275682,"url":"https://github.com/halimath/healthcheck","last_synced_at":"2025-03-15T13:13:44.394Z","repository":{"id":68956947,"uuid":"596630673","full_name":"halimath/healthcheck","owner":"halimath","description":"Configurable live and readyness checks for go(lang)","archived":false,"fork":false,"pushed_at":"2023-03-02T07:46:29.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T03:27:48.233Z","etag":null,"topics":["golang","health-check"],"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/halimath.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-02T15:52:31.000Z","updated_at":"2023-02-22T08:07:46.000Z","dependencies_parsed_at":"2024-02-06T03:15:43.512Z","dependency_job_id":null,"html_url":"https://github.com/halimath/healthcheck","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halimath%2Fhealthcheck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halimath%2Fhealthcheck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halimath%2Fhealthcheck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halimath%2Fhealthcheck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/halimath","download_url":"https://codeload.github.com/halimath/healthcheck/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243732303,"owners_count":20338839,"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-check"],"created_at":"2024-11-21T09:36:09.413Z","updated_at":"2025-03-15T13:13:44.373Z","avatar_url":"https://github.com/halimath.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# healthcheck\n\nMinimal framework to implement health checks for go (golang) applications on top\nof `net/http`.\n\n![CI Status][ci-img-url] \n[![Go Report Card][go-report-card-img-url]][go-report-card-url] \n[![Package Doc][package-doc-img-url]][package-doc-url] \n[![Releases][release-img-url]][release-url]\n\n`healthcheck` provides a minimal, ultra-simple framework for implementing\nliveness and readyness checks for applications. The framework supports HTTP\nbased probes with configurable readyness checks.\n\n# Installation\n\nThis module uses golang modules and can be installed with\n\n```shell\ngo get github.com/halimath/healthcheck@main\n```\n\nIt requires go \u003e= 1.18\n\n# Usage\n\n`healthcheck` provides a `Handler` which can be obtained using `healthcheck.New`.\nYou can add `Check`s to that handler. Checks are executed for readyness probes\nbut not for liveness probes. `Handler` satisfies `http.Handler` so it can be\nmounted to any multiplexer supporting the go standard library handler interface.\n\nSee this minimal example\n\n```go\nh := healthcheck.New()\n\nh.AddCheck(healthcheck.CheckURL(\"http://localhost:1234/\"))\nh.AddCheckFunc(func(ctx context.Context) error {\n\t// Add your check code here\n\treturn nil\n})\n\nhttp.Handle(\"/health/\", http.StripPrefix(\"/health\", h))\n\nlog.Fatal(http.ListenAndServe(\":8080\", nil))\n```\n\n## Options\n\n`healthcheck.New` accepts `Options` that customize the handler`s behavior. Two\nfactory functions are provided:\n\n* `healthcheck.WithErrorLogger` lets you provide a function to log or otherwise\n  treat any `error` received from a readyness check.\n* `healthcheck.WithReadynessTimeout` sets a timeout to apply to all readyness\n  checks (the default is 10 seconds).\n\n## Bundled checks\n\n### URL\n\n`healthcheck` supports checking URLs via `HTTP GET` using either \n`healthcheck.CheckURL` or `healthcheck.CheckHTTPStatus`. The second offers more\ncustomization. Both checks use a `http.Client` to query a URL and assert the\nreceived status code to be in the range `200` - `299`.\n\n### `sql.DB`\n\n`healthcheck` provides a check that executes a `PingContext` (defined via an\ninterface) to ping a remote endpoint. As `*sql.DB` implements a `PingContext`\nfunction it can directly be used as a target for the `healthcheck.CheckPinger`\nfunction.\n\n# License\n\nCopyright 2023 Alexander Metzner.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n[ci-img-url]: https://github.com/halimath/healthcheck/workflows/CI/badge.svg\n[go-report-card-img-url]: https://goreportcard.com/badge/github.com/halimath/healthcheck\n[go-report-card-url]: https://goreportcard.com/report/github.com/halimath/healthcheck\n[package-doc-img-url]: https://img.shields.io/badge/GoDoc-Reference-blue.svg\n[package-doc-url]: https://pkg.go.dev/github.com/halimath/healthcheck\n[release-img-url]: https://img.shields.io/github/v/release/halimath/healthcheck.svg\n[release-url]: https://github.com/halimath/healthcheck/releases","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalimath%2Fhealthcheck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhalimath%2Fhealthcheck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalimath%2Fhealthcheck/lists"}