[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud Trace API - Class Google::Cloud::Trace::FaradayMiddleware (v0.45.0)\n\nVersion latestkeyboard_arrow_down\n\n- [0.45.0 (latest)](/ruby/docs/reference/google-cloud-trace/latest/Google-Cloud-Trace-FaradayMiddleware)\n- [0.44.1](/ruby/docs/reference/google-cloud-trace/0.44.1/Google-Cloud-Trace-FaradayMiddleware)\n- [0.43.0](/ruby/docs/reference/google-cloud-trace/0.43.0/Google-Cloud-Trace-FaradayMiddleware)\n- [0.42.2](/ruby/docs/reference/google-cloud-trace/0.42.2/Google-Cloud-Trace-FaradayMiddleware)\n- [0.41.4](/ruby/docs/reference/google-cloud-trace/0.41.4/Google-Cloud-Trace-FaradayMiddleware) \nReference documentation and code samples for the Cloud Trace API class Google::Cloud::Trace::FaradayMiddleware. \n\nInherits\n--------\n\n- Faraday::Middleware\n\nMethods\n-------\n\n### #call\n\n def call(env)\n\nCreate a Trace span with the HTTP request/response information.\n\n### #initialize\n\n def initialize(app, opts = {}) -\u003e FaradayMiddleware\n\n#### Trace FaradayMiddleware\n\nA faraday middleware that setup request/response labels for trace.\n\n#### Installing\n\nTo use this middleware, simply install it in your middleware stack.\nHere is an example configuration enable the Trace middleware:\n\n`ruby\nconn = Faraday.new(:url =\u003e 'http://example.com') do |faraday|\n# enable cross project tracing with option to true\nfaraday.use Google::Cloud::Trace::FaradayMiddleware, enable_cross_project_tracing: true\nfaraday.request :url_encoded # form-encode POST params\nfaraday.response :logger # log requests to $stdout\nfaraday.adapter Faraday.default_adapter # use Net::HTTP adapter\nend\n` \n**Returns**\n\n- ([FaradayMiddleware](./Google-Cloud-Trace-FaradayMiddleware)) --- a new instance of FaradayMiddleware"]]