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.



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

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



436
437
438
439
440
441
442
# File 'lib/foam/otel/ingest.rb', line 436

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



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

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



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

def on_start(_span, _parent_context) = nil

#shutdown(timeout: nil) ⇒ Object



444
445
446
447
448
449
450
# File 'lib/foam/otel/ingest.rb', line 444

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

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