1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-19 01:17:18 +02:00

fix: gh-720 Use express path templates for prometheus metrics (#724)

This commit is contained in:
checketts 2021-02-15 05:04:56 -07:00 committed by GitHub
parent 4e63512ee1
commit f49b5084eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,15 +1,13 @@
'use strict'; 'use strict';
const url = require('url');
const responseTime = require('response-time'); const responseTime = require('response-time');
const { REQUEST_TIME } = require('../events'); const { REQUEST_TIME } = require('../events');
module.exports = function(config) { module.exports = function(config) {
return responseTime((req, res, time) => { return responseTime((req, res, time) => {
const { statusCode } = res; const { statusCode } = res;
const pathname = req.route
? url.parse(req.originalUrl).pathname const pathname = req.route ? req.baseUrl + req.route.path : '(hidden)';
: '(hidden)';
const timingInfo = { const timingInfo = {
path: pathname, path: pathname,