|
11 | 11 | require "protocol/http/body/completable" |
12 | 12 | require "protocol/http/methods" |
13 | 13 |
|
14 | | -require "traces/provider" |
15 | | - |
16 | 14 | require_relative "protocol" |
17 | 15 |
|
18 | 16 | module Async |
@@ -168,56 +166,6 @@ def make_pool(**options) |
168 | 166 | @protocol.client(@endpoint.connect) |
169 | 167 | end |
170 | 168 | end |
171 | | - |
172 | | - Traces::Provider(self) do |
173 | | - def call(request) |
174 | | - attributes = { |
175 | | - 'http.method': request.method, |
176 | | - 'http.authority': request.authority || self.authority, |
177 | | - 'http.scheme': request.scheme || self.scheme, |
178 | | - 'http.path': request.path, |
179 | | - } |
180 | | - |
181 | | - if protocol = request.protocol |
182 | | - attributes["http.protocol"] = protocol |
183 | | - end |
184 | | - |
185 | | - if length = request.body&.length |
186 | | - attributes["http.request.length"] = length |
187 | | - end |
188 | | - |
189 | | - Traces.trace("async.http.client.call", attributes: attributes) do |span| |
190 | | - if context = Traces.trace_context |
191 | | - request.headers["traceparent"] = context.to_s |
192 | | - # request.headers['tracestate'] = context.state |
193 | | - end |
194 | | - |
195 | | - super.tap do |response| |
196 | | - if version = response&.version |
197 | | - span["http.version"] = version |
198 | | - end |
199 | | - |
200 | | - if status = response&.status |
201 | | - span["http.status_code"] = status |
202 | | - end |
203 | | - |
204 | | - if length = response.body&.length |
205 | | - span["http.response.length"] = length |
206 | | - end |
207 | | - end |
208 | | - end |
209 | | - end |
210 | | - |
211 | | - def make_response(request, connection, attempt) |
212 | | - attributes = { |
213 | | - attempt: attempt, |
214 | | - } |
215 | | - |
216 | | - Traces.trace("async.http.client.make_response", attributes: attributes) do |
217 | | - super |
218 | | - end |
219 | | - end |
220 | | - end |
221 | 169 | end |
222 | 170 | end |
223 | 171 | end |
0 commit comments