Class: Foam::Otel::Ingest::SpanProcessor

Inherits:
Object
  • Object
show all
Includes:
DoubleClaim
Defined in:
lib/foam/otel/ingest.rb

Instance Method Summary collapse

Constructor Details

#initialize(batch, config) ⇒ SpanProcessor

Returns a new instance of SpanProcessor.



397
398
399
400
401
402
403
404
405
406
407
# File 'lib/foam/otel/ingest.rb', line 397

def initialize(batch, config)
  @batch = batch
  @config = config
  @signal = :traces
  @export_host = Ingest.send(:endpoint_host, config.endpoint)
  @claim_mutex = Mutex.new
  @claim_checked = false
  @double_claim_warned = false
  @stood_down = false
  @echo_warned = false
end

Instance Method Details

#force_flush(timeout: nil) ⇒ Object



421
422
423
424
425
426
427
# File 'lib/foam/otel/ingest.rb', line 421

def force_flush(timeout: nil)
  return EXPORT_SUCCESS if @stood_down

  @batch.force_flush(timeout: timeout)
rescue StandardError, SystemStackError
  EXPORT_FAILURE
end

#on_finish(span) ⇒ Object



411
412
413
414
415
416
417
418
419
# File 'lib/foam/otel/ingest.rb', line 411

def on_finish(span)
  return unless admit?(span.resource)
  return if echo_span?(span)

  @batch.on_finish(span)
  nil
rescue StandardError, SystemStackError
  nil
end

#on_start(_span, _parent_context) ⇒ Object



409
# File 'lib/foam/otel/ingest.rb', line 409

def on_start(_span, _parent_context) = nil

#shutdown(timeout: nil) ⇒ Object



429
430
431
432
433
434
435
# File 'lib/foam/otel/ingest.rb', line 429

def shutdown(timeout: nil)
  return EXPORT_SUCCESS if @stood_down

  @batch.shutdown(timeout: timeout)
rescue StandardError, SystemStackError
  EXPORT_FAILURE
end