{"id":22279045,"url":"https://github.com/kpol/webapi.healthchecks","last_synced_at":"2025-07-28T18:31:09.827Z","repository":{"id":40913260,"uuid":"188927839","full_name":"kpol/WebApi.HealthChecks","owner":"kpol","description":"WebApi implementation of the health check endpoints for reporting the health of app infrastructure components.","archived":false,"fork":false,"pushed_at":"2022-12-07T22:38:28.000Z","size":79,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-08T03:22:56.807Z","etag":null,"topics":["health","health-check","health-checks","health-checks-api","web","web-api"],"latest_commit_sha":null,"homepage":"","language":"C#","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/kpol.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":"2019-05-28T00:52:36.000Z","updated_at":"2023-06-19T17:49:42.000Z","dependencies_parsed_at":"2023-01-23T22:00:19.168Z","dependency_job_id":null,"html_url":"https://github.com/kpol/WebApi.HealthChecks","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpol%2FWebApi.HealthChecks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpol%2FWebApi.HealthChecks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpol%2FWebApi.HealthChecks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpol%2FWebApi.HealthChecks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kpol","download_url":"https://codeload.github.com/kpol/WebApi.HealthChecks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227941949,"owners_count":17844683,"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":["health","health-check","health-checks","health-checks-api","web","web-api"],"created_at":"2024-12-03T15:18:00.612Z","updated_at":"2024-12-03T15:18:01.603Z","avatar_url":"https://github.com/kpol.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WebApi.HealthChecks\n\n[![CI Build](https://github.com/kpol/WebApi.HealthChecks/workflows/CI%20Build/badge.svg)](https://github.com/kpol/WebApi.HealthChecks/actions)\n[![Nuget](https://img.shields.io/nuget/v/WebApi.HealthChecks.svg?logo=nuget)](https://www.nuget.org/packages/WebApi.HealthChecks)\n\nWebApi.HealthChecks offers a **WebApi** implementation of the health check endpoints for reporting the health of app infrastructure components.\n\nThe package is available on [**NuGet**](https://nuget.org/packages/WebApi.HealthChecks)\n\n    PM\u003e Install-Package WebApi.HealthChecks\n\nHealth checks are exposed by an app as HTTP endpoints.\nSupports two endpoints: \n- `GET /health?check=:check` *where* `check` *is optional*\n- `GET /health/ui?check=:check` *where* `check` *is optional*\n\n\nBy default the health check endpoint is created at `/health`\n```\npublic static class WebApiConfig\n{\n    public static void Register(HttpConfiguration config)\n    {\n        config.AddHealthChecks(healthEndpoint: \"health\")\n            .Configure(addWarningHeader: true) // optional configuration\n            .OverrideResultStatusCodes(unhealthy: HttpStatusCode.InternalServerError) // optional configuration\n            .AddCheck(\"sqlDb\", new SqlHealthCheck()) // Singleton instance\n            .AddCheck\u003cICosmosDbCheck\u003e(\"cosmosDb\") // needs to be registered in DependencyResolver\n            .AddCheck(\"lambda\", () =\u003e new HealthCheckResult(HealthStatus.Healthy, \"Lambda check\"));\n    }\n}\n```\n\nEvery health check must implement `IHealthCheck` interface\n```\npublic interface IHealthCheck\n{\n    Task\u003cHealthCheckResult\u003e CheckHealthAsync();\n}\n```\nThe framework supports three statuses: `Unhealthy` , `Degraded` and `Healthy`.\n\n`GET /health` returns json in the following format:\n```\n{\n  \"status\": \"Degraded\",\n  \"totalResponseTime\": 13,\n  \"entries\": {\n    \"sqlDb\": {\n      \"responseTime\": 8,\n      \"status\": \"Healthy\"\n    },\n    \"cosmosDb\": {\n      \"responseTime\": 5,\n      \"status\": \"Degraded\"\n    },\n    \"lambda\": {\n      \"responseTime\": 0,\n      \"status\": \"Healthy\",\n      \"description\": \"Lambda check\"\n    }\n  }\n}\n```\nThe `GET /health/ui?check=:check` endpoint returns a SVG badge which shows individual status of the service component.\nFor example `GET /health/ui?check=cosmosDb` will output this image: ![degraded](/src/WebApi.HealthChecks/Content/status-degraded-lightgrey.svg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkpol%2Fwebapi.healthchecks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkpol%2Fwebapi.healthchecks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkpol%2Fwebapi.healthchecks/lists"}