Sha256: bb7a18bc0d819919db717f23fc90b5eb1bf7239a16e33b0749079aab6f4c9d15

Contents?: true

Size: 821 Bytes

Versions: 7

Compression:

Stored size: 821 Bytes

Contents

module RequestTracer
  B3_REQUIRED_FIELDS = %w(trace_id parent_span_id span_id)
  B3_REQUIRED_FIELDS_FROM_SHORT_NAMES = B3_REQUIRED_FIELDS.map {|f| [f.gsub("_", ""), f] }.to_h
  B3_REQUIRED_HEADERS = B3_REQUIRED_FIELDS.map {|f| "HTTP_X_B3_#{f.gsub("_", "").upcase}" }
  B3_REQUIRED_FIELD_HEADER_MAP = B3_REQUIRED_FIELDS.zip(B3_REQUIRED_HEADERS).to_h
  B3_REQUIRED_HEADER_FIELD_MAP = B3_REQUIRED_HEADERS.zip(B3_REQUIRED_FIELDS).to_h
  B3_OPT_HEADERS = %w[HTTP_X_B3_FLAGS]

  def self.integrate_with(*services)
    services.each do |service|
      require_relative "request_tracer/integration/#{service}_handler"
      class_name = service.to_s.split('_').collect(&:capitalize).join + 'Handler'
      integration_module = RequestTracer::Integration.const_get(class_name)
      integration_module.activate
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
request-tracer-0.6.3 lib/request_tracer.rb
request-tracer-0.6.2 lib/request_tracer.rb
request-tracer-0.6.1 lib/request_tracer.rb
request-tracer-0.5.8 lib/request_tracer.rb
request-tracer-0.5.6 lib/request_tracer.rb
request-tracer-0.5.4 lib/request_tracer.rb
request-tracer-0.5.3 lib/request_tracer.rb