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.



8
9
10
# File 'lib/new_relic/agent/samplers/object_sampler.rb', line 8

def initialize
  super :objects
end

Class Method Details

.supported_on_this_platform?Boolean

Returns:

  • (Boolean)


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

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

Instance Method Details

#pollObject



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

def poll
  stats.record_data_point(ObjectSpace.live_objects)
end

#statsObject



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

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