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.



380
381
382
383
384
385
386
387
388
389
390
# File 'lib/foam/otel/ingest.rb', line 380

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



404
405
406
407
408
409
410
# File 'lib/foam/otel/ingest.rb', line 404

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



394
395
396
397
398
399
400
401
402
# File 'lib/foam/otel/ingest.rb', line 394

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



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

def on_start(_span, _parent_context) = nil

#shutdown(timeout: nil) ⇒ Object



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

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

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