View Source Ash.Tracer behaviour (ash v3.4.22)

A behaviour for implementing tracing for an Ash application.

Summary

Types

@type metadata() :: %{
  domain: nil | module(),
  resource: nil | module(),
  actor: term(),
  tenant: term(),
  action: atom(),
  authorize?: boolean()
}
@type span_type() ::
  :action
  | :changeset
  | :query
  | :flow
  | :calculate
  | :request_step
  | :change
  | :validation
  | :preparation
  | :custom_flow_step
  | :custom
  | :before_transaction
  | :before_action
  | :after_transaction
  | :after_action
  | {:custom, atom()}
@type t() :: module()

Callbacks

@callback get_span_context() :: term()
@callback set_error(Exception.t()) :: :ok
Link to this callback

set_error(t, t)

View Source (optional)
@callback set_error(Exception.t(), Keyword.t()) :: :ok
Link to this callback

set_handled_error(t, t)

View Source (optional)
@callback set_handled_error(Exception.t(), Keyword.t()) :: :ok
Link to this callback

set_metadata(span_type, metadata)

View Source
@callback set_metadata(span_type(), metadata()) :: :ok

Set metadata for the current span.

This may be called multiple times per span, and should ideally merge with previous metadata.

@callback set_span_context(term()) :: :ok
Link to this callback

start_span(span_type, name)

View Source
@callback start_span(span_type(), name :: String.t()) :: :ok
@callback stop_span() :: :ok
Link to this callback

trace_type?(atom)

View Source (optional)
@callback trace_type?(atom()) :: boolean()

Functions

Link to this function

get_span_context(tracer)

View Source
Link to this function

set_error(tracers, error)

View Source
Link to this function

set_error(tracers, error, opts)

View Source
Link to this function

set_handled_error(tracers, error, opts)

View Source
Link to this function

set_metadata(tracers, type, metadata)

View Source
Link to this function

set_span_context(tracer, context)

View Source
Link to this macro

span(type, name, tracer, block_opts \\ [])

View Source (macro)
Link to this function

start_span(tracers, type, name)

View Source
Link to this macro

telemetry_span(name, metadata, opts \\ [], block_opts)

View Source (macro)
Link to this function

trace_type?(tracer, type)

View Source