mirror of
https://github.com/BreizhHardware/express-prom-bundle.git
synced 2026-03-18 21:30:38 +01:00
Merge pull request #102 from Cellaryllis/normalize-path-example-3
Add another example for normalizePath
This commit is contained in:
11
README.md
11
README.md
@@ -159,6 +159,17 @@ For more details:
|
|||||||
* [normalizePath.js](https://github.com/jochen-schweizer/express-prom-bundle/blob/master/src/normalizePath.js) - source code for path processing
|
* [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):
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
app.use(promBundle(/* options? */));
|
||||||
|
|
||||||
|
promBundle.normalizePath = (req, opts) => {
|
||||||
|
// Return the path of the express route (i.e. /v1/user/:id or /v1/timer/automated/:userid/:timerid")
|
||||||
|
return req.route?.path ?? "NULL";
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
## 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