module Rack::RequestTracker

Constants

LOG_TAGS
VERSION

Public Class Methods

compute_tags() click to toggle source
# File lib/rack/request_tracker.rb, line 17
def compute_tags
  LOG_TAGS
      .map { |it| send(it) || 'tracker-tag-absent' }
      .join(', ')
end
transaction_headers() click to toggle source
# File lib/rack/request_tracker.rb, line 8
def transaction_headers
  LOG_TAGS.map { |it| [to_header(it), send(it)] }.to_h.compact
end
with_transaction_headers(args) click to toggle source
# File lib/rack/request_tracker.rb, line 23
def with_transaction_headers(args)
  is_safe_domain?(URI.parse(args[:url]).hostname) ? args.deep_merge(headers: transaction_headers) : args
end

Private Class Methods

is_safe_domain?(hostname) click to toggle source
# File lib/rack/request_tracker.rb, line 33
def is_safe_domain?(hostname)
  safe_domains.any? { |it| hostname.end_with? it }
end
safe_domains() click to toggle source
# File lib/rack/request_tracker.rb, line 37
def safe_domains
  []
end
to_header(log_tag) click to toggle source
# File lib/rack/request_tracker.rb, line 29
def to_header(log_tag)
  "X-#{log_tag.upcase}".gsub('_', '-')
end