# Class LittleGhost::Instrumentation::Subscriber

Documentation version: Edge

Canonical HTML: https://littleghostai.org/docs/LittleGhost/Instrumentation/Subscriber.html

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.

## Inheritance

`LittleGhost::Instrumentation::Subscriber < Object`

## Instance methods

<a id="method-i-emit"></a>
### `#emit`

```ruby
#emit(_name, _attributes)
```

Called for a point-in-time instrumentation event.

<a id="method-i-finish"></a>
### `#finish`

```ruby
#finish(_name, _attributes)
```

Called when a lifecycle operation finishes.

<a id="method-i-flush"></a>
### `#flush`

```ruby
#flush(timeout: nil)
```

Flushes buffered telemetry within an optional timeout budget.

<a id="method-i-shutdown"></a>
### `#shutdown`

```ruby
#shutdown(timeout: nil)
```

Releases subscriber resources within an optional timeout budget.

<a id="method-i-start"></a>
### `#start`

```ruby
#start(_name, _attributes)
```

Called when a lifecycle operation starts.

<a id="method-i-trace_context"></a>
### `#trace_context`

```ruby
#trace_context(**)
```

Supplies trace fields that should travel with downstream work.
