Module: Highlight::Helpers

Extended by:
ActionView::Helpers::TagHelper
Includes:
ActionView::Helpers
Defined in:
lib/highlight.rb

Class Method Summary collapse

Class Method Details

.traceparent_metaObject



327
328
329
330
331
332
333
334
335
# File 'lib/highlight.rb', line 327

def self.traceparent_meta
  current_trace = OpenTelemetry::Trace.current_span
  trace_id = current_trace&.context&.trace_id
  span_id = current_trace&.context&.span_id
  hex_trace_id = trace_id&.unpack1('H*') || ('0' * 32)
  hex_span_id = span_id&.unpack1('H*') || ('0' * 16)

  "00-#{hex_trace_id}-#{hex_span_id}-01"
end

.traceparent_meta_tagObject



337
338
339
# File 'lib/highlight.rb', line 337

def self.traceparent_meta_tag
  "<meta name=\"traceparent\" content=\"#{traceparent_meta}\">"
end