Class: Promenade::Pitchfork::MemStats
- Inherits:
-
Object
- Object
- Promenade::Pitchfork::MemStats
- Defined in:
- lib/promenade/pitchfork/mem_stats.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ MemStats
constructor
A new instance of MemStats.
- #instrument ⇒ Object
Constructor Details
#initialize ⇒ MemStats
Returns a new instance of MemStats.
14 15 16 17 18 |
# File 'lib/promenade/pitchfork/mem_stats.rb', line 14 def initialize return unless defined?(::Pitchfork) && defined?(::Pitchfork::MemInfo) @mem_info = ::Pitchfork::MemInfo.new(Process.pid) end |
Class Method Details
.instrument ⇒ Object
26 27 28 29 |
# File 'lib/promenade/pitchfork/mem_stats.rb', line 26 def self.instrument new.instrument rescue StandardError end |
Instance Method Details
#instrument ⇒ Object
20 21 22 23 24 |
# File 'lib/promenade/pitchfork/mem_stats.rb', line 20 def instrument Promenade.metric(:pitchfork_memory_usage_bytes).set({ type: "RSS" }, @mem_info.rss * 1024) Promenade.metric(:pitchfork_memory_usage_bytes).set({ type: "PSS" }, @mem_info.pss * 1024) Promenade.metric(:pitchfork_memory_usage_bytes).set({ type: "Shared" }, @mem_info.shared_memory * 1024) end |