Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mrporter/mrp-healthcheck

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mrporter/mrp-healthcheck

health check your applicaiton(mrporter)

  • 0.1.19
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
7
Maintainers
2
Weekly downloads
 
Created
Source

Health Check Circle CI

Simple and highly customisable JSON health check builder.

  npm install @mrporter/mrp-healthcheck --save

Teams using this package:

  • PAC (Product Pages)
  • CAP (Checkout)
  • Team X (Product Listing)
var status = require('@mrporter/mrp-healthcheck');

var results = status({
  "name": "some-app",
  "checks": [
    {
      "name": "mr-porter product page",
      "url" : "http://mrporter.com"
    },
    {
      "name": "Google",
      "url" : "http://google.com"
    }
  ]

}).then( function(data) {
  // {JSON data}
})


Product Page Example:

/**
 * Class - healthMiddleware - executes healthcheck module for a given route
 *
 * @class healthMiddleware
 * @static
 * @example app.use('/health/check', require('@mrporter/mrp-healthcheck');
 */
module.exports = function(req, res) {

	var os = require('os');

	var appUrl = req.protocol + '://' + req.get('host');
	var build = rootRequire('build.json') || {};
	var results = require('@mrporter/mrp-healthcheck')({
		'name': 'Mr Porter Product Page',
		"uptimeSeconds": parseInt(process.uptime(), 10),
		'buildTime': build.buildTime,
		"env": req.app.settings.env, //set consistently by server.init
		"nodeVersion": process.versions.node,
		"buildNumber": build.tag,
		"buildUrl": "http://xyz/jenkins/job/CI-mrp_product-page/" + build.tag,
		"gitCommit": build.commit,
		"gitUrl": "http://xyz/product-page/commits/" + build.commit,
		"host": {
			"hostname": os.hostname(),
			"uptimeSeconds": parseInt(os.uptime(), 10)
		},
		"checks": [
			{
				'name': 'Check Product Page App',
				'url': appUrl
			},
			{
				'name': 'LAD API Product Details',
				'url': "http://xyz:80/categories?business=MRP&country=GB&lang=en"
			}
		]

	});

	results.then(function(healthCheck) {
		res.json(healthCheck);
	});

};

Generic Output Example:

{
	"application": {
	  "name": "My App",
  	"bootTime": "2014-02-28T15:30:00Z",
  	"buildTime": "2014-02-28T15:30:00Z",
  	"uptimeSeconds": 300,
  	"version": "1.0.0",
	  "buildNumber": 55,
	  "buildUrl": "http://jenkins01.vm.wtf.nap:8080/jenkins/job/CI-my-app/55/",
	  "gitCommit": "860760dbba4e131209e458c61979895e5d51a8c4",
    "configuration": {
    	// Application specific configuration
    },
    "metrics": {
    	// Application specific metrics (request/second, etc)
    },
    "checks": [
			{
				"name": "mr-porter product page",
				"result": "FAILED", // SUCCESS, or FAILED
				"dateOfCheck": "2015-04-27T11:34:46.336Z",
			}
		]
	},
	"host": {
	  "currentTime": "2015-04-27T11:34:46.336Z",
	  "bootTime": "2015-04-27T11:34:46.336Z",
    "uptimeSeconds": 300,
	  "hostname": "dev-myApp"
	}
}

Keywords

FAQs

Package last updated on 22 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc