From ab539776d07bb58a28c2a05d3c1ef7e81dece6db Mon Sep 17 00:00:00 2001 From: Austin McKinley Date: Mon, 29 Sep 2025 17:15:01 -0700 Subject: [PATCH] fix usage --- bskylink/src/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bskylink/src/index.ts b/bskylink/src/index.ts index 65125e9ce0..271011ec7d 100644 --- a/bskylink/src/index.ts +++ b/bskylink/src/index.ts @@ -48,9 +48,14 @@ export class LinkService { // Start metrics server const metricsApp = express() - metricsApp.get('/metrics', (req, res) => { - res.set('Content-Type', this.ctx.metrics.register.contentType) - res.end(this.ctx.metrics.register.metrics()) + metricsApp.get('/metrics', async (_req, res) => { + try { + const metrics = await this.ctx.metrics.getRegistry().metrics() + res.set('Content-Type', this.ctx.metrics.getRegistry().contentType) + res.end(metrics) + } catch (error) { + res.status(500).end('Error collecting metrics') + } }) this.metricsServer = metricsApp.listen(this.ctx.cfg.service.metricsPort)