SpandexDatadog.ApiServer (spandex_datadog v1.4.0)

Implements worker for sending spans to datadog as GenServer in order to send traces async.

Summary

Functions

Returns a specification to start this module under a supervisor.

Send spans asynchronously to DataDog.

Starts the ApiServer with given options.

Types

@type headers() ::
  [{atom(), binary()}]
  | [{binary(), binary()}]
  | %{required(binary()) => binary()}
  | any()

Functions

Link to this function

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

format(span, priority, baggage)

@spec format(Spandex.Span.t(), integer(), Keyword.t()) :: map()
Link to this function

send_and_log(traces, state)

@spec send_and_log([Spandex.Trace.t()], SpandexDatadog.ApiServer.State.t()) :: :ok
Link to this function

send_trace(trace, opts \\ [])

@spec send_trace(Spandex.Trace.t(), Keyword.t()) :: :ok

Send spans asynchronously to DataDog.

Link to this function

start_link(opts \\ [])

@spec start_link(opts :: Keyword.t()) :: GenServer.on_start()

Starts the ApiServer with given options.

Options

  • :http - The HTTP module to use for sending spans to the agent. Defaults to HTTPoison.
  • :host - The host the agent can be reached at. Defaults to "localhost".
  • :port - The port to use when sending traces to the agent. Defaults to 8126.
  • :verbose? - Only to be used for debugging: All finished traces will be logged. Defaults to false
  • :batch_size - The number of traces that should be sent in a single batch. Defaults to 10.
  • :sync_threshold - The maximum number of processes that may be sending traces at any one time. This adds backpressure. Defaults to 20.
  • :name - The name the GenServer should have. Currently only used for testing. Defaults to SpandexDatadog.ApiServer
  • :trap_exits? - Whether or not to trap exits and attempt to flush traces on shutdown, defaults to false. Useful if you do frequent deploys and you don't want to lose traces each deploy.