Reference documentation and code samples for the Cloud Trace API class Google::Cloud::Trace::FaradayMiddleware.
Inherits
- Faraday::Middleware
Methods
#call
def call(env)
Create a Trace span with the HTTP request/response information.
#initialize
def initialize(app, opts = {}) -> FaradayMiddleware
Trace FaradayMiddleware
A faraday middleware that setup request/response labels for trace.
Installing
To use this middleware, simply install it in your middleware stack. Here is an example configuration enable the Trace middleware:
ruby
conn = Faraday.new(:url => 'http://example.com') do |faraday|
# enable cross project tracing with option to true
faraday.use Google::Cloud::Trace::FaradayMiddleware, enable_cross_project_tracing: true
faraday.request :url_encoded # form-encode POST params
faraday.response :logger # log requests to $stdout
faraday.adapter Faraday.default_adapter # use Net::HTTP adapter
end
- (FaradayMiddleware) — a new instance of FaradayMiddleware