mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 13:27:31 -08:00
refactor(core): Expand Prometheus coverage to all routes (#10113)
This commit is contained in:
parent
9ab29f2181
commit
d35ee109ea
|
@ -106,7 +106,16 @@ describe('PrometheusMetricsService', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(app.use).toHaveBeenCalledWith(
|
expect(app.use).toHaveBeenCalledWith(
|
||||||
['/rest/', '/webhook/', '/webhook-waiting/', '/form-waiting/', '/webhook-test/', '/api/'],
|
[
|
||||||
|
'/rest/',
|
||||||
|
'/api/',
|
||||||
|
'/webhook/',
|
||||||
|
'/webhook-waiting/',
|
||||||
|
'/webhook-test/',
|
||||||
|
'/form/',
|
||||||
|
'/form-waiting/',
|
||||||
|
'/form-test/',
|
||||||
|
],
|
||||||
expect.any(Function),
|
expect.any(Function),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -47,7 +47,7 @@ export class PrometheusMetricsService {
|
||||||
this.initN8nVersionMetric();
|
this.initN8nVersionMetric();
|
||||||
this.initCacheMetrics();
|
this.initCacheMetrics();
|
||||||
this.initEventBusMetrics();
|
this.initEventBusMetrics();
|
||||||
this.initApiMetrics(app);
|
this.initRouteMetrics(app);
|
||||||
this.mountMetricsEndpoint(app);
|
this.mountMetricsEndpoint(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,9 +95,9 @@ export class PrometheusMetricsService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up metrics for API endpoints with `express-prom-bundle`
|
* Set up metrics for server routes with `express-prom-bundle`
|
||||||
*/
|
*/
|
||||||
private initApiMetrics(app: express.Application) {
|
private initRouteMetrics(app: express.Application) {
|
||||||
if (!this.includes.metrics.api) return;
|
if (!this.includes.metrics.api) return;
|
||||||
|
|
||||||
const metricsMiddleware = promBundle({
|
const metricsMiddleware = promBundle({
|
||||||
|
@ -109,7 +109,16 @@ export class PrometheusMetricsService {
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
['/rest/', '/webhook/', '/webhook-waiting/', '/form-waiting/', '/webhook-test/', '/api/'],
|
[
|
||||||
|
'/rest/',
|
||||||
|
'/api/',
|
||||||
|
'/webhook/',
|
||||||
|
'/webhook-waiting/',
|
||||||
|
'/webhook-test/',
|
||||||
|
'/form/',
|
||||||
|
'/form-waiting/',
|
||||||
|
'/form-test/',
|
||||||
|
],
|
||||||
metricsMiddleware,
|
metricsMiddleware,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue