Class: NewRelic::Agent::Samplers::ObjectSampler

Inherits:
NewRelic::Agent::Sampler show all
Defined in:
lib/new_relic/agent/samplers/object_sampler.rb

Instance Attribute Summary

Attributes inherited from NewRelic::Agent::Sampler

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NewRelic::Agent::Sampler

inherited, sampler_classes

Constructor Details

#initializeObjectSampler

Returns a new instance of ObjectSampler.



11
12
13
# File 'lib/new_relic/agent/samplers/object_sampler.rb', line 11

def initialize
  super :objects
end

Class Method Details

.supported_on_this_platform?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/new_relic/agent/samplers/object_sampler.rb', line 15

def self.supported_on_this_platform?
  NewRelic::LanguageSupport.object_space_enabled? && ObjectSpace.respond_to?(:live_objects)
end

Instance Method Details

#pollObject



19
20
21
22
# File 'lib/new_relic/agent/samplers/object_sampler.rb', line 19

def poll
  live_objects = ObjectSpace.live_objects
  NewRelic::Agent.record_metric("GC/objects", live_objects)
end