Spandex v1.6.0 Spandex.Tracer behaviour View Source

A module that can be used to build your own tracer.

Example:

defmodule MyApp.Tracer do
  use Spandex.Tracer, otp_app: :my_app
end

Link to this section Summary

Functions

A schema for the opts that a tracer accepts

Link to this section Types

Link to this type span_name() View Source
span_name() :: String.t
Link to this type tagged_tuple(arg) View Source
tagged_tuple(arg) :: {:ok, arg} | {:error, term}

Link to this section Functions

A schema for the opts that a tracer accepts.


Opts

  • adapter(:atom) Required: The third party adapter to use
  • disabled?(:boolean): Allows for wholesale disabling a tracer - Default: false
  • strategy(:atom): The storage and tracing strategy. Currently only supports local process dictionary. - Default: Spandex.Strategy.Pdict
  • sender(:atom): Once a trace is complete, it is sent using this module. Defaults to the default_sender/0 of the selected adapter
  • tracer(:atom): Don’t set manually. This option is passed automatically.

Span Creation

  • service(:atom) Required: The default service name to use for spans declared without a service
  • env(:string): A name used to identify the environment name, e.g prod or development - Default: “unknown”
  • services([{:keyword, :atom}, :keyword]): A mapping of service name to the default span types. For instance datadog knows about :db, :cache and :web - Default: []
  • id(:any)
  • trace_id(:any)
  • name(:string)
  • http([:keyword, {:struct, Spandex.Span.Http}])
  • error([:keyword, {:struct, Spandex.Span.Error}])
  • completion_time(:any)
  • parent_id(:any)
  • resource([:atom, :string])
  • sql_query([:keyword, {:struct, Spandex.Span.SqlQuery}])
  • start(:any)
  • type(:atom)
  • tags(:keyword) - Default: []

All tracer functions that take opts use this schema. This also accepts defaults for any value that can be given to a span.

Link to this section Callbacks

Link to this callback configure(opts) View Source
configure(opts) :: :ok
Link to this callback continue_trace(span_name, trace_id, span_id, opts) View Source
continue_trace(span_name, trace_id :: term, span_id :: term, opts) :: tagged_tuple(Spandex.Trace.t)
Link to this callback continue_trace_from_span(span_name, span, opts) View Source
continue_trace_from_span(span_name, span :: term, opts) :: tagged_tuple(Spandex.Trace.t)
Link to this callback current_span(opts) View Source
current_span(opts) :: nil | Spandex.Span.t
Link to this callback current_span_id(opts) View Source
current_span_id(opts) :: nil | term
Link to this callback current_trace_id(opts) View Source
current_trace_id(opts) :: nil | term
Link to this callback distributed_context(arg0, opts) View Source
distributed_context(Plug.Conn.t, opts) :: tagged_tuple(map)
Link to this macro callback span(span_name, opts, list) View Source
span(term, span_name, opts, [{:do, Macro.t}]) :: Macro.t
Link to this callback span_error(error, opts) View Source
span_error(error :: Exception.t, opts) :: tagged_tuple(Spandex.Span.t)
Link to this macro callback trace(span_name, opts, list) View Source
trace(term, span_name, opts, [{:do, Macro.t}]) :: Macro.t
Link to this callback update_top_span(opts) View Source
update_top_span(opts) :: tagged_tuple(Spandex.Span.t)