Skip to content

Commit

Permalink
Merge pull request #296 from matrix-org/hs/metrics-is-async
Browse files Browse the repository at this point in the history
Fix empty metrics due to prom-client@13
  • Loading branch information
Half-Shot authored Jan 22, 2021
2 parents 7e0bf8e + b17ffab commit dfaf4a0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/296.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug where /metrics would report empty values.
4 changes: 2 additions & 2 deletions src/components/prometheusmetrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit dfaf4a0

Please sign in to comment.