Sha256: a8e16cd98f9a96b849be6ae607561a53c8652cb03aef6c05e52bfacc37725242

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2024, by Samuel Williams.

require "traces/provider"
require_relative "../../../../protocol/http2/framer"

Traces::Provider(Protocol::HTTP2::Framer) do
	def write_connection_preface
		Traces.trace("protocol.http2.framer.write_connection_preface") do
			super
		end
	end
	
	def read_connection_preface
		Traces.trace("protocol.http2.framer.read_connection_preface") do
			super
		end
	end
	
	def write_frame(frame)
		attributes = {
			"frame.length" => frame.length,
			"frame.class" => frame.class.name,
			"frame.type" => frame.type,
			"frame.flags" => frame.flags,
			"frame.stream_id" => frame.stream_id,
		}
		
		Traces.trace("protocol.http2.framer.write_frame", attributes: attributes) do
			super
		end
	end
	
	def read_frame(...)
		Traces.trace("protocol.http2.framer.read_frame") do |span|
			super.tap do |frame|
				span["frame.length"] = frame.length
				span["frame.type"] = frame.type
				span["frame.flags"] = frame.flags
				span["frame.stream_id"] = frame.stream_id
			end
		end
	end
	
	def flush
		Traces.trace("protocol.http2.framer.flush") do
			super
		end
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
protocol-http2-0.22.0 lib/traces/provider/protocol/http2/framer.rb
protocol-http2-0.21.0 lib/traces/provider/protocol/http2/framer.rb
protocol-http2-0.20.0 lib/traces/provider/protocol/http2/framer.rb