mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +01:00
fix: upgrade prom-client from 12.0.0 to 13.1.0
This commit is contained in:
parent
31f674d9fc
commit
ea6183f79c
@ -34,7 +34,7 @@ test.after(() => {
|
|||||||
monitor.stopMonitoring();
|
monitor.stopMonitoring();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should collect metrics for requests', t => {
|
test('should collect metrics for requests', async t => {
|
||||||
eventBus.emit(REQUEST_TIME, {
|
eventBus.emit(REQUEST_TIME, {
|
||||||
path: 'somePath',
|
path: 'somePath',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@ -42,23 +42,23 @@ test('should collect metrics for requests', t => {
|
|||||||
time: 1337,
|
time: 1337,
|
||||||
});
|
});
|
||||||
|
|
||||||
const metrics = prometheusRegister.metrics();
|
const metrics = await prometheusRegister.metrics();
|
||||||
t.regex(
|
t.regex(
|
||||||
metrics,
|
metrics,
|
||||||
/http_request_duration_milliseconds{quantile="0\.99",path="somePath",method="GET",status="200"} 1337/,
|
/http_request_duration_milliseconds{quantile="0\.99",path="somePath",method="GET",status="200"} 1337/,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should collect metrics for updated toggles', t => {
|
test('should collect metrics for updated toggles', async t => {
|
||||||
eventStore.emit(FEATURE_UPDATED, {
|
eventStore.emit(FEATURE_UPDATED, {
|
||||||
data: { name: 'TestToggle' },
|
data: { name: 'TestToggle' },
|
||||||
});
|
});
|
||||||
|
|
||||||
const metrics = prometheusRegister.metrics();
|
const metrics = await prometheusRegister.metrics();
|
||||||
t.regex(metrics, /feature_toggle_update_total{toggle="TestToggle"} 1/);
|
t.regex(metrics, /feature_toggle_update_total{toggle="TestToggle"} 1/);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should collect metrics for client metric reports', t => {
|
test('should collect metrics for client metric reports', async t => {
|
||||||
clientMetricsStore.emit('metrics', {
|
clientMetricsStore.emit('metrics', {
|
||||||
bucket: {
|
bucket: {
|
||||||
toggles: {
|
toggles: {
|
||||||
@ -70,28 +70,28 @@ test('should collect metrics for client metric reports', t => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const metrics = prometheusRegister.metrics();
|
const metrics = await prometheusRegister.metrics();
|
||||||
t.regex(
|
t.regex(
|
||||||
metrics,
|
metrics,
|
||||||
/feature_toggle_usage_total{toggle="TestToggle",active="true",appName="undefined"} 10\nfeature_toggle_usage_total{toggle="TestToggle",active="false",appName="undefined"} 5/,
|
/feature_toggle_usage_total{toggle="TestToggle",active="true",appName="undefined"} 10\nfeature_toggle_usage_total{toggle="TestToggle",active="false",appName="undefined"} 5/,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should collect metrics for db query timings', t => {
|
test('should collect metrics for db query timings', async t => {
|
||||||
eventBus.emit(DB_TIME, {
|
eventBus.emit(DB_TIME, {
|
||||||
store: 'foo',
|
store: 'foo',
|
||||||
action: 'bar',
|
action: 'bar',
|
||||||
time: 0.1337,
|
time: 0.1337,
|
||||||
});
|
});
|
||||||
|
|
||||||
const metrics = prometheusRegister.metrics();
|
const metrics = await prometheusRegister.metrics();
|
||||||
t.regex(
|
t.regex(
|
||||||
metrics,
|
metrics,
|
||||||
/db_query_duration_seconds{quantile="0\.99",store="foo",action="bar"} 0.1337/,
|
/db_query_duration_seconds{quantile="0\.99",store="foo",action="bar"} 0.1337/,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should collect metrics for feature toggle size', t => {
|
test('should collect metrics for feature toggle size', async t => {
|
||||||
const metrics = prometheusRegister.metrics();
|
const metrics = await prometheusRegister.metrics();
|
||||||
t.regex(metrics, /feature_toggles_total{version="(.*)"} 123/);
|
t.regex(metrics, /feature_toggles_total{version="(.*)"} 123/);
|
||||||
});
|
});
|
||||||
|
@ -7,10 +7,12 @@ class BackstageController extends Controller {
|
|||||||
constructor(config) {
|
constructor(config) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
this.logger = config.getLogger('backstage.js');
|
||||||
|
|
||||||
if (config.serverMetrics) {
|
if (config.serverMetrics) {
|
||||||
this.get('/prometheus', (req, res) => {
|
this.get('/prometheus', async (req, res) => {
|
||||||
res.set('Content-Type', prometheusRegister.contentType);
|
res.set('Content-Type', prometheusRegister.contentType);
|
||||||
res.end(prometheusRegister.metrics());
|
res.end(await prometheusRegister.metrics());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
"parse-database-url": "^0.3.0",
|
"parse-database-url": "^0.3.0",
|
||||||
"pg": "^8.0.3",
|
"pg": "^8.0.3",
|
||||||
"pkginfo": "^0.4.1",
|
"pkginfo": "^0.4.1",
|
||||||
"prom-client": "^12.0.0",
|
"prom-client": "^13.1.0",
|
||||||
"response-time": "^2.3.2",
|
"response-time": "^2.3.2",
|
||||||
"serve-favicon": "^2.5.0",
|
"serve-favicon": "^2.5.0",
|
||||||
"unleash-frontend": "3.11.1",
|
"unleash-frontend": "3.11.1",
|
||||||
|
@ -4830,10 +4830,10 @@ progress@^2.0.0:
|
|||||||
resolved "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz"
|
resolved "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz"
|
||||||
integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==
|
integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==
|
||||||
|
|
||||||
prom-client@^12.0.0:
|
prom-client@^13.1.0:
|
||||||
version "12.0.0"
|
version "13.1.0"
|
||||||
resolved "https://registry.npmjs.org/prom-client/-/prom-client-12.0.0.tgz"
|
resolved "https://registry.yarnpkg.com/prom-client/-/prom-client-13.1.0.tgz#1185caffd8691e28d32e373972e662964e3dba45"
|
||||||
integrity sha512-JbzzHnw0VDwCvoqf8y1WDtq4wSBAbthMB1pcVI/0lzdqHGJI3KBJDXle70XK+c7Iv93Gihqo0a5LlOn+g8+DrQ==
|
integrity sha512-jT9VccZCWrJWXdyEtQddCDszYsiuWj5T0ekrPszi/WEegj3IZy6Mm09iOOVM86A4IKMWq8hZkT2dD9MaSe+sng==
|
||||||
dependencies:
|
dependencies:
|
||||||
tdigest "^0.1.1"
|
tdigest "^0.1.1"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user