Skip to content

Commit ad1fee8

Browse files
committed
add release notes
1 parent bcac8ed commit ad1fee8

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Changelog
2+
3+
Notable changes to this project will be documented in this file.
4+
5+
The latest version of this document is always available in [releases][releases-url].
6+
7+
## [Unreleased]
8+
9+
## [2.0.0] - 2018-11-22
10+
11+
- prom-client global state removed
12+
- .metrics() method added
13+
- .contentType() method added
14+
- lint fixing
15+
16+
[unreleased]: https://github.schibsted.io/finn/express-backstage-pages/compare/v2.0.0...HEAD
17+
[2.0.0]: https://github.schibsted.io/finn/express-backstage-pages/compare/v1.0.0...v2.0.0
18+
[releases-url]: https://github.schibsted.io/finn/express-backstage-pages/blob/master/CHANGELOG.md

lib/release-notes/2.0.0.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# v2.0.0 Release notes
2+
3+
## Description
4+
5+
This release is centered around removing global state.
6+
7+
## tl;dr
8+
9+
Changes in this release:
10+
11+
- prom-client global state removed
12+
- .metrics() method added
13+
- .contentType() method added
14+
- lint fixing
15+
16+
Usage of this module changes from:
17+
18+
```js
19+
const promClient = require('prom-client');
20+
const metricsConsumer = new PrometheusConsumer({ client: promClient });
21+
22+
client.pipe(metricsConsumer);
23+
24+
app.get('/metrics', (req, res) => {
25+
res.set('Content-Type', promClient.register.contentType).send(
26+
promClient.register.metrics(),
27+
);
28+
});
29+
```
30+
31+
to:
32+
33+
```js
34+
const promClient = require('prom-client');
35+
const metricsConsumer = new PrometheusConsumer({ client: promClient });
36+
37+
client.pipe(metricsConsumer);
38+
39+
app.get('/metrics', (req, res) => {
40+
res.set('Content-Type', metricsConsumer.contentType()).send(
41+
metricsConsumer.metrics(),
42+
);
43+
});
44+
```
45+
46+
## Changes
47+
48+
This release has the following changes
49+
50+
### global state removal
51+
52+
In previous versions, this module used prom-client's global registry to hold all collected metrics. This had the potential to collide with other usages of prom-client.
53+
In this version, a new isolated registry is created for each consumer instance.
54+
55+
### .metrics() and .contentType() methods added
56+
57+
In order to support using an isolated registry it was necessary to add a method to extract and render gathered metrics for scraping.
58+
Instead of rendering metrics out of the global registry you can call `.metrics()`. In order to set the correct content type for the content you can use `.contentType()`
59+
60+
_Example_
61+
62+
```js
63+
app.get('/metrics', (req, res) => {
64+
res.set('Content-Type', consumer.contentType()).send(consumer.metrics());
65+
});
66+
```
67+
68+
### lint cleanup
69+
70+
Several files were linted to AirBnB standard

0 commit comments

Comments
 (0)