NOTE: From here
Etsy’s great post about tracking every release and has some good tips about tracking releases with statsd and graphite (including some essential graphite config tweaks). I was wondering how to do this from within a shell script, and I had to dig through lots of StatsD code and examples to find this snippet. I forget where I eventually found it, and thought it’d make it easier to find.
Deploy scripts are just one place where a concise and safe way to record a metric/event in important. From Etsy’s blog, using vertical lines to represent distinct events (code deployments) to give more context to the login trends:
Sending a metric from the command line, with netcat or curl, is just one bit of ‘glue’ that is essential for pulling together a complete metrics solution. This is essentially the base-case, the lowest-common-denominator that all metrics collection can be built upon.
While short-and-sweet, this snippit contains two measures of protection. First, it limits the run duration to a single second so it don’t have to worry about it hanging, and secondly, it uses UDP, so you don’t need to worry about the remote server being performant or even up. True fire-and-forget, so you can recklessly drop this in scripts left and right.
And the bash one-liner: