Created
May 4, 2017 20:39
-
-
Save mago0/8628736dbe1d3b4218eaeb351b702a2c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gor = require("goreplay_middleware"); | |
var statsd = require('dogstatsd-node').StatsD, | |
client = new statsd(); | |
gor.init(); | |
gor.on("request", function(req) { | |
// Don't process healthchecks | |
if (gor.httpPath(req.http) != '/ping') { | |
let http_host = req.http.toString().match(/^host: (.*)/m)[1].trim(); | |
let http_method = req.http.toString().match(/^(\w+)/m)[0].trim(); | |
let http_path = gor.httpPath(req.http).replace(/\?.*/, '').trim(); | |
let include_verticals = [ | |
'www.flowrestling.org', | |
'www.flocheer.com', | |
'www.flograppling.com', | |
'www.flocombat.com', | |
'www.flotrack.org' | |
]; | |
if (include_verticals.includes(http_host)) { | |
client.increment('goreplay_core.capture', 1).tags([`'http-host:${http_host}'`,`'http-method:${http_method}'`,`'http-route:${http_path}'`]).send(); | |
} | |
} | |
// Return nothing - drops all requests from middleware output | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment