Socket
Socket
Sign inDemoInstall

express-prom-bundle

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-prom-bundle - npm Package Compare versions

Comparing version 6.4.1 to 6.5.0

2

package.json
{
"name": "express-prom-bundle",
"version": "6.4.1",
"version": "6.5.0",
"description": "express middleware with popular prometheus metrics in one bundle",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -92,2 +92,3 @@ [![build status](https://travis-ci.org/jochen-schweizer/express-prom-bundle.png)](https://travis-ci.org/jochen-schweizer/express-prom-bundle) [![Coverage Status](https://coveralls.io/repos/github/jochen-schweizer/express-prom-bundle/badge.svg?branch=master)](https://coveralls.io/github/jochen-schweizer/express-prom-bundle?branch=master) [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://www.tldrlegal.com/l/mit) [![NPM version](https://badge.fury.io/js/express-prom-bundle.png)](http://badge.fury.io/js/express-prom-bundle)

* **promRegistry**: Optional `promClient.Registry` instance to attach metrics to. Defaults to global `promClient.register`.
* **metricsApp**: Allows you to attach the metrics endpoint to a different express app. You probably want to use it in combination with `autoregister: false`.

@@ -203,3 +204,4 @@ ### More details on includePath option

const cluster = require('cluster');
const promBundle = require('./src/index');
const promBundle = require('express-prom-bundle');
const promClient = require('prom-client');
const numCPUs = Math.max(2, require('os').cpus().length);

@@ -220,2 +222,3 @@ const express = require('express');

} else {
new promClient.AggregatorRegistry();
const app = express();

@@ -222,0 +225,0 @@ app.use(promBundle({

@@ -71,3 +71,4 @@ const onFinished = require('on-finished');

promClient: {},
promRegistry: promClient.register
promRegistry: promClient.register,
metricsApp: null,
}, opts

@@ -208,2 +209,10 @@ );

if (opts.metricsApp) {
opts.metricsApp.get(opts.metricsPath || '/metrics', (req, res) => {
res.set('Content-Type', opts.promRegistry.contentType);
opts.promRegistry.metrics()
.then(metrics => res.end(metrics));
});
}
middleware.metrics = metrics;

@@ -210,0 +219,0 @@ middleware.promClient = promClient;

// TypeScript Version: 2.8
import { Request, RequestHandler, Response } from 'express';
import { Request, RequestHandler, Response, Express } from 'express';
import { DefaultMetricsCollectorConfiguration, Registry } from 'prom-client';

@@ -52,2 +52,3 @@

urlPathReplacement?: string;
metricsApp?: Express;

@@ -54,0 +55,0 @@ // https://github.com/disjunction/url-value-parser#options

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