estatsd icon indicating copy to clipboard operation
estatsd copied to clipboard

Efficiency Updates / Distribution & Aggregation / Timing calls/funs

Open soup-in-boots opened this issue 12 years ago • 0 comments

New Features:

  • Add support for timer:tc-like functions (uses timer:tc/1,timer:tc/3 to measure function duration then post results)
    • timing_fun, executes anonymous fun with timer:tc/1
    • timing_call, executes {M, F, A} style call with timer:tc/3
  • Add support for a "master node"; useful in distributed environments. Local estatsd instance tracks its requests, then sends its data on to the master node to be written to carbon/graphite

Major Changes:

  • Don't serialize ets updates through a process
    • For counters, use ets:update_counter and ets:insert_new
    • For timers and gauges, use duplicate bags to avoid serializing through the process
  • Double-buffer methodology for tables
    • Create two tables for stats, gauges, and timers, and one table to indicate which table is the active write table for each group
    • When flushing, swap the active table so external processes can immediately begin updating keys againswitch

Minor Changes:

  • Track the "last flush" time so that we can have more accurate averages (by using now_diff to determine the actual time between flushes)
  • Added a bunch of edoc style comments (still in progress)

soup-in-boots avatar Jul 25 '12 20:07 soup-in-boots