spandex_datadog v0.1.0 SpandexDatadog.ApiServer

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

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor

Builds server state

Send spans asynchronously to DataDog

Starts genserver with given options

Link to this section Types

Link to this type t()
t() :: %SpandexDatadog.ApiServer{
  agent_pid: term(),
  asynchronous_send?: term(),
  batch_size: term(),
  host: term(),
  http: term(),
  port: term(),
  sync_threshold: term(),
  url: term(),
  verbose?: term(),
  waiting_traces: term()
}

Link to this section Functions

Link to this function child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function format(span)
format(Spandex.Span.t()) :: map()
Link to this function init(opts)
init(opts :: Keyword.t()) :: {:ok, t()}

Builds server state.

Link to this function send_and_log(traces, state)
send_and_log(traces :: [[map()]], any()) :: :ok
Link to this function send_spans(spans, opts \\ [])
send_spans(spans :: [map()], Keyword.t()) :: :ok

Send spans asynchronously to DataDog.

Link to this function start_link(opts)
start_link(opts :: Keyword.t()) :: GenServer.on_start()

Starts genserver with given options.


Opts

  • http(:atom) Required: The HTTP module to use for sending spans to the agent. Currently only HTTPoison has been tested
  • host(:string): The host the agent can be reached at - Default: “localhost”
  • port([:integer, :string]): The port to use when sending traces to the agent - Default: 8126
  • verbose?(:boolean): Only to be used for debugging: All finished traces will be logged - Default: false
  • batch_size(:integer): The number of traces that should be sent in a single batch - Default: 10
  • sync_threshold(:integer): The maximum number of processes that may be sending traces at any one time. This adds backpressure - Default: 20
  • api_adapter(:atom): Which api adapter to use. Currently only used for testing - Default: SpandexDatadog.ApiServer