Class: Bitfab::Otel::DeliveryTrackingExporter
- Inherits:
-
Object
- Object
- Bitfab::Otel::DeliveryTrackingExporter
- Defined in:
- lib/bitfab/otel.rb
Overview
Records failed exports so a flush can report delivery, not just drain.
Instance Method Summary collapse
- #export(spans, timeout: nil) ⇒ Object
- #force_flush(timeout: nil) ⇒ Object
-
#initialize(exporter) ⇒ DeliveryTrackingExporter
constructor
A new instance of DeliveryTrackingExporter.
- #shutdown(timeout: nil) ⇒ Object
- #take_failed_exports ⇒ Object
Constructor Details
#initialize(exporter) ⇒ DeliveryTrackingExporter
Returns a new instance of DeliveryTrackingExporter.
457 458 459 460 461 |
# File 'lib/bitfab/otel.rb', line 457 def initialize(exporter) @exporter = exporter @mutex = Mutex.new @failed_exports = 0 end |
Instance Method Details
#export(spans, timeout: nil) ⇒ Object
463 464 465 466 467 468 469 470 471 472 |
# File 'lib/bitfab/otel.rb', line 463 def export(spans, timeout: nil) result = begin @exporter.export(spans, timeout:) rescue @mutex.synchronize { @failed_exports += 1 } raise end @mutex.synchronize { @failed_exports += 1 } unless result == SUCCESS result end |
#force_flush(timeout: nil) ⇒ Object
482 483 484 |
# File 'lib/bitfab/otel.rb', line 482 def force_flush(timeout: nil) @exporter.force_flush(timeout:) end |
#shutdown(timeout: nil) ⇒ Object
486 487 488 |
# File 'lib/bitfab/otel.rb', line 486 def shutdown(timeout: nil) @exporter.shutdown(timeout:) end |
#take_failed_exports ⇒ Object
474 475 476 477 478 479 480 |
# File 'lib/bitfab/otel.rb', line 474 def take_failed_exports @mutex.synchronize do failed = @failed_exports @failed_exports = 0 failed end end |