npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@vanioinformatika/appxray

v1.0.0

Published

[![Build Status](https://travis-ci.org/vanioinformatika/node-appxray.svg?branch=master)](https://travis-ci.org/vanioinformatika/node-appxray) [![Coverage Status](https://coveralls.io/repos/github/vanioinformatika/node-appxray/badge.svg)](https://coveralls

Downloads

3

Readme

Build Status Coverage Status NPM Version npm

App Xray

Xray help to monitor service health via health indicators.

The main concept is registering some callback functions which have to return Promise<any>. If the returned Promise resolved than Xray assume that service is up and running correctly, otherwise if the Promise is rejected than service is marked as down from some reason. Booth resolution and rejection result is saved and can accessed via status method.

Installation

npm install @vanioinformatika/appxray --save

API

setInterval

setInterval(interval: number): this

Set pooling interval. Default interval value is 1000 milliseconds.

setDefaultIndicatorTimeout

setDefaultIndicatorTimeout(timeout: number): this

Set default indicator timeout. If timeout is not specified for indicator than default timeout is applied during checking calling indicator. Default value is 1000 milliseconds.

setEventEmitter

setEventEmitter(eventEmitter: EventEmitter): this

Set event emitter to allow firing events. Available events are:

  • xray.started - Fired after first service check executed.
    • Event's callback sigbature is (status: IndicatorStatus) => void.
  • xray.indicator.success - Fire every time when checking service health for each indicator when it's callback returned resolved promise.
    • Event's callback signature is (name: string, response: IndicatorResponse) => void.
  • xray.indicator.error - Fire like xray.indicator.success but only when indicator's callback returned with rejected promise.

has

has(name: string): boolean

Check if xray has named indicator callback or not.

add

add(name: string, indicator: Indicator, options?: IndicatorOptions): this

Add new indicator to xray with given name. During adding indicator it is possible to specify some options:

  • timeout - Override default indicator timeout.

Note: Indicator with same name will be overwritten.

remove

remove(name: string): boolean

Remove named indicator from Xray. Return true if Xray had named indicator and it is successfully removed, otherwise its return false.

start

start(): void

Start pooling indicators with given interval.

Note: It is possible to change timeout and add / remove indicators during pooling.

status

status(): IndicatorStatus
status(name: string): IndicatorResponse
status({detailed}: { detailed: true }): Map<string, IndicatorResponse>

Via this method can access last indicator results.

Note: The status method returns only actual status. Previous status is always overwritten during checking.

status(): IndicatorStatus

If status is called without any argument then it will summarize indicators response and returns simple IndicatorStatus response.

If method is called before pooling is started than it will return UNKNOWN status, otherwise UP or DOWN base on indicators response. If least one indicator is returned with error then status will result with DOWN otherwise UP.

status(name: string): IndicatorResponse

If status is called with single string argument, than it will act like getting information about single indicator. In this case method will return detailed response.

status({detailed}: { detailed: true }): Map<string, IndicatorResponse>

The last overload accepts object with options. If detailed option is set to true than status is returned in Map where keys are indicator names and values are corresponding detailed responses.

check

check(): Promise<Map<string, IndicatorResponse>>

Execute every indicator, update status information base on indicators response. It will return promise with indicators results.