Class: Google::Cloud::Trace::FaradayMiddleware

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/google/cloud/trace/faraday_middleware.rb

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object

Create a Trace span with the HTTP request/response information.



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/google/cloud/trace/faraday_middleware.rb', line 25

def call env
  Google::Cloud::Trace.in_span "faraday_request" do |span|
    add_request_labels span, env if span

    response = @app.call env

    add_response_labels span, env if span

    response
  end
end