lib/oboe/api/tracing.rb in oboe-2.7.1.7-java vs lib/oboe/api/tracing.rb in oboe-2.7.2.fuchs1
- old
+ new
@@ -1,12 +1,13 @@
# Copyright (c) 2013 AppNeta, Inc.
# All rights reserved.
module Oboe
module API
+ ##
+ # Provides the higher-level tracing interface for the API.
module Tracing
-
# Public: Trace a given block of code. Detect any exceptions thrown by
# the block and report errors.
#
# layer - The layer the block of code belongs to.
# opts - A hash containing key/value pairs that will be reported along
@@ -28,11 +29,11 @@
# end
#
# result = computation_with_oboe(1000)
#
# Returns the result of the block.
- def trace(layer, opts={}, protect_op=nil)
+ def trace(layer, opts = {}, protect_op = nil)
log_entry(layer, opts, protect_op)
begin
yield
rescue Exception => e
log_exception(layer, e)
@@ -71,11 +72,11 @@
# end
#
# Returns a list of length two, the first element of which is the result
# of the block, and the second element of which is the oboe context that
# was set when the block completed execution.
- def start_trace(layer, xtrace=nil, opts={})
+ def start_trace(layer, xtrace = nil, opts = {})
log_start(layer, xtrace, opts)
begin
result = yield
rescue Exception => e
log_exception(layer, e)
@@ -112,20 +113,20 @@
# handle_request(request, response)
# end
# end
#
# Returns the result of the block.
- def start_trace_with_target(layer, xtrace, target, opts={})
+ def start_trace_with_target(layer, xtrace, target, opts = {})
log_start(layer, xtrace, opts)
exit_evt = Oboe::Context.createEvent
begin
target['X-Trace'] = Oboe::Event.metadataString(exit_evt) if Oboe.tracing?
yield
rescue Exception => e
log_exception(layer, e)
raise
ensure
- exit_evt.addEdge(Oboe::Context.get())
+ exit_evt.addEdge(Oboe::Context.get)
log_event(layer, 'exit', exit_evt)
Oboe::Context.clear
end
end
end