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.
419 420 421 422 423 |
# File 'lib/bitfab/otel.rb', line 419 def initialize(exporter) @exporter = exporter @mutex = Mutex.new @failed_exports = 0 end |
Instance Method Details
#export(spans, timeout: nil) ⇒ Object
425 426 427 428 429 430 431 432 433 434 |
# File 'lib/bitfab/otel.rb', line 425 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
444 445 446 |
# File 'lib/bitfab/otel.rb', line 444 def force_flush(timeout: nil) @exporter.force_flush(timeout:) end |
#shutdown(timeout: nil) ⇒ Object
448 449 450 |
# File 'lib/bitfab/otel.rb', line 448 def shutdown(timeout: nil) @exporter.shutdown(timeout:) end |
#take_failed_exports ⇒ Object
436 437 438 439 440 441 442 |
# File 'lib/bitfab/otel.rb', line 436 def take_failed_exports @mutex.synchronize do failed = @failed_exports @failed_exports = 0 failed end end |