Search documentation of ash

# View Source Ash.Tracer behaviour (ash v3.4.30)

A behaviour for implementing tracing for an Ash application.

# Summary

## Types

metadata()
span_type()
t()

## Callbacks

get_span_context()
set_error(t)
set_error(t, t)
set_handled_error(t, t)
set_metadata(span_type, metadata)

Set metadata for the current span.

set_span_context(term)
start_span(span_type, name)
stop_span()
trace_type?(atom)

## Functions

get_span_context(tracer)
set_error(tracers, error)
set_error(tracers, error, opts)
set_handled_error(tracers, error, opts)
set_metadata(tracers, type, metadata)
set_span_context(tracer, context)
span(type, name, tracer, block_opts \\ [])
start_span(tracers, type, name)
stop_span(tracers)
telemetry_span(name, metadata, opts \\ [], block_opts)
trace_type?(tracer, type)

# Types

Link to this type

# metadata()

View Source

    @type metadata() :: %{
      domain: nil | module(),
      resource: nil | module(),
      actor: term(),
      tenant: term(),
      action: atom(),
      authorize?: boolean()
    }

Link to this type

# span_type()

View Source

    @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()}

Link to this type

# t()

View Source

    @type t() :: module()

# Callbacks

Link to this callback

# get_span_context()

View Source

    @callback get_span_context() :: term()

Link to this callback

# set_error(t)

View Source (optional)

    @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.

Link to this callback

# set_span_context(term)

View Source

    @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

Link to this callback

# stop_span()

View Source

    @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 function

# stop_span(tracers)

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