class Airbrake::TimedTrace
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/airbrake-ruby/timed_trace.rbs class Airbrake::TimedTrace def start_span: (Symbol label) -> untyped end
@since v4.3.0
@api public
timed_trace.spans #=> { ‘http request’ => 0.123 }
end
http.get(‘example.com’)
timed_trace.span(‘http request’) do
timed_trace = TimedTrace.new
@example
stored under a label. The chunk is called a “span”.
TimedTrace represents a chunk of code performance of which was measured and
def self.span(label, &block)
-
(Airbrake::TimedTrace)
-
Parameters:
-
label
(String
) --
def self.span(label, &block) new.tap { |timed_trace| timed_trace.span(label, &block) } end
def initialize
def initialize @spans = {} end
def span(label)
-
(Boolean)
-
Parameters:
-
label
(String
) --
def span(label) start_span(label) yield stop_span(label) end
def spans
-
(Hash
-Float>)
def spans @spans.transform_values(&:duration) end
def start_span(label)
Experimental RBS support (using type sampling data from the type_fusion
project).
def start_span: (Symbol label) -> untyped
This signature was generated using 1 sample from 1 application.
-
(Boolean)
-
Parameters:
-
label
(String
) --
def start_span(label) return false if @spans.key?(label) @spans[label] = Airbrake::Benchmark.new true end
def stop_span(label)
-
(Boolean)
-
Parameters:
-
label
(String
) --
def stop_span(label) return false unless @spans.key?(label) @spans[label].stop true end