Skip to content

Commit c8a2d6c

Browse files
committed
docs: remove createMetric
1 parent 2b287a4 commit c8a2d6c

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

README.md

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
[![GitHub Actions status](https://github.com/metrics-js/prometheus-consumer/workflows/Run%20Lint%20and%20Tests/badge.svg)](https://github.com/metrics-js/test-consumer/actions?query=workflow%3A%22Run+Lint+and+Tests%22)
55
[![Known Vulnerabilities](https://snyk.io/test/github/metrics-js/prometheus-consumer/badge.svg?targetFile=package.json)](https://snyk.io/test/github/metrics-js/test-consumer?targetFile=package.json)
66

7-
8-
97
This module is a memory based consumer for metrics streams to be used in tests. The purpose of the module is to make writing tests and asserting metrics easier.
108
It takes a metric stream generated by @metrics/client and makes the collected metrics available as an array.
119

@@ -22,32 +20,31 @@ const MetricsClient = require("@metrics/client");
2220
const TestConsumer = require("@metrics/test-consumer");
2321

2422
test("some test case", async () => {
25-
// Pass in the metrics client you want to consume.
26-
const metrics = new MetricsClient();
27-
const testHelper = new TestConsumer(metrics);
28-
// Sets up the consumer to capture events.
29-
testHelper.start();
23+
// Pass in the metrics client you want to consume.
24+
const metrics = new MetricsClient();
25+
const testHelper = new TestConsumer(metrics);
26+
// Sets up the consumer to capture events.
27+
testHelper.start();
3028

31-
// 👋 Your code which produces some kind of metric goes here.
29+
// 👋 Your code which produces some kind of metric goes here.
3230

33-
// Ends the streams, now we can get the result.
34-
testHelper.stop();
31+
// Ends the streams, now we can get the result.
32+
testHelper.stop();
3533

36-
const result = await testHelper.getResults();
37-
const metric = result.find((m) => m.name === "some_counter");
34+
const result = await testHelper.getResults();
35+
const metric = result.find((m) => m.name === "some_counter");
3836

39-
assert.ok(metric, "Expected to find metric some_counter");
40-
assert.equal(metric.value, 2);
37+
assert.ok(metric, "Expected to find metric some_counter");
38+
assert.equal(metric.value, 2);
4139
});
4240
```
4341

4442
## API
4543

46-
- [constructor](#constructormetrics)
47-
- [start](#start)
48-
- [stop](#stop)
49-
- [getResults](#async-getresults)
50-
- [createMetrics](#createmetrics)
44+
- [constructor](#constructormetrics)
45+
- [start](#start)
46+
- [stop](#stop)
47+
- [getResults](#async-getresults)
5148

5249
### constructor(metrics)
5350

@@ -64,7 +61,3 @@ Ends the stream setup for the client, returns a Promise which resolves to an arr
6461
### async .getResults()
6562

6663
Returns a promise which resolves to an array containing collected `[@metrics/metrics](https://metrics-js.github.io/reference/metric/)` objects.
67-
68-
### createMetrics
69-
70-
Utility object with functions for creating mock `Metric` objects, has the functions `.timer` and `.counter`.

0 commit comments

Comments
 (0)