-
-
Save camshaft/4728018 to your computer and use it in GitHub Desktop.
Node/Riemann Example
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
RIEMANN_HOST=localhost | |
RIEMANN_PORT=5555 |
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
/** | |
* Module dependencies | |
*/ | |
var express = require("express") | |
, responseTime = require("riemann-response-time") | |
, errorHandler = require("riemann-error-handler"); | |
/** | |
* Expose app | |
*/ | |
var app = module.exports = express(); | |
app.configure(function() { | |
app.set("host", "test.localhost"); | |
app.use(responseTime({ | |
host: app.get("host"), | |
service: "riemann-node-response-time-tests", | |
description: "This is a test", | |
tags: ["tests"] | |
})); | |
app.use(app.router); | |
app.use(errorHandler({ | |
host: app.get("host"), | |
service: "riemann-node-error-handler-tests", | |
tags: ["tests"] | |
})); | |
app.use(express.errorHandler()); | |
}); | |
app.get("/", function(req, res, next) { | |
setTimeout(function() { | |
res.send("Hello!"); | |
}, Math.floor(Math.random()*process.env.VARIANCE || 5)) | |
}); | |
app.get("/error", function(req, res, next) { | |
console.log("Error"); | |
next(new Error("Error from "+req.ip)); | |
}); |
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
{ | |
"name": "test-app", | |
"version": "0.0.0", | |
"description": "Riemann test app", | |
"main": "app.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"repository": "", | |
"author": "Cameron Bytheway <[email protected]>", | |
"license": "MIT", | |
"dependencies": { | |
"riemann-response-time": "0.1.0", | |
"riemann-error-handler": "0.1.0", | |
"express": "~3.1.0", | |
"riemann": "~0.4.0", | |
"startup": "~0.1.6" | |
}, | |
"engines": { | |
"node" : "0.8.x", | |
"npm" : "1.1.x" | |
} | |
} |
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
web: ./node_modules/.bin/startup start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment