View Source Sibyl.Decorator (Sibyl v0.1.1)
Module encapsulating Sibyl's business logic for decorating functions for automated tracing.
Should be used only via use Sibyl
.
When used like this, provides the ability to decorate your function calls with:
@decorate trace()
to automatically trace a single function's execution, emitting telemetry events for:start
,:end
, and:exception
sub-events.@decorate_all trace()
which does the same as the above, but automatically for all functions in a module.
Automatically traced functions are available for reflection by via Sibyl.Events.reflect/1
.
Link to this section Summary
Functions
Decorator which wraps a given function with a standard telemetry span.
Link to this section Types
@type ast() :: term()
Link to this section Functions
Decorator which wraps a given function with a standard telemetry span.
The name of the captured event will be determined by however Sibyl
is configured
to generate event names.
Due to how anonymous functions are defined and executed in the BEAM, it ends up
being quite a bit more performant to build the span manually rather than using
:telemetry.span/3
.
See here for an example of how to emit the correct events.
See here for explanations w.r.t. anonymous function perf.