Skip to content

Commit 0e572b2

Browse files
committed
Only trace framer operations if in an active trace.
1 parent c912997 commit 0e572b2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/traces/provider/protocol/http2/framer.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,24 @@
88

99
Traces::Provider(Protocol::HTTP2::Framer) do
1010
def write_connection_preface
11+
return super unless Traces.active?
12+
1113
Traces.trace("protocol.http2.framer.write_connection_preface") do
1214
super
1315
end
1416
end
1517

1618
def read_connection_preface
19+
return super unless Traces.active?
20+
1721
Traces.trace("protocol.http2.framer.read_connection_preface") do
1822
super
1923
end
2024
end
2125

2226
def write_frame(frame)
27+
return super unless Traces.active?
28+
2329
attributes = {
2430
"frame.length" => frame.length,
2531
"frame.class" => frame.class.name,
@@ -34,6 +40,8 @@ def write_frame(frame)
3440
end
3541

3642
def read_frame(...)
43+
return super unless Traces.active?
44+
3745
Traces.trace("protocol.http2.framer.read_frame") do |span|
3846
super.tap do |frame|
3947
span["frame.length"] = frame.length
@@ -45,6 +53,8 @@ def read_frame(...)
4553
end
4654

4755
def flush
56+
return super unless Traces.active?
57+
4858
Traces.trace("protocol.http2.framer.flush") do
4959
super
5060
end

0 commit comments

Comments
 (0)