From b17ffab8da4c1317d3bc6b2ef838abc1c979e2c5 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Fri, 15 Jan 2021 13:42:44 +0000 Subject: [PATCH] Fix empty values on the /metrics endpoint --- changelog.d/296.bugfix | 1 + src/components/prometheusmetrics.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changelog.d/296.bugfix diff --git a/changelog.d/296.bugfix b/changelog.d/296.bugfix new file mode 100644 index 00000000..6f3b9a65 --- /dev/null +++ b/changelog.d/296.bugfix @@ -0,0 +1 @@ +Fix a bug where /metrics would report empty values. \ No newline at end of file diff --git a/src/components/prometheusmetrics.ts b/src/components/prometheusmetrics.ts index eb28bad9..04f28744 100644 --- a/src/components/prometheusmetrics.ts +++ b/src/components/prometheusmetrics.ts @@ -380,11 +380,11 @@ export class PrometheusMetrics { // TODO: Ideally these metrics would be on a different port. // For now, leave this unauthenticated. checkToken: false, - handler: (_req: Request, res: Response) => { + handler: async (_req: Request, res: Response) => { this.refresh(); try { - const exposition = this.register.metrics(); + const exposition = await this.register.metrics(); res.set("Content-Type", "text/plain"); res.send(exposition);