instrument_tracer_nif (instrument v1.0.0)
View SourceNIF module implementing the erl_tracer behavior.
This module provides the callback functions required by erlang:trace/3 when using a custom tracer. The NIF distributes trace events to a pool of worker processes using hash-based assignment on the tracee pid.
Reference: https://www.erlang.org/doc/apps/erts/erl_tracer.html
TracerState is a map containing: - pool_size: number of workers - workers: map of index to worker pid (#{0 => Pid1, 1 => Pid2, ...}) - label: trace label (usually trace_id as integer)
Summary
Functions
Create a new session resource for tracking active tracing sessions. Returns a resource reference that can be included in tracer state. Spawned children inherit this reference via set_on_spawn.
Deactivate a session resource. Called when parent span ends. Children will see the inactive session on their next trace event and return 'remove' to stop tracing.
Check if tracing is enabled for the given tracee. Called before trace/5 to determine if we should trace. Returns: trace | discard | remove
Check if call tracing is enabled.
Check if garbage_collection tracing is enabled.
Check if procs tracing is enabled.
Check if receive tracing is enabled.
Check if running_procs tracing is enabled.
Check if send tracing is enabled.
Check if spawn tracing is enabled.
Handle a trace event. Hashes the tracee pid to select a worker and forwards the event.
Handle a procs trace event.
Handle a receive trace event.
Handle a send trace event.
Handle a spawn trace event.
Functions
-spec create_session_resource() -> reference().
Create a new session resource for tracking active tracing sessions. Returns a resource reference that can be included in tracer state. Spawned children inherit this reference via set_on_spawn.
-spec deactivate_session_resource(reference()) -> ok.
Deactivate a session resource. Called when parent span ends. Children will see the inactive session on their next trace event and return 'remove' to stop tracing.
Check if tracing is enabled for the given tracee. Called before trace/5 to determine if we should trace. Returns: trace | discard | remove
Check if call tracing is enabled.
Check if garbage_collection tracing is enabled.
Check if procs tracing is enabled.
Check if receive tracing is enabled.
Check if running_procs tracing is enabled.
Check if send tracing is enabled.
Check if spawn tracing is enabled.
Handle a trace event. Hashes the tracee pid to select a worker and forwards the event.
Handle a procs trace event.
Handle a receive trace event.
Handle a send trace event.
Handle a spawn trace event.