# `Telemetria.Backend`
[🔗](https://github.com/am-kantox/telemetria/blob/v0.25.0/lib/telemetria/backend.ex#L1)

This behaviour should be implemented by the backend, used for actual
telemetry events processing.

Backend shipped with the library:

- `Telemetria.Backend.Telemetry`
- `Telemetria.Backend.OpenTelemetry`

# `block_context`

```elixir
@type block_context() :: any()
```

The context of the currently processing block.

For instance, `opentelemetry:span_ctx()` for `otel` or `nil` for `telemetry`

# `block_id`

```elixir
@type block_id() :: Telemetria.event_name()
```

The type used for naming blocks / events

# `block_metadata`

```elixir
@type block_metadata() :: map()
```

The additional attributes of the block, aside from measurements

# `entry`

```elixir
@callback entry(block_id()) :: block_context() | [block_context()]
```

The implementation will be called when the block gets entered

# `exit`

```elixir
@callback exit(block_context()) :: :ok
```

The implementation will be called when the block context is to be exited

# `reshape`
*optional* 

```elixir
@callback reshape(block_metadata()) :: block_metadata()
```

The implementation will be called to reshape the event before sending it to the actual handler

# `return`

```elixir
@callback return(block_context(), block_context()) :: block_context() | [block_context()]
```

The implementation will be called when the block gets exited / executed

# `update`

```elixir
@callback update(block_context(), block_metadata()) :: block_context() | [block_context()]
```

The implementation will be called when the block context is to be updated

---

*Consult [api-reference.md](api-reference.md) for complete listing*
