Class: LittleGhost::Instrumentation::Subscriber

Inherits:
Object
  • Object
show all
Defined in:
lib/little_ghost/instrumentation.rb

Overview

Subclass Subscriber to connect a telemetry backend.

Override the callbacks a backend supports. start and finish receive the same operation name and correlated attributes. emit receives point events. Implementations may return a propagation carrier from #trace_context. Calls may overlap on threads or fibers, so implementations must protect shared mutable state without relying on thread identity.

Direct Known Subclasses

Tracing::OpenTelemetry

Instance Method Summary collapse

Instance Method Details

#emit(_name, _attributes) ⇒ Object

Called for a point-in-time instrumentation event.



44
45
# File 'lib/little_ghost/instrumentation.rb', line 44

def emit(_name, _attributes) = nil
# Flushes buffered telemetry within an optional timeout budget.

#finish(_name, _attributes) ⇒ Object

Called when a lifecycle operation finishes.



42
43
# File 'lib/little_ghost/instrumentation.rb', line 42

def finish(_name, _attributes) = nil
# Called for a point-in-time instrumentation event.

#flush(timeout: nil) ⇒ Object

Flushes buffered telemetry within an optional timeout budget.



46
47
# File 'lib/little_ghost/instrumentation.rb', line 46

def flush(timeout: nil) = nil
# Releases subscriber resources within an optional timeout budget.

#shutdown(timeout: nil) ⇒ Object

Releases subscriber resources within an optional timeout budget.



48
49
# File 'lib/little_ghost/instrumentation.rb', line 48

def shutdown(timeout: nil) = nil
# Supplies trace fields that should travel with downstream work.

#start(_name, _attributes) ⇒ Object

Called when a lifecycle operation starts.



40
41
# File 'lib/little_ghost/instrumentation.rb', line 40

def start(_name, _attributes) = nil
# Called when a lifecycle operation finishes.

#trace_contextObject

Supplies trace fields that should travel with downstream work.



50
# File 'lib/little_ghost/instrumentation.rb', line 50

def trace_context(**) = {}