Skip to content

Commit

Permalink
Update based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jterapin committed Aug 23, 2024
1 parent a25c263 commit d156409
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hearth/lib/hearth/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,11 @@ def initialize(uri: URI(''), body: StringIO.new)

# @return [IO, StringIO]
attr_accessor :body

# Contains attributes for Telemetry span to emit.
# @return [Hash]
def span_attributes
{}
end
end
end
6 changes: 6 additions & 0 deletions hearth/lib/hearth/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,11 @@ def reset
@body.rewind if @body.respond_to?(:rewind) && !@body.instance_of?(IO)
self
end

# Contains attributes for Telemetry span to emit.
# @return [Hash]
def span_attributes
{}
end
end
end
2 changes: 2 additions & 0 deletions hearth/sig/lib/hearth/http/request.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ module Hearth
def remove_query_param: (String name) -> void

def prefix_host: (String prefix) -> void

def span_attributes: () -> Hash[String,String]
end
end
end
2 changes: 2 additions & 0 deletions hearth/sig/lib/hearth/http/response.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ module Hearth
def replace: (Response other) -> self

def reset: () -> void

def span_attributes: () -> Hash[String,String]
end
end
end
2 changes: 2 additions & 0 deletions hearth/sig/lib/hearth/request.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ module Hearth
attr_accessor uri: URI

attr_accessor body: (IO | StringIO)

def span_attributes: () -> Hash[String, String]
end
end
7 changes: 7 additions & 0 deletions hearth/spec/hearth/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,12 @@ module Hearth
expect(request.uri).to be_a(URI)
end
end

describe '#span_attributes' do
it 'returns empty hash' do
request = Request.new
expect(request.span_attributes).to be_empty
end
end
end
end
7 changes: 7 additions & 0 deletions hearth/spec/hearth/response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,12 @@ module Hearth
read.close
end
end

describe '#span_attributes' do
it 'returns empty hash' do
response = Response.new
expect(response.span_attributes).to be_empty
end
end
end
end

0 comments on commit d156409

Please sign in to comment.