Skip to content

Commit a335b8a

Browse files
committed
Fix some errors in the docs
We don't have the meta object at this API level
1 parent a848a80 commit a335b8a

File tree

1 file changed

+40
-38
lines changed

1 file changed

+40
-38
lines changed

README.md

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class Consumer extends Writable {
190190
let url;
191191
let method;
192192

193-
metric.labels.forEach(obj => {
193+
metric.labels.forEach((obj) => {
194194
if (obj.name === 'url') {
195195
url = obj.value;
196196
}
@@ -315,12 +315,12 @@ Creates an instance of a `Histogram` class which can be used to populate the met
315315

316316
**options**
317317

318-
| name | description | type | default | required |
319-
| ------------- | --------------------------------------------- | -------- | ------- | -------- |
320-
| `name` | Metric name. valid characters: a-z,A-Z,0-9,\_ | `string` | null | `true` |
321-
| `description` | Metric description | `string` | null | `true` |
322-
| `meta` | Available to be used to hold any misc data. | `object` | null | `false` |
323-
| `labels` | Available to be used to hold label data. | `object` | null | `false` |
318+
| name | description | type | default | required |
319+
| ------------- | --------------------------------------------- | ---------- | ------- | -------- |
320+
| `name` | Metric name. valid characters: a-z,A-Z,0-9,\_ | `string` | null | `true` |
321+
| `description` | Metric description | `string` | null | `true` |
322+
| `buckets` | Set custom buckets | `number[]` | null | `false` |
323+
| `labels` | Available to be used to hold label data. | `object` | null | `false` |
324324

325325
_Example_
326326

@@ -333,10 +333,10 @@ const histogram = client.histogram(options);
333333

334334
Method that when called will populate the metrics stream with a histogram value.
335335

336-
| name | description | type | default | required |
337-
| --------- | -------------------------------------------------- | --------- | ------- | -------- |
338-
| `value` | Value to set the gauge to | `integer` | null | `true` |
339-
| `options` | Object that can be used to specify labels and meta | `object` | `{}` | `false` |
336+
| name | description | type | default | required |
337+
| --------- | ----------------------------------------------------- | --------- | ------- | -------- |
338+
| `value` | Value to set the gauge to | `integer` | null | `true` |
339+
| `options` | Object that can be used to specify labels and buckets | `object` | `{}` | `false` |
340340

341341
_Example_
342342

@@ -345,18 +345,19 @@ const histogram = client.histogram(options);
345345

346346
histogram.observe(0.001); // observe value 0.001
347347
histogram.observe(5, { labels: { url: 'http://finn.no' } }); // observe value 5, specify labels
348-
histogram.observe(0.01, {
349-
meta: { buckets: [0.0001, 0.001, 0.01, 0.1, 0.5, 1, 10, 100] }, // observe 0.01, use meta to specify bucket options
350-
});
348+
histogram.observe(
349+
0.01,
350+
{ buckets: [0.0001, 0.001, 0.01, 0.1, 0.5, 1, 10, 100] }, // observe 0.01, set buckets
351+
);
351352
```
352353

353354
##### histogram.timer(options)
354355

355356
Method that when called will return an end function for use in measuring the time between 2 points
356357

357-
| name | description | type | default | required |
358-
| --------- | -------------------------------------------------- | -------- | ------- | -------- |
359-
| `options` | Object that can be used to specify labels and meta | `object` | `{}` | `false` |
358+
| name | description | type | default | required |
359+
| --------- | ----------------------------------------------------- | -------- | ------- | -------- |
360+
| `options` | Object that can be used to specify labels and buckets | `object` | `{}` | `false` |
360361

361362
_Examples_
362363

@@ -381,7 +382,9 @@ end({ labels: { url: 'http://finn.no' } }); // set labels in end function
381382
```
382383

383384
```js
384-
const end = histogram.timer(meta: { buckets: [0.0001, 0.001, 0.01, 0.1, 0.5, 1, 10, 100] }); // start timer, set meta
385+
const end = histogram.timer({
386+
buckets: [0.0001, 0.001, 0.01, 0.1, 0.5, 1, 10, 100],
387+
}); // start timer, set buckets
385388
// stuff happens
386389
end();
387390
```
@@ -392,12 +395,12 @@ Creates an instance of a `Summary` class which can be used to populate the metri
392395

393396
**options**
394397

395-
| name | description | type | default | required |
396-
| ------------- | --------------------------------------------- | -------- | ------- | -------- |
397-
| `name` | Metric name. valid characters: a-z,A-Z,0-9,\_ | `string` | null | `true` |
398-
| `description` | Metric description | `string` | null | `true` |
399-
| `meta` | Available to be used to hold any misc data. | `object` | null | `false` |
400-
| `labels` | Available to be used to hold label data. | `object` | null | `false` |
398+
| name | description | type | default | required |
399+
| ------------- | --------------------------------------------- | ---------- | ------- | -------- |
400+
| `name` | Metric name. valid characters: a-z,A-Z,0-9,\_ | `string` | null | `true` |
401+
| `description` | Metric description | `string` | null | `true` |
402+
| `quantiles` | Set custom quantiles | `number[]` | null | `false` |
403+
| `labels` | Available to be used to hold label data. | `object` | null | `false` |
401404

402405
_Example_
403406

@@ -410,10 +413,10 @@ const summary = client.summary(options);
410413

411414
Method that when called will populate the metrics stream with a summary value.
412415

413-
| name | description | type | default | required |
414-
| --------- | -------------------------------------------------- | --------- | ------- | -------- |
415-
| `value` | Value to set the summary to | `integer` | null | `true` |
416-
| `options` | Object that can be used to specify labels and meta | `object` | `{}` | `false` |
416+
| name | description | type | default | required |
417+
| --------- | ------------------------------------------------------- | --------- | ------- | -------- |
418+
| `value` | Value to set the summary to | `integer` | null | `true` |
419+
| `options` | Object that can be used to specify labels and quantiles | `object` | `{}` | `false` |
417420

418421
_Example_
419422

@@ -422,18 +425,19 @@ const summary = client.summary(options);
422425

423426
summary.observe(0.001); // observe value 0.001
424427
summary.observe(5, { labels: { url: 'http://finn.no' } }); // observe value 5, specify labels
425-
summary.observe(0.01, {
426-
meta: { quantiles: [0.001, 0.01, 0.5, 0.9, 0.99] }, // observe 0.01, use meta to specify quantile meta
427-
});
428+
summary.observe(
429+
0.01,
430+
{ quantiles: [0.001, 0.01, 0.5, 0.9, 0.99] }, // observe 0.01, use meta to specify quantile meta
431+
);
428432
```
429433

430434
##### summary.timer(options)
431435

432436
Method that when called will return an end function for use in measuring the time between 2 points
433437

434-
| name | description | type | default | required |
435-
| --------- | -------------------------------------------------- | -------- | ------- | -------- |
436-
| `options` | Object that can be used to specify labels and meta | `object` | `{}` | `false` |
438+
| name | description | type | default | required |
439+
| --------- | ------------------------------------------------------- | -------- | ------- | -------- |
440+
| `options` | Object that can be used to specify labels and quantiles | `object` | `{}` | `false` |
437441

438442
_Examples_
439443

@@ -458,9 +462,7 @@ end({ labels: { url: 'http://finn.no' } }); // set labels in end function
458462
```
459463

460464
```js
461-
const end = summary.timer({
462-
meta: { quantiles: [0.001, 0.01, 0.5, 0.9, 0.99] },
463-
}); // start timer, set meta
465+
const end = summary.timer({ quantiles: [0.001, 0.01, 0.5, 0.9, 0.99] }); // start timer, set meta
464466
// stuff happens
465467
end();
466468
```
@@ -576,7 +578,7 @@ _Example_
576578

577579
```js
578580
const client = new Metrics();
579-
client.on('drop', metric => {
581+
client.on('drop', (metric) => {
580582
console.log('dropped metric', metric);
581583
});
582584
```

0 commit comments

Comments
 (0)