Sha256: 59d33865c8c1cb3deab149582c87ad14d5446dbc5abb5fd3dff9acf81dc66228

Contents?: true

Size: 992 Bytes

Versions: 25

Compression:

Stored size: 992 Bytes

Contents

module Timber
  module Contexts
    # The HTTP content tracks the current HTTP request being processed. This serves
    # as join data across your logs, allowing you to query all logs for any attribute
    # presented here. For example, viewing all logs for a given request_id.
    #
    # @note This context should be installed automatically through probes,
    #   such as the {Probes::RackHTTPContext} probe.
    class HTTP < Context
      @keyspace = :http

      attr_reader :method, :path, :remote_addr, :request_id

      def initialize(attributes)
        @method = attributes[:method] || raise(ArgumentError.new(":method is required"))
        @path = attributes[:path] || raise(ArgumentError.new(":path is required"))
        @remote_addr = attributes[:remote_addr]
        @request_id = attributes[:request_id]
      end

      def as_json(_options = {})
        {:method => method, :path => path, :remote_addr => remote_addr, :request_id => request_id}
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
timber-1.1.14 lib/timber/contexts/http.rb
timber-1.1.13 lib/timber/contexts/http.rb
timber-1.1.12 lib/timber/contexts/http.rb
timber-1.1.11 lib/timber/contexts/http.rb
timber-1.1.10 lib/timber/contexts/http.rb
timber-1.1.9 lib/timber/contexts/http.rb
timber-1.1.8 lib/timber/contexts/http.rb
timber-1.1.7 lib/timber/contexts/http.rb
timber-1.1.6 lib/timber/contexts/http.rb
timber-1.1.5 lib/timber/contexts/http.rb
timber-1.1.4 lib/timber/contexts/http.rb
timber-1.1.3 lib/timber/contexts/http.rb
timber-1.1.2 lib/timber/contexts/http.rb
timber-1.1.1 lib/timber/contexts/http.rb
timber-1.1.0 lib/timber/contexts/http.rb
timber-1.0.13 lib/timber/contexts/http.rb
timber-1.0.12 lib/timber/contexts/http.rb
timber-1.0.11 lib/timber/contexts/http.rb
timber-1.0.10 lib/timber/contexts/http.rb
timber-1.0.9 lib/timber/contexts/http.rb