From cba73a0417a2bc234e73da5493536da9831777ce Mon Sep 17 00:00:00 2001 From: korengal <5110512+korengal@users.noreply.github.com> Date: Mon, 24 Jun 2024 09:33:25 +0300 Subject: [PATCH] Update README.md - fix wrong variable name (#636) new client.Counter should initiate counter variable and not gauge --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1487a50e..348a5bff 100644 --- a/README.md +++ b/README.md @@ -356,7 +356,7 @@ Typescript can also enforce label names using `as const` ```typescript import * as client from 'prom-client'; -const gauge = new client.Counter({ +const counter = new client.Counter({ name: 'metric_name', help: 'metric_help', // add `as const` here to enforce label names @@ -364,11 +364,11 @@ const gauge = new client.Counter({ }); // Ok -gauge.inc({ method: 1 }); +counter.inc({ method: 1 }); // this is an error since `'methods'` is not a valid `labelName` // @ts-expect-error -gauge.inc({ methods: 1 }); +counter.inc({ methods: 1 }); ``` #### Default Labels (segmented by registry)