File: request_id.rb

package info (click to toggle)
ruby-sentry-ruby 5.18.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 564 kB
  • sloc: ruby: 4,701; makefile: 8; sh: 4
file content (18 lines) | stat: -rw-r--r-- 416 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

module Sentry
  module Utils
    module RequestId
      REQUEST_ID_HEADERS = %w[action_dispatch.request_id HTTP_X_REQUEST_ID].freeze

      # Request ID based on ActionDispatch::RequestId
      def self.read_from(env)
        REQUEST_ID_HEADERS.each do |key|
          request_id = env[key]
          return request_id if request_id
        end
        nil
      end
    end
  end
end