mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	Upgrade prom-client and yargs
This commit is contained in:
		
							parent
							
								
									1d060591c4
								
							
						
					
					
						commit
						e1cc0b2e99
					
				@ -9,14 +9,14 @@ exports.startMonitoring = (enable, eventBus) => {
 | 
			
		||||
 | 
			
		||||
    const client = require('prom-client');
 | 
			
		||||
 | 
			
		||||
    const requestDuration = new client.Summary(
 | 
			
		||||
        'http_request_duration_milliseconds',
 | 
			
		||||
        'App response time',
 | 
			
		||||
        ['path', 'method', 'status'],
 | 
			
		||||
        {
 | 
			
		||||
    client.collectDefaultMetrics();
 | 
			
		||||
 | 
			
		||||
    const requestDuration = new client.Summary({
 | 
			
		||||
        name: 'http_request_duration_milliseconds',
 | 
			
		||||
        help: 'App response time',
 | 
			
		||||
        labelNames: ['path', 'method', 'status'],
 | 
			
		||||
        percentiles: [0.1, 0.5, 0.9, 0.99],
 | 
			
		||||
        }
 | 
			
		||||
    );
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    eventBus.on(events.REQUEST_TIME, ({ path, method, time, statusCode }) => {
 | 
			
		||||
        requestDuration.labels(path, method, statusCode).observe(time);
 | 
			
		||||
 | 
			
		||||
@ -5,7 +5,7 @@ const { EventEmitter } = require('events');
 | 
			
		||||
const eventBus = new EventEmitter();
 | 
			
		||||
const { REQUEST_TIME } = require('./events');
 | 
			
		||||
const { startMonitoring } = require('./metrics');
 | 
			
		||||
const prometheusRegister = require('prom-client/lib/register');
 | 
			
		||||
const { register: prometheusRegister } = require('prom-client');
 | 
			
		||||
 | 
			
		||||
test('should collect metrics for requests', t => {
 | 
			
		||||
    startMonitoring(true, eventBus);
 | 
			
		||||
 | 
			
		||||
@ -1,14 +1,14 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
const { Router } = require('express');
 | 
			
		||||
const prometheusRegister = require('prom-client/lib/register');
 | 
			
		||||
const { register: prometheusRegister } = require('prom-client');
 | 
			
		||||
 | 
			
		||||
exports.router = config => {
 | 
			
		||||
    const router = Router();
 | 
			
		||||
 | 
			
		||||
    if (config.serverMetrics) {
 | 
			
		||||
        router.get('/prometheus', (req, res) => {
 | 
			
		||||
            res.writeHead(200, { 'Content-Type': 'text/plain' });
 | 
			
		||||
            res.set('Content-Type', prometheusRegister.contentType);
 | 
			
		||||
            res.end(prometheusRegister.metrics());
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -73,12 +73,12 @@
 | 
			
		||||
    "moment": "^2.15.2",
 | 
			
		||||
    "parse-database-url": "^0.3.0",
 | 
			
		||||
    "pg": "^6.1.0",
 | 
			
		||||
    "prom-client": "^7.1.0",
 | 
			
		||||
    "prom-client": "^9.1.1",
 | 
			
		||||
    "response-time": "^2.3.2",
 | 
			
		||||
    "serve-favicon": "^2.3.0",
 | 
			
		||||
    "unleash-frontend": "^3.0.0-alpha.1",
 | 
			
		||||
    "yallist": "^2.0.0",
 | 
			
		||||
    "yargs": "^6.5.0"
 | 
			
		||||
    "yargs": "^8.0.2"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@types/node": "^8.0.4",
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										42
									
								
								yarn.lock
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								yarn.lock
									
									
									
									
									
								
							@ -3442,12 +3442,6 @@ os-homedir@^1.0.0, os-homedir@^1.0.1:
 | 
			
		||||
  version "1.0.2"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3"
 | 
			
		||||
 | 
			
		||||
os-locale@^1.4.0:
 | 
			
		||||
  version "1.4.0"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9"
 | 
			
		||||
  dependencies:
 | 
			
		||||
    lcid "^1.0.0"
 | 
			
		||||
 | 
			
		||||
os-locale@^2.0.0:
 | 
			
		||||
  version "2.0.0"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.0.0.tgz#15918ded510522b81ee7ae5a309d54f639fc39a4"
 | 
			
		||||
@ -3800,9 +3794,9 @@ progress@^2.0.0:
 | 
			
		||||
  version "2.0.0"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f"
 | 
			
		||||
 | 
			
		||||
prom-client@^7.1.0:
 | 
			
		||||
  version "7.2.0"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/prom-client/-/prom-client-7.2.0.tgz#0d65ae8a0f7a10d4afbedba4856a6e55e22a447c"
 | 
			
		||||
prom-client@^9.1.1:
 | 
			
		||||
  version "9.1.1"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/prom-client/-/prom-client-9.1.1.tgz#9588f1681a0869616c7de916ad33ae8f1e03fc10"
 | 
			
		||||
  dependencies:
 | 
			
		||||
    tdigest "^0.1.1"
 | 
			
		||||
    util-extend "^1.0.1"
 | 
			
		||||
@ -5046,10 +5040,6 @@ when@~2.0.1:
 | 
			
		||||
  version "2.0.1"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/when/-/when-2.0.1.tgz#8d872fe15e68424c91b4b724e848e0807dab6642"
 | 
			
		||||
 | 
			
		||||
which-module@^1.0.0:
 | 
			
		||||
  version "1.0.0"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f"
 | 
			
		||||
 | 
			
		||||
which-module@^2.0.0:
 | 
			
		||||
  version "2.0.0"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
 | 
			
		||||
@ -5167,12 +5157,6 @@ yallist@^2.0.0, yallist@^2.1.2:
 | 
			
		||||
  version "2.1.2"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
 | 
			
		||||
 | 
			
		||||
yargs-parser@^4.2.0:
 | 
			
		||||
  version "4.2.1"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.2.1.tgz#29cceac0dc4f03c6c87b4a9f217dd18c9f74871c"
 | 
			
		||||
  dependencies:
 | 
			
		||||
    camelcase "^3.0.0"
 | 
			
		||||
 | 
			
		||||
yargs-parser@^5.0.0:
 | 
			
		||||
  version "5.0.0"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0.tgz#275ecf0d7ffe05c77e64e7c86e4cd94bf0e1228a"
 | 
			
		||||
@ -5185,25 +5169,7 @@ yargs-parser@^7.0.0:
 | 
			
		||||
  dependencies:
 | 
			
		||||
    camelcase "^4.1.0"
 | 
			
		||||
 | 
			
		||||
yargs@^6.5.0:
 | 
			
		||||
  version "6.6.0"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.6.0.tgz#782ec21ef403345f830a808ca3d513af56065208"
 | 
			
		||||
  dependencies:
 | 
			
		||||
    camelcase "^3.0.0"
 | 
			
		||||
    cliui "^3.2.0"
 | 
			
		||||
    decamelize "^1.1.1"
 | 
			
		||||
    get-caller-file "^1.0.1"
 | 
			
		||||
    os-locale "^1.4.0"
 | 
			
		||||
    read-pkg-up "^1.0.1"
 | 
			
		||||
    require-directory "^2.1.1"
 | 
			
		||||
    require-main-filename "^1.0.1"
 | 
			
		||||
    set-blocking "^2.0.0"
 | 
			
		||||
    string-width "^1.0.2"
 | 
			
		||||
    which-module "^1.0.0"
 | 
			
		||||
    y18n "^3.2.1"
 | 
			
		||||
    yargs-parser "^4.2.0"
 | 
			
		||||
 | 
			
		||||
yargs@^8.0.1:
 | 
			
		||||
yargs@^8.0.1, yargs@^8.0.2:
 | 
			
		||||
  version "8.0.2"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.2.tgz#6299a9055b1cefc969ff7e79c1d918dceb22c360"
 | 
			
		||||
  dependencies:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user