How to use health-checkup - 8 common examples

To help you get started, we’ve selected a few health-checkup examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hfreire / get-me-a-date / src / utils / rekognition.js View on Github external
AWS.config.update({ region, accessKeyId, secretAccessKey })

    this._rekognition = Promise.promisifyAll(new AWS.Rekognition())

    this._circuitBreaker = new Brakes(this._options.breaker)

    this._rekognition.listCollectionsCircuitBreaker = this._circuitBreaker.slaveCircuit((params) => retry(() => this._rekognition.listCollectionsAsync(params), this._options.retry))
    this._rekognition.createCollectionCircuitBreaker = this._circuitBreaker.slaveCircuit((params) => retry(() => this._rekognition.createCollectionAsync(params), this._options.retry))
    this._rekognition.indexFacesCircuitBreaker = this._circuitBreaker.slaveCircuit((params) => retry(() => this._rekognition.indexFacesAsync(params), this._options.retry))
    this._rekognition.listFacesCircuitBreaker = this._circuitBreaker.slaveCircuit((params) => retry(() => this._rekognition.listFacesAsync(params), this._options.retry))
    this._rekognition.deleteFacesCircuitBreaker = this._circuitBreaker.slaveCircuit((params) => retry(() => this._rekognition.deleteFacesAsync(params), this._options.retry))
    this._rekognition.detectFacesCircuitBreaker = this._circuitBreaker.slaveCircuit((params) => retry(() => this._rekognition.detectFacesAsync(params), this._options.retry))
    this._rekognition.detectLabelsCircuitBreaker = this._circuitBreaker.slaveCircuit((params) => retry(() => this._rekognition.detectLabelsAsync(params), this._options.retry))
    this._rekognition.searchFacesByImageCircuitBreaker = this._circuitBreaker.slaveCircuit((params) => retry(() => this._rekognition.searchFacesByImageAsync(params), this._options.retry))

    Health.addCheck('rekognition', () => new Promise((resolve, reject) => {
      if (this._circuitBreaker.isOpen()) {
        return reject(new Error(`circuit breaker is open`))
      } else {
        return resolve()
      }
    }))
  }
github hfreire / get-me-a-date / src / channels / auth / facebook.js View on Github external
constructor (options = {}) {
    this._options = _.defaults(options, defaultOptions)

    this._breaker = new Brakes(this._options.breaker)

    this._authorizeAppCircuitBreaker = this._breaker.slaveCircuit((...params) => retry(() => authorizeApp.bind(this)(...params), this._options.retry))

    Health.addCheck('facebook', () => new Promise((resolve, reject) => {
      if (this._breaker.isOpen()) {
        return reject(new Error(`circuit breaker is open`))
      } else {
        return resolve()
      }
    }))
  }
github hfreire / get-me-a-date / src / utils / s3.js View on Github external
AWS.config.update({ region, accessKeyId, secretAccessKey })

    this._s3 = Promise.promisifyAll(new AWS.S3())

    this._circuitBreaker = new Brakes(this._options.breaker)

    this._s3.listBucketsCircuitBreaker = this._circuitBreaker.slaveCircuit((params) => retry(() => this._s3.listBucketsAsync(params), this._options.retry))
    this._s3.createBucketCircuitBreaker = this._circuitBreaker.slaveCircuit((params) => retry(() => this._s3.createBucketAsync(params), this._options.retry))
    this._s3.putBucketPolicyCircuitBreaker = this._circuitBreaker.slaveCircuit((params) => retry(() => this._s3.putBucketPolicyAsync(params), this._options.retry))
    this._s3.putObjectCircuitBreaker = this._circuitBreaker.slaveCircuit((params) => retry(() => this._s3.putObjectAsync(params), this._options.retry))
    this._s3.copyObjectCircuitBreaker = this._circuitBreaker.slaveCircuit((params) => retry(() => this._s3.copyObjectAsync(params), this._options.retry))
    this._s3.getObjectCircuitBreaker = this._circuitBreaker.slaveCircuit((params) => retry(() => this._s3.getObjectAsync(params), this._options.retry))
    this._s3.deleteObjectCircuitBreaker = this._circuitBreaker.slaveCircuit((params) => retry(() => this._s3.deleteObjectAsync(params), this._options.retry))
    this._s3.listObjectsCircuitBreaker = this._circuitBreaker.slaveCircuit((params) => retry(() => this._s3.listObjectsAsync(params), this._options.retry))

    Health.addCheck('s3', () => new Promise((resolve, reject) => {
      if (this._circuitBreaker.isOpen()) {
        return reject(new Error(`circuit breaker is open`))
      } else {
        return resolve()
      }
    }))
  }
github hfreire / get-me-a-date / src / channels / happn.js View on Github external
constructor (options = {}) {
    super('happn')

    this._options = _.defaults(options, defaultOptions)

    this._happn = new HappnWrapper()

    Health.addCheck(this.name, () => new Promise((resolve, reject) => {
      if (this._happn.circuitBreaker.isOpen()) {
        return reject(new Error(`circuit breaker is open`))
      } else {
        return resolve()
      }
    }))
  }
github hfreire / watch-rtp-play / src / rtp-play-request.js View on Github external
constructor (options = {}) {
    super(_.defaultsDeep({}, options, defaultOptions))

    Health.addCheck('rtp-play', async () => {
      if (this.circuitBreaker.isOpen()) {
        throw new Error(`circuit breaker is open`)
      }
    })
  }
}
github hfreire / get-me-a-date / src / channels / channel.js View on Github external
const _ = require('lodash')
const Promise = require('bluebird')

const Logger = require('modern-logger')

const Health = require('health-checkup')

const FacebookLogin = require('facebook-login-for-robots')
const facebookLogin = new FacebookLogin({
  facebook: {
    email: FACEBOOK_USER_EMAIL,
    password: FACEBOOK_USER_PASSWORD
  }
})

Health.addCheck('facebook', () => Promise.try(() => {
  if (facebookLogin.circuitBreaker.isOpen()) {
    throw new Error(`circuit breaker is open`)
  }
}))

const { OutOfLikesError } = require('./errors')

const Database = require('../database')

const createChannelIfNeeded = function () {
  return Database.channels.find({ where: { name: this._name } })
    .then((channel) => {
      if (!channel) {
        return Database.channels.create(_.assign({ name: this._name }, this._options.channel))
      }
    })
github hfreire / get-me-a-date / src / channels / tinder.js View on Github external
constructor (options = {}) {
    super('tinder')

    this._options = _.defaults(options, defaultOptions)

    this._tinder = new TinderWrapper()

    Health.addCheck(this.name, () => new Promise((resolve, reject) => {
      if (this._tinder.circuitBreaker.isOpen()) {
        return reject(new Error(`circuit breaker is open`))
      } else {
        return resolve()
      }
    }))
  }
github hfreire / browser-as-a-service / src / routes / healthcheck.js View on Github external
handler (request, reply) {
    return Health.checkup()
      .then((status) => {
        const statusCode = _.find(status, (check) => !check.is_healthy) ? 503 : 200

        return reply(null, { status }).code(statusCode)
      })
  }

health-checkup

A health check facility to check the status of your modules

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis

Popular health-checkup functions

Similar packages