Class: StatsdTaggable::BasicMetrics
- Inherits:
-
Object
- Object
- StatsdTaggable::BasicMetrics
- Defined in:
- lib/statsd-opentsdb-client/statsd_taggable.rb
Instance Method Summary collapse
- #emit(tags = {}) ⇒ Object
-
#initialize(c) ⇒ BasicMetrics
constructor
A new instance of BasicMetrics.
Constructor Details
#initialize(c) ⇒ BasicMetrics
Returns a new instance of BasicMetrics.
71 72 73 |
# File 'lib/statsd-opentsdb-client/statsd_taggable.rb', line 71 def initialize(c) @client = c end |
Instance Method Details
#emit(tags = {}) ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/statsd-opentsdb-client/statsd_taggable.rb', line 75 def emit( = {}) # 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. "statsd.apps.rss", rss, @client. "statsd.apps.pcpu", pcpu, end |