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

Commit 0913564

Browse files
add method and protocol options
1 parent 0479655 commit 0913564

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lib/index.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,20 @@ module.exports = function (options) {
1919
return;
2020
}
2121

22-
datadog.histogram(stat, (new Date() - req._startTime), 1, [
22+
var statTags = [
2323
"route:" + req.route.path,
2424
"path:" + req.path
25-
].concat(tags));
25+
].concat(tags);
26+
27+
if (options.method) {
28+
statTags.push("method:" + req.method.toLowerCase());
29+
}
30+
31+
if (options.protocol && req.protocol) {
32+
statTags.push("protocol:" + req.protocol);
33+
}
34+
35+
datadog.histogram(stat, (new Date() - req._startTime), 1, statTags);
2636
};
2737

2838
next();

0 commit comments

Comments
 (0)