Skip to content

Instantly share code, notes, and snippets.

@dannycoates
Last active December 17, 2015 23:08
Show Gist options
  • Save dannycoates/5686779 to your computer and use it in GitHub Desktop.
Save dannycoates/5686779 to your computer and use it in GitHub Desktop.
heka statsd
Timestamp: 2013-05-31 11:02:25.780902984 -0700 PDT
Type: statmetric
Hostname: moz.local
Pid: 5267
UUID: 93100895-b5f8-4283-9687-ab4e2eaefd0d
Logger:
Payload: stats.rss 558678016 1370023345
stats.heapTotal 498229248 1370023345
stats.heapUsed 211741608 1370023345
statsd.numStats 3 1370023345
EnvVersion:
Severity: 0
Fields: []
Captures: map[]
[StatsdInput]
address = ":8125"
[memory_counter]
type = "SandboxFilter"
message_matcher = "Type == 'statmetric'"
ticker_interval = 15
script_type = "lua"
filename = "./heka/memory.lua"
preserve_data = false
memory_limit = 1048576
instruction_limit = 100
output_limit = 64512
[DashboardOutput]
ticker_interval = 15
message_matcher = "Type == 'heka.all-report' || Type == 'heka.sandbox-terminated' || (Type == 'heka.sandbox-output' && Fields[payload_type] == 'cbuf')"
data = circular_buffer.new(240, 3, 15)
local cols = {
rss = data:set_header(1, "RSS", "max"),
heapTotal = data:set_header(2, "HEAP_TOTAL", "max"),
heapUsed = data:set_header(3, "HEAP_USED", "max")
}
function process_message()
local ts = read_message("Timestamp")
local payload = read_message("Payload")
if payload == nil then return 0 end
for k, v in string.gmatch(payload, "stats.(%w+) (%d+)") do
if cols[k] ~= nil then
data:set(ts, cols[k], v)
end
end
return 0
end
function timer_event(ns)
output(data)
inject_message("cbuf", "Process Memory Usage")
end
{"time":1370046735,"rows":240,"columns":3,"seconds_per_row":15,"column_info":[{"name":"RSS","type":"max"},{"name":"HEAP_TOTAL","type":"max"},{"name":"HEAP_USED","type":"max"}]}
0 0 0
0 0 0
34078720 31139328 13155008
34140160 31139328 13267800
34148352 31139328 13316784
34148352 31139328 13352416
34148352 31139328 13388016
34148352 31139328 13423616
34148352 31139328 13459248
34148352 31139328 13494752
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment