Skip to content

Instantly share code, notes, and snippets.

@assertnotnull
Last active May 13, 2016 14:19
Show Gist options
  • Save assertnotnull/b3d9d913940255283bf15a91179d91c0 to your computer and use it in GitHub Desktop.
Save assertnotnull/b3d9d913940255283bf15a91179d91c0 to your computer and use it in GitHub Desktop.
Graphite events

Graphite annotations

##Using graphite tags

I suggest use of tags like: appname, environment, host, eventtype

So we can search them

Using graphite sets

var uniqueid = extra.zone + '.' + os.hostname()
statsd.unique('myevent', uniqueid);
var data = {
what: 'Start myapp',
tags: 'myapp, start, ' + os.hostname(),
data: 'start of myapp on ' + os.hostname()
};
var datastring = JSON.stringify(data);
var req = http.request({
hostname: 'graphite',
port: 80,
path: '/events/',
method: 'POST',
headers: {
'Content-Length': datastring.length
}
}, function (res) {
logger.info('event response', res.statusCode, res.statusMessage);
});
req.write(datastring);
req.on('error', function (err) {
logger.error(err);
});
req.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment