back: add a /metrics.json endpoint
This commit is contained in:
parent
456c2ffab5
commit
40c05a7905
1 changed files with 5 additions and 0 deletions
|
@ -9,10 +9,15 @@ export class PrometheusController {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.App.get("/metrics", this.metrics.bind(this));
|
this.App.get("/metrics", this.metrics.bind(this));
|
||||||
|
this.App.get("/metrics.json", this.metricsAsJSON.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private metrics(res: HttpResponse, req: HttpRequest): void {
|
private metrics(res: HttpResponse, req: HttpRequest): void {
|
||||||
res.writeHeader("Content-Type", register.contentType);
|
res.writeHeader("Content-Type", register.contentType);
|
||||||
res.end(register.metrics());
|
res.end(register.metrics());
|
||||||
}
|
}
|
||||||
|
private metricsAsJSON(res: HttpResponse, req: HttpRequest): void {
|
||||||
|
res.writeHeader('Content-Type', 'application/json');
|
||||||
|
res.end(JSON.stringify(register.getMetricsAsJSON()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue