Skip to content

Guide: Route traces from the Datadog Agent through Vector to Datadog

neuronull edited this page Mar 1, 2023 · 3 revisions

The below configuration files are an example of routing (only) trace events collected by the Agent, into Vector and exported to the Datadog backend.

There is more than one way to feed traces into the Agent, but the python package ddtrace is one: https://ddtrace.readthedocs.io/en/stable/index.html

Vector configuration:

[sources.source_dd_agent]
type = "datadog_agent"
address = "0.0.0.0:8181"
multiple_outputs = true
store_api_key = false
disable_metrics = true
disable_logs = true


[sinks.sink_dd_traces]
inputs = [ "source_dd_agent.traces" ]
type = "datadog_traces"
default_api_key="${YOUR_API_KEY}"
compression = "none"

Agent configuration:

The limit settings are a there to disable sampling in the Agent, which as of this writing, is required due to a limitation of Vector's routing of APM stats to Datadog.

api_key: <YOUR_API_KEY>

apm_config:

  ## @param apm_non_local_traffic - boolean - optional - default: false
  ## @env DD_APM_NON_LOCAL_TRAFFIC - boolean - optional - default: false
  ## Set to true so the Trace Agent listens for non local traffic,
  ## i.e if Traces are being sent to this Agent from another host/container
  #
  apm_non_local_traffic: true

  ## @param apm_dd_url - string - optional
  ## @env DD_APM_DD_URL - string - optional
  ## Define the endpoint and port to hit when using a proxy for APM. The traces are forwarded in TCP
  ## therefore the proxy must be able to handle TCP connections.
  #
  # apm_dd_url: <ENDPOINT>:<PORT>
  apm_dd_url: http://127.0.0.1:8181

  ## @param max_traces_per_second - integer - optional - default: 10
  ## @env DD_APM_MAX_TPS - integer - optional - default: 10
  ## The target traces per second to sample. Sampling rates to apply are adjusted given
  ## the received traffic and communicated to tracers. This configures head base sampling.
  ## Set to 0 to disable sampling.
  #
  max_traces_per_second: 999999

  ## @param errors_per_second - integer - optional - default: 10
  ## @env DD_APM_ERROR_TPS - integer - optional - default: 10
  ## The target error trace chunks to receive per second. The TPS is spread
  ## to catch all combinations of service, name, resource, http.status, and error.type.
  ## Set to 0 to disable the errors sampler.
  #
  errors_per_second: 9999999

  ## @param max_memory - integer - optional - default: 500000000
  ## @env DD_APM_MAX_MEMORY - integer - optional - default: 500000000
  ## This value is what the Agent aims to use in terms of memory. If surpassed, the API
  ## rate limits incoming requests to aim and stay below this value.
  ## Note: The Agent process is killed if it uses more than 150% of `max_memory`.
  ## Set the `max_memory` parameter to `0` to disable the memory limitation.
  #
  max_memory: 0

  ## @param max_cpu_percent - integer - optional - default: 50
  ## @env DD_APM_MAX_CPU_PERCENT - integer - optional - default: 50
  ## The CPU percentage that the Agent aims to use. If surpassed, the API rate limits
  ## incoming requests to aim and stay below this value. Examples: 50 = half a core, 200 = two cores.
  ## Set `max_cpu_percent` to `0` to disable rate limiting based on CPU usage.
  #
  max_cpu_percent: 0