Class: NewRelic::Binding::Component

Inherits:
Object
  • Object
show all
Defined in:
lib/newrelic_platform_binding/component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, guid) ⇒ Component

Returns a new instance of Component.



7
8
9
10
11
# File 'lib/newrelic_platform_binding/component.rb', line 7

def initialize(name, guid)
  @name = name
  @guid = guid
  @last_delivered_at = nil
end

Instance Attribute Details

#guidObject (readonly)

Returns the value of attribute guid.



4
5
6
# File 'lib/newrelic_platform_binding/component.rb', line 4

def guid
  @guid
end

#last_delivered_atObject

Returns the value of attribute last_delivered_at.



5
6
7
# File 'lib/newrelic_platform_binding/component.rb', line 5

def last_delivered_at
  @last_delivered_at
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/newrelic_platform_binding/component.rb', line 4

def name
  @name
end

Instance Method Details

#durationObject



17
18
19
20
21
22
23
# File 'lib/newrelic_platform_binding/component.rb', line 17

def duration
  if last_delivered_at.nil?
    return NewRelic::Binding::Config.poll_cycle_period
  else
    return (Time.now - last_delivered_at).ceil
  end
end

#keyObject



13
14
15
# File 'lib/newrelic_platform_binding/component.rb', line 13

def key
  return (name + guid)
end