Skip to content

rxjs-probe provides an interface similar to Kubernetes probes using RxJS to detect service health.

License

Notifications You must be signed in to change notification settings

a179346/rxjs-probe

Repository files navigation

✨ rxjs-probe ✨

Documentation Documentation Documentation Maintenance License: MIT

rxjs-probe provides an interface similar to Kubernetes probes using RxJS to detect service health.

🔗 Link

📥 Install

npm i rxjs @rxjs-probe/core

🔑 Usage

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.

📖 Examples

You can find more examples on how to use rxjs-probe in rxjs-probe-examples GitHub repository.

🔎 Probe Performers

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

🌟 Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2024 a179346.
This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator