From 75e65a75dcb4042fff12b4687da24e9063898ed1 Mon Sep 17 00:00:00 2001 From: Julien Rousseau Date: Wed, 22 Nov 2023 15:11:18 -0500 Subject: [PATCH] narrowed allowed labels --- src/prometheus.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/prometheus.ts b/src/prometheus.ts index da16250..9cf8261 100644 --- a/src/prometheus.ts +++ b/src/prometheus.ts @@ -8,10 +8,10 @@ export async function metrics() { return new Response(await registry.metrics(), { status: 200, headers }); } -export function registerCounter(name: string, help: string, labels?: string[]) { +export function registerCounter(name: string, help: string, labels?: T[]) { try { - registry.registerMetric(new client.Counter({ name, help, labelNames: labels ?? []})); - return registry.getSingleMetric(name) as Counter; + registry.registerMetric(new client.Counter({ name, help, labelNames: labels ?? [] })); + return registry.getSingleMetric(name) as Counter; } catch (error) {} }