Class: ILove::Tracing::IncomingRequests::TraceRackMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/ilove/tracing/incoming_requests.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ TraceRackMiddleware

Returns a new instance of TraceRackMiddleware.



5
6
7
# File 'lib/ilove/tracing/incoming_requests.rb', line 5

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/ilove/tracing/incoming_requests.rb', line 9

def call(env)
  extracted_ctx = OpenTracing.global_tracer.extract(OpenTracing::FORMAT_RACK, env)
  span = OpenTracing.start_span('incoming http request', child_of: extracted_ctx)
  scope = OpenTracing.scope_manager.activate span

  @app.call(env)
ensure
  scope.close
end