#GRAPHITE TIMESLICE EXAMPLE CODE#
We need one more bit of code to hook the reporter into our application- you’ll notice my implementation honours Dropwizard’s Managed interface so it can be dropped straight into a DW app as a one-liner: environment.lifecycle().manage(new LogentriesReporter()) It’s a naïve implementation that just prints everything it can find from Hystrix every 5 seconds, but good enough as a first pass. (A fully working mavenized version is here) listener frequency))) (defn -start (.start (.state this))) (defn -stop (.shutdown (.state this))) I’ll do it in Clojure because:īut hopefully if you’re not interested in languages with parentheses you’ll get the general idea anyway: (ns "Hystrix reporter which echoes data to a log at a fixed interval." (:require ) (:import ) (:gen-class :name ".LogentriesReporter" :implements :init gen-poller :main false :state state)) (defn -gen-poller (let (log/info json)))] (HystrixMetricsPoller. This is also a cool way of illustrating how we actually use our own product for production monitoring.įirst some code Netflix bundles a couple of reporters for Hystrix metrics that integrate with graphite and servo but a simple one which just prints the data to a log is easily implemented. It’s a really well executed tool for getting instantaneous info about the state of a production system, but on its own doesn’t let you derive any long-term conclusions from the data.Īs it happens I work for a company that’s pretty good at getting insights out of data like this, so let’s see if we can pipe the Hystrix metrics into Logentries and have some fun with it. Netflix has also open-sourced a funky dashboard to render the metrics in real-time.
![graphite timeslice example graphite timeslice example](https://image.slidesharecdn.com/graphite-materials-130627004710-phpapp01/95/graphite-materials-4-638.jpg)
We’ve been using Hystrix in production here at Logentries for over a year now and have found it useful not only for bulkheading requests, but for getting fine-grained metrics for internal API calls.