26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/instrumentation/epsagon_faraday_middleware.rb', line 26
def call(env)
http_method = HTTP_METHODS_SYMBOL_TO_STRING[env.method]
path, path_params = env.url.path.split(';')
attributes = {
'type' => 'http',
'operation' => http_method,
'http.scheme' => env.url.scheme,
'http.request.path' => path
}
unless config[:epsagon][:metadata_only]
attributes.merge!(Util.epsagon_query_attributes(env.url.query))
attributes.merge!({
'http.request.path_params' => path_params,
'http.request.headers' => Hash[env.],
'http.request.body' => env.body,
'http.request.headers.User-Agent' => env.['User-Agent']
})
end
tracer.in_span(
env.url.host,
attributes: attributes,
kind: :client
) do |span|
OpenTelemetry.propagation.http.inject(env.)
app.call(env).on_complete { |req| trace_response(span, req.response) }
end
end
|