Skip to content

Commit

Permalink
chore: merge pull request #12 from AEGEE/add-requests-metrics-path
Browse files Browse the repository at this point in the history
Add requests metrics path
  • Loading branch information
serge1peshcoff authored Sep 25, 2019
2 parents 1759031 + 4202d58 commit 79b6aac
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## [0.9.1](https://github.com/AEGEE/oms-discounts/compare/0.9.0...0.9.1) (2019-09-25)


### Bug Fixes

* **deps:** fix npm audit vulnerabilities report ([d1607e3](https://github.com/AEGEE/oms-discounts/commit/d1607e3))
* **metrics:** added request metrics path ([536f52e](https://github.com/AEGEE/oms-discounts/commit/536f52e))
* **test:** fix flapping tests ([582171e](https://github.com/AEGEE/oms-discounts/commit/582171e))



# [0.9.0](https://github.com/AEGEE/oms-discounts/compare/0.8.1...0.9.0) (2019-09-22)


Expand Down
5 changes: 3 additions & 2 deletions lib/endpoints_metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ const endpointsRegistry = new Registry();
const responseCounter = new Counter({
name: 'discounts_requests_total',
help: 'Amount of total HTTP requests',
labelNames: ['status', 'endpoint', 'method'],
labelNames: ['status', 'endpoint', 'method', 'path'],
registers: [endpointsRegistry]
});

exports.addEndpointMetrics = async (req, res, next) => {
const callbackOnFinished = () => {
const labelsObject = {
endpoint: req.baseUrl + req.path,
status: res.statusCode,
endpoint: req.originalUrl,
path: req.originalUrl,
method: req.method
};

Expand Down
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oms-discounts",
"version": "0.9.0",
"version": "0.9.1",
"description": "Discounts module for OMS, for populating codes and for distributing them to AEGEE members.",
"main": "lib/run.js",
"scripts": {
Expand Down

0 comments on commit 79b6aac

Please sign in to comment.