Skip to content

Commit 014a553

Browse files
authored
Prefer Traces.trace. (#124)
1 parent bc18201 commit 014a553

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

async-http.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
2323
spec.add_dependency "protocol-http", "~> 0.24.0"
2424
spec.add_dependency "protocol-http1", "~> 0.15.0"
2525
spec.add_dependency "protocol-http2", "~> 0.15.0"
26-
spec.add_dependency "traces", ">= 0.8.0"
26+
spec.add_dependency "traces", ">= 0.10.0"
2727

2828
spec.add_development_dependency "async-container", "~> 0.14"
2929
spec.add_development_dependency "async-rspec", "~> 1.10"

lib/async/http/client.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ def call(request)
144144
attributes['http.request.length'] = length
145145
end
146146

147-
trace('async.http.client.call', attributes: attributes) do |span|
148-
if context = self.trace_context
147+
Traces.trace('async.http.client.call', attributes: attributes) do |span|
148+
if context = Traces.trace_context
149149
request.headers['traceparent'] = context.to_s
150150
# request.headers['tracestate'] = context.state
151151
end

lib/async/http/server.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def run
6161
Traces::Provider(self) do
6262
def call(request)
6363
if trace_parent = request.headers['traceparent']
64-
self.trace_context = Traces::Context.parse(trace_parent.join, request.headers['tracestate'], remote: true)
64+
Traces.trace_context = Traces::Context.parse(trace_parent.join, request.headers['tracestate'], remote: true)
6565
end
6666

6767
attributes = {
@@ -80,7 +80,7 @@ def call(request)
8080
attributes['http.protocol'] = protocol
8181
end
8282

83-
trace('async.http.server.call', resource: "#{request.method} #{request.path}", attributes: attributes) do |span|
83+
Traces.trace('async.http.server.call', resource: "#{request.method} #{request.path}", attributes: attributes) do |span|
8484
super.tap do |response|
8585
if status = response&.status
8686
span['http.status_code'] = status

0 commit comments

Comments
 (0)