Skip to content

Commit cba73a0

Browse files
authored
Update README.md - fix wrong variable name (#636)
new client.Counter should initiate counter variable and not gauge
1 parent 9dec7bb commit cba73a0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -356,19 +356,19 @@ Typescript can also enforce label names using `as const`
356356
```typescript
357357
import * as client from 'prom-client';
358358

359-
const gauge = new client.Counter({
359+
const counter = new client.Counter({
360360
name: 'metric_name',
361361
help: 'metric_help',
362362
// add `as const` here to enforce label names
363363
labelNames: ['method'] as const,
364364
});
365365

366366
// Ok
367-
gauge.inc({ method: 1 });
367+
counter.inc({ method: 1 });
368368

369369
// this is an error since `'methods'` is not a valid `labelName`
370370
// @ts-expect-error
371-
gauge.inc({ methods: 1 });
371+
counter.inc({ methods: 1 });
372372
```
373373

374374
#### Default Labels (segmented by registry)

0 commit comments

Comments
 (0)