Class: Zipkin::Collector
- Inherits:
-
Object
- Object
- Zipkin::Collector
- Defined in:
- lib/zipkin/collector.rb,
lib/zipkin/collector/timestamp.rb,
lib/zipkin/collector/log_annotations.rb
Defined Under Namespace
Modules: LogAnnotations, Timestamp Classes: Buffer
Constant Summary collapse
- OT_KIND_TO_ZIPKIN_KIND =
{ 'server' => 'SERVER', 'client' => 'CLIENT', 'producer' => 'PRODUCER', 'consumer' => 'CONSUMER' }.freeze
Instance Method Summary collapse
-
#initialize(local_endpoint) ⇒ Collector
constructor
A new instance of Collector.
- #retrieve ⇒ Object
- #send_span(span, end_time) ⇒ Object
Constructor Details
Instance Method Details
#retrieve ⇒ Object
22 23 24 |
# File 'lib/zipkin/collector.rb', line 22 def retrieve @buffer.retrieve end |
#send_span(span, end_time) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/zipkin/collector.rb', line 26 def send_span(span, end_time) finish_ts = Timestamp.create(end_time) start_ts = Timestamp.create(span.start_time) duration = finish_ts - start_ts return unless span.context.sampled? @buffer << { traceId: span.context.trace_id, id: span.context.span_id, parentId: span.context.parent_id, name: span.operation_name, kind: OT_KIND_TO_ZIPKIN_KIND[span.[:'span.kind'] || 'server'], timestamp: start_ts, duration: duration, debug: false, shared: false, localEndpoint: @local_endpoint, remoteEndpoint: Endpoint.remote_endpoint(span), annotations: LogAnnotations.build(span), tags: span. } end |