mirror of
https://github.com/BreizhHardware/express-prom-bundle.git
synced 2026-01-18 16:27:28 +01:00
Move details below example 2
This commit is contained in:
12
README.md
12
README.md
@@ -142,22 +142,22 @@ promBundle.normalizePath = (req, opts) => {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For more details:
|
||||||
|
* [url-value-parser](https://www.npmjs.com/package/url-value-parser) - magic behind automatic path normalization
|
||||||
|
* [normalizePath.js](https://github.com/jochen-schweizer/express-prom-bundle/blob/master/src/normalizePath.js) - source code for path processing
|
||||||
|
|
||||||
|
|
||||||
#### Example 3 (return express route definition):
|
#### Example 3 (return express route definition):
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
app.use(promBundle(/* options? */));
|
app.use(promBundle(/* options? */));
|
||||||
|
|
||||||
promBundle.normalizePath = (req, opts) => {
|
promBundle.normalizePath = (req, opts) => {
|
||||||
// Return the path of the express route (i.e. /v1/member/:id or /v1/timer/automated/:userid/:timerid")
|
// Return the path of the express route (i.e. /v1/user/:id or /v1/timer/automated/:userid/:timerid")
|
||||||
return req.route?.path ?? "NULL";
|
return req.route?.path ?? "NULL";
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
For more details:
|
|
||||||
* [url-value-parser](https://www.npmjs.com/package/url-value-parser) - magic behind automatic path normalization
|
|
||||||
* [normalizePath.js](https://github.com/jochen-schweizer/express-prom-bundle/blob/master/src/normalizePath.js) - source code for path processing
|
|
||||||
|
|
||||||
|
|
||||||
## express example
|
## express example
|
||||||
|
|
||||||
setup std. metrics but exclude `up`-metric:
|
setup std. metrics but exclude `up`-metric:
|
||||||
|
|||||||
Reference in New Issue
Block a user