Telemetria.Backend behaviour (telemetria v0.24.0)

View Source

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

Backend shipped with the library:

Summary

Types

The context of the currently processing block.

The type used for naming blocks / events

The additional attributes of the block, aside from measurements

Callbacks

The implementation will be called when the block gets entered

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

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

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

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

Types

block_context()

@type block_context() :: any()

The context of the currently processing block.

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

block_id()

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

The type used for naming blocks / events

block_metadata()

@type block_metadata() :: map()

The additional attributes of the block, aside from measurements

Callbacks

entry(block_id)

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

The implementation will be called when the block gets entered

exit(block_context)

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

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

reshape(block_metadata)

(optional)
@callback reshape(block_metadata()) :: block_metadata()

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

return(block_context, block_context)

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

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

update(block_context, block_metadata)

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

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