Module: Rack::RequestTracker

Defined in:
lib/rack/request_tracker/version.rb,
lib/rack/request_tracker.rb

Defined Under Namespace

Modules: Middleware

Constant Summary collapse

VERSION =
'0.3.2'
LOG_TAGS =
%i(request_id forwarded_for request_uid organization user_agent)

Class Method Summary collapse

Class Method Details

.compute_tagsObject



17
18
19
20
21
# File 'lib/rack/request_tracker.rb', line 17

def compute_tags
  LOG_TAGS
      .map { |it| send(it) || 'tracker-tag-absent' }
      .join(', ')
end

.transaction_headersObject



8
9
10
# 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) ⇒ Object



23
24
25
# 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