class OpenTracing::Instrumentation::Rack::HttpTagger
HttpTagger
create addition tags on span
Constants
- DEFAULT_TAG_REQUEST_HEADERS
- DEFAULT_TAG_RESPONSE_HEADERS
Public Class Methods
new( tag_request_headers: DEFAULT_TAG_REQUEST_HEADERS, tag_response_headers: DEFAULT_TAG_RESPONSE_HEADERS )
click to toggle source
# File lib/opentracing/instrumentation/rack/http_tagger.rb, line 22 def initialize( tag_request_headers: DEFAULT_TAG_REQUEST_HEADERS, tag_response_headers: DEFAULT_TAG_RESPONSE_HEADERS ) @tag_request_headers = prepare_request_mapping(tag_request_headers) @tag_response_headers = prepare_response_mapping(tag_response_headers) end
Public Instance Methods
Private Instance Methods
prepare_request_mapping(source_mapping)
click to toggle source
# File lib/opentracing/instrumentation/rack/http_tagger.rb, line 51 def prepare_request_mapping(source_mapping) source_mapping.map do |key, header| rack_header = "HTTP_#{header.tr('-', '_').upcase}" tag_name = "http.request.#{key}" [tag_name, rack_header] end.to_h end
prepare_response_mapping(source_mapping)
click to toggle source
# File lib/opentracing/instrumentation/rack/http_tagger.rb, line 59 def prepare_response_mapping(source_mapping) source_mapping.map do |key, header| tag_name = "http.response.#{key}" header_regexp = /^#{header}$/i [tag_name, header_regexp] end.to_h end