rxjs-probe provides an interface similar to Kubernetes probes using RxJS to detect service health.
npm i rxjs @rxjs-probe/core
import { Probe, ProbePerformer } from '@rxjs-probe/core';
import axios from 'axios';
const probe = new Probe({
performer: new ProbePerformer(async timeoutSeconds => {
await axios({
url: 'https://github.com/a179346/rxjs-probe',
timeout: timeoutSeconds * 1000,
validateStatus: status => status === 200,
});
}),
initialDelaySeconds: 3,
periodSeconds: 2,
timeoutSeconds: 1,
successThreshold: 1,
failureThreshold: 3,
});
const probeObservable = probe.createObservable();
probeObservable is an RxJS Observable. You can subscribe to it to get the probe status.
Check the RxJS documentation - Observable for more information.
You can find more examples on how to use rxjs-probe in rxjs-probe-examples GitHub repository.
- Probe Performer - The customizable health check performer
- Http Probe Performer - Sending HTTP GET requests to perform the health check.
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
Copyright © 2024 a179346.
This project is MIT licensed.
This README was generated with ❤️ by readme-md-generator