Class: Jaeger::Client::Collector

Inherits:
Object
  • Object
show all
Defined in:
lib/jaeger/client/collector.rb

Defined Under Namespace

Classes: Buffer

Instance Method Summary collapse

Constructor Details

#initializeCollector

Returns a new instance of Collector.



8
9
10
# File 'lib/jaeger/client/collector.rb', line 8

def initialize
  @buffer = Buffer.new
end

Instance Method Details

#retrieveObject



32
33
34
# File 'lib/jaeger/client/collector.rb', line 32

def retrieve
  @buffer.retrieve
end

#send_span(span, end_time) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/jaeger/client/collector.rb', line 12

def send_span(span, end_time)
  context = span.context
  start_ts, duration = build_timestamps(span, end_time)
  return if !context.sampled? && !context.debug?

  @buffer << Jaeger::Thrift::Span.new(
    'traceIdLow' => context.thrift_trace_id,
    'traceIdHigh' => 0,
    'spanId' => context.thrift_span_id,
    'parentSpanId' => context.thrift_parent_id,
    'operationName' => span.operation_name,
    'references' => build_references(span.references || []),
    'flags' => context.flags,
    'startTime' => start_ts,
    'duration' => duration,
    'tags' => span.tags,
    'logs' => span.logs
  )
end