# @nuskin/health-status-utils

> Allow SREs to monitor K8s containerized app's health

Latest version **1.1.0** (published 2024-06-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nuskin/health-status-utils
pnpm add @nuskin/health-status-utils
yarn add @nuskin/health-status-utils
bun add @nuskin/health-status-utils
```

Provides the command `health-status-utils`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2024-06-11 |
| First published | 2023-03-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 8.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Brady Groharing |
| Maintainers | nkranendonk, emoore, nuskin-cws, klau, rellenberger |

## Links

- npm: https://www.npmjs.com/package/@nuskin/health-status-utils
- Repository: git@code.tls.nuskin.io:nextgen-development/platform/libs/health-status-utils
- Homepage: https://code.tls.nuskin.io/nextgen-development/platform/libs/health-status-utils/-/blob/master/README.md
- npm.io page: https://npm.io/package/@nuskin/health-status-utils

## Dependencies (2)

- [express](https://npm.io/package/express.md) 4.19.2
- [@godaddy/terminus](https://npm.io/package/@godaddy/terminus.md) 4.12.1

## Recent versions

- 1.1.0 (latest) — 2024-06-11
- 1.0.0-ngei-782.4 (prerelease) — 2023-03-14
- 1.0.1 — 2023-03-29
- 1.0.0 — 2023-03-24
- 1.0.0-ngei-782.3 — 2023-03-14
- 1.0.0-ngei-782.2 — 2023-03-14
- 1.0.0-ngei-782.1 — 2023-03-13

## README

# Health Status Library

## Purpose
This package provides a series of options for the SREs to monitor the health of our K8s apps:
# Install
```sh
yarn add @nuskin/health-status-utils
```

# Pre-requisites
- Install [Node.js](https://nodejs.org/en/) version 14.0.0

# Install

```
yarn add @nuskin/health-status-utils
```

## Project Structure
The folder structure of this app is explained below:

| Name | Description
| --- | ---
| **\_\_mocks\_\_**        | Contains jest mocks
| **\_\_tests\_\_**        | Contains jest tests
| **src**                  | Contains source code
| .gitignore               | List of files and directories for Git to ignore
| jest.config.js            | Configuration options for Jest
| jest.util.js             | Configuration options for Jest
| .eslintrc                | Configuration options for ES Lint
| .prettierrc              | Configuration options for prettier
| package.json             | Contains npm dependencies as well as build scripts
| .prettierignore          | List of files and directories for prettier to ignore
| cx.config                 | File needed for common pipeline to pass
| yarn.lock                | Yarn state snapshot
| .gitlab-ci.yml           | CI pipeline configuration
| application.yaml    | Configuration file

### Running tests using yarn Scripts
```
yarn test
```

# ESLint
ESLint is a code linter that helps catch minor code quality and style issues.

## ESLint rules
All rules are configured through `.eslintrc`.

## Running ESLint
To run ESLint you can call the ESLint task.
```
yarn lint  // runs only ES lint
```

## Usage

### General
When deployed via a Kubernetes (k8s) container your app will also includes k8s probes for liveness and readiness.
If you initiate the healthchecks then once your container has spun up it'll automatically start performing liveness checks.
Once your app is up and running it is #YOUR JOB# to let the health check know that you are ready using `reportReadiness(true)`
**Example 1:**

```javascript
    initHealthCheckSystems(healthCheckOnSig, healthCheckOnShutdown, readinessCallback, livenessCallback)

    reportReadiness(true)
    reportReadiness(false, ['mockErrorReason'])
```

---
_Source: https://npm.io/package/@nuskin/health-status-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
