Skip to content

Commit

Permalink
add serialize bytes counter
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Aug 29, 2020
1 parent 76ee254 commit 20e0268
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,16 @@ local metric_layout_create_calls = monitoring.counter(
digtron.execute_move_cycle = metric_move_cycle.wrap(digtron.execute_move_cycle)
digtron.execute_dig_cycle = metric_dig_cycle.wrap( metric_dig_cycle_time.wraptime(digtron.execute_dig_cycle) )
DigtronLayout.create = metric_layout_create_calls.wrap( metric_layout_create_time.wraptime(DigtronLayout.create) )

local metric_serialize_bytes = monitoring.counter(
"digtron_serialize_bytes",
"total serialized bytes from DigtronLayout.serialize"
)


local old_serialize = DigtronLayout.serialize
DigtronLayout.serialize = function(self)
local data = old_serialize(self)
metric_serialize_bytes.inc(#data)
return data
end

0 comments on commit 20e0268

Please sign in to comment.