Class: AppPerfRpm::Tracer::Instance

Inherits:
Object
  • Object
show all
Defined in:
lib/app_perf_rpm/tracer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(layer, opts = {}) ⇒ Instance

Returns a new instance of Instance.



113
114
115
116
117
118
# File 'lib/app_perf_rpm/tracer.rb', line 113

def initialize(layer, opts = {})
  @span = Span.new
  @span.layer = layer
  @span.options = opts
  @span.started_at = Time.now.to_f
end

Instance Attribute Details

#durationObject

Returns the value of attribute duration.



111
112
113
# File 'lib/app_perf_rpm/tracer.rb', line 111

def duration
  @duration
end

#layerObject

Returns the value of attribute layer.



111
112
113
# File 'lib/app_perf_rpm/tracer.rb', line 111

def layer
  @layer
end

#optsObject

Returns the value of attribute opts.



111
112
113
# File 'lib/app_perf_rpm/tracer.rb', line 111

def opts
  @opts
end

#startObject

Returns the value of attribute start.



111
112
113
# File 'lib/app_perf_rpm/tracer.rb', line 111

def start
  @start
end

Instance Method Details

#finish(opts = {}) ⇒ Object



120
121
122
123
# File 'lib/app_perf_rpm/tracer.rb', line 120

def finish(opts = {})
  @span.options.merge!(opts)
  @span.ended_at = Time.now.to_f
end

#submit(opts = {}) ⇒ Object



125
126
127
128
129
130
# File 'lib/app_perf_rpm/tracer.rb', line 125

def submit(opts = {})
  if ::AppPerfRpm::Tracer.tracing?
    @span.options.merge!(opts)
    ::AppPerfRpm.store(@span)
  end
end