Skip to content
This repository was archived by the owner on Oct 21, 2024. It is now read-only.

Commit a885b9a

Browse files
add path option to disable path tag
1 parent 2d52c83 commit a885b9a

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ All options are optional.
1717
* `dogstatsd` node-dogstatsd client. `default = new require("node-dogstatsd").StatsD()`
1818
* `stat` *string* name for the stat. `default = "node.express.router"`
1919
* `tags` *array* of tags to be added to the histogram. `default = []`
20+
* `path` *boolean* include path tag. `default = true`
2021
* `method` *boolean* include http method tag. `default = false`
2122
* `protocol` *boolean* include protocol tag. `default = false`
2223

23-
2424
## License
2525

2626
View the [LICENSE](https://github.com/AppPress/node-connect-datadog/blob/master/LICENSE) file.

lib/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ module.exports = function (options) {
2020
}
2121

2222
var statTags = [
23-
"route:" + req.route.path,
24-
"path:" + req.path
23+
"route:" + req.route.path
2524
].concat(tags);
2625

2726
if (options.method) {
@@ -32,6 +31,10 @@ module.exports = function (options) {
3231
statTags.push("protocol:" + req.protocol);
3332
}
3433

34+
if (options.path !== false) {
35+
statTags.push("path:" + req.path);
36+
}
37+
3538
datadog.histogram(stat, (new Date() - req._startTime), 1, statTags);
3639
};
3740

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "connect-datadog",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "Datadog middleware for Connect JS / Express",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
 (0)