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, #stats_engine

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NewRelic::Agent::Sampler

inherited, sampler_classes, use_harvest_sampler?

Constructor Details

#initializeObjectSampler

Returns a new instance of ObjectSampler.



6
7
8
# File 'lib/new_relic/agent/samplers/object_sampler.rb', line 6

def initialize
  super :objects
end

Class Method Details

.supported_on_this_platform?Boolean

Returns:

  • (Boolean)


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

def self.supported_on_this_platform?
  defined?(ObjectSpace) && ObjectSpace.respond_to?(:live_objects)
end

Instance Method Details

#pollObject



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

def poll
  stats.record_data_point(ObjectSpace.live_objects)
end

#statsObject



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

def stats
  stats_engine.get_stats_no_scope("GC/objects")
end