Class: NewRelic::Agent::Sampler
- Inherits:
-
Object
- Object
- NewRelic::Agent::Sampler
show all
- Defined in:
- lib/new_relic/agent/sampler.rb
Defined Under Namespace
Classes: Unsupported
Class Attribute Summary collapse
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
-
#initialize(id = nil) ⇒ Sampler
constructor
The ID passed in here is unused by our code, but is preserved in case we have clients who are defining their own subclasses of this class, and expecting to be able to call super with an ID.
-
#poll ⇒ Object
Constructor Details
#initialize(id = nil) ⇒ Sampler
The ID passed in here is unused by our code, but is preserved in case we have clients who are defining their own subclasses of this class, and expecting to be able to call super with an ID.
55
56
57
|
# File 'lib/new_relic/agent/sampler.rb', line 55
def initialize(id = nil)
@id = id || self.class.shorthand_name
end
|
Class Attribute Details
.shorthand_name ⇒ Object
23
24
25
|
# File 'lib/new_relic/agent/sampler.rb', line 23
def shorthand_name
@shorthand_name
end
|
Instance Attribute Details
#id ⇒ Object
19
20
21
|
# File 'lib/new_relic/agent/sampler.rb', line 19
def id
@id
end
|
Class Method Details
.enabled? ⇒ Boolean
39
40
41
42
43
44
45
46
|
# File 'lib/new_relic/agent/sampler.rb', line 39
def self.enabled?
if shorthand_name
config_key = "disable_#{shorthand_name}_sampler"
!(Agent.config[config_key])
else
true
end
end
|
.inherited(subclass) ⇒ Object
30
31
32
|
# File 'lib/new_relic/agent/sampler.rb', line 30
def self.inherited(subclass)
@sampler_classes << subclass
end
|
.named(new_name) ⇒ Object
26
27
28
|
# File 'lib/new_relic/agent/sampler.rb', line 26
def self.named(new_name)
@shorthand_name = new_name
end
|
.sampler_classes ⇒ Object
48
49
50
|
# File 'lib/new_relic/agent/sampler.rb', line 48
def self.sampler_classes
@sampler_classes
end
|
Override with check. Called before instantiating.
35
36
37
|
# File 'lib/new_relic/agent/sampler.rb', line 35
def self.supported_on_this_platform?
true
end
|
Instance Method Details
#poll ⇒ Object
59
60
61
|
# File 'lib/new_relic/agent/sampler.rb', line 59
def poll
raise 'Implement in the subclass'
end
|