Skip to content

Commit

Permalink
Update README.md - fix wrong variable name (#636)
Browse files Browse the repository at this point in the history
new client.Counter should initiate counter variable and not gauge
  • Loading branch information
korengal authored Jun 24, 2024
1 parent 9dec7bb commit cba73a0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,19 +356,19 @@ 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
labelNames: ['method'] as const,
});

// 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)
Expand Down

0 comments on commit cba73a0

Please sign in to comment.