class StatsdTaggable::BasicMetrics
Public Class Methods
new(c)
click to toggle source
# File lib/statsd-opentsdb-client/statsd_taggable.rb, line 71 def initialize(c) @client = c end
Public Instance Methods
emit(tags = {})
click to toggle source
# File lib/statsd-opentsdb-client/statsd_taggable.rb, line 75 def emit(tags = {}) # TODO: ensure shelling out doesn't happen too often, e.g., # preserve a timestamp of the last shell-out, and refuse to shell-out # again unless the timestamp is old enough (e.g. 10 seconds) rss, pcpu = `ps -o rss=,pcpu= -p #{Process.pid}`.split rss = rss.to_i pcpu = pcpu.to_f @client.gauge_with_tags "statsd.apps.rss", rss, tags @client.gauge_with_tags "statsd.apps.pcpu", pcpu, tags end