class AppPerfRpm::Tracing::Collector

Attributes

buffer[R]

Public Class Methods

new(local_endpoint) click to toggle source
# File lib/app_perf_rpm/tracing/collector.rb, line 8
def initialize(local_endpoint)
  @buffer = Buffer.new
  @local_endpoint = local_endpoint
end

Public Instance Methods

retrieve() click to toggle source
# File lib/app_perf_rpm/tracing/collector.rb, line 13
def retrieve
  @buffer.retrieve
end
send_span(span, end_time) click to toggle source
# File lib/app_perf_rpm/tracing/collector.rb, line 17
def send_span(span, end_time)
  duration = end_time - span.start_time

  @buffer << {
    "traceId" => span.context.trace_id,
    "id" => span.context.span_id,
    "parentId" => span.context.parent_id,
    "name" => span.operation_name,
    "timestamp" => span.start_time,
    "duration" => duration * 1_000,
    "logEntries" => span.log_entries,
    "tags" => span.tags
  }
end