lib/request_tracer.rb in request-tracer-0.6.3 vs lib/request_tracer.rb in request-tracer-0.6.4
- old
+ new
@@ -1,5 +1,7 @@
+require_relative 'request_tracer/trace'
+
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
@@ -11,7 +13,11 @@
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
+
+ def self.latest_trace_hash(*args)
+ Trace.latest.to_h
end
end