D
Datadog
Outputs & exporters availableShip metrics to the Datadog API over HTTPS, batched with retries.
$ loadr plugin install datadog
# Stream loadr's live metrics into Datadog, driven by the `loadr-plugin-datadog`
# native OUTPUT plugin.
#
# An output plugin follows the same start / on_snapshot / finish lifecycle as
# the built-in exporters: loadr calls `start(config)` once, hands the plugin a
# metric snapshot roughly once a second during the run, then `finish(summary)`
# at the end. This plugin turns each snapshot's series into Datadog v2 series
# points, buffers them, and POSTs them in batches to
# `https://api.<site>/api/v2/series` authenticated with a `DD-API-KEY` header.
# The transport is pure hyper + hyper-rustls — no Datadog agent, no dd-trace —
# so nothing beyond an API key and outbound HTTPS is required.
#
# Metrics arrive prefixed (default `loadr.`), e.g. `loadr.http_reqs` (count),
# `loadr.vus` (gauge), `loadr.checks` (rate) and `loadr.http_req_duration.p95`
# (gauge), tagged with each series' tags plus any global `tags` below.
#
# Build + install the plugin, then run:
# cargo build -p loadr-plugin-datadog --release
# mkdir -p dist && cp plugins/loadr-plugin-datadog/plugin.toml dist/ \
# && cp target/release/libloadr_plugin_datadog.so dist/
# loadr plugin install dist
# DD_API_KEY=xxxxxxxx loadr run examples/plugins/datadog.yaml
name: datadog-export
description: Export live loadr metrics to the Datadog v2 series API
defaults:
http:
base_url: https://api.example.com
scenarios:
browse:
executor: ramping-vus
stages:
- { target: 20, duration: 30s }
- { target: 20, duration: 2m }
- { target: 0, duration: 30s }
flow:
- request: { name: list, url: /api/v1/items }
- request:
name: detail
url: /api/v1/items/1
checks: [ { type: status, equals: 200 } ]
outputs:
# Resolve `datadog` by name from the plugins dir (after `loadr plugin install`).
- type: plugin
name: datadog
config:
# Required. Supplied per run from the environment, never committed.
api_key: ${env.DD_API_KEY}
# Datadog site: `datadoghq.com` (default), `datadoghq.eu`, `us3.datadoghq.com`, ...
# The endpoint is `https://api.<site>/api/v2/series`. Set `url` to point at
# an internal proxy instead.
site: datadoghq.com
# Metric-name prefix prepended to every loadr metric.
prefix: loadr.
# Global tags added to every series (array of `key:value`, or a map).
tags: [ "env:staging", "service:checkout", "test:datadog-export" ]
# Flush when this many series accumulate, or every `flush_interval_secs`.
batch_size: 1000
flush_interval_secs: 10
# Per-request timeout and 5xx retry budget (exponential backoff).
timeout_ms: 10000
max_retries: 3
thresholds:
http_req_failed: [ "rate<0.02" ]
http_req_duration: [ "p(95)<600" ]
A real run: install from the signed index, then watch the plugin work.
A runtime plugin, never in the binary
Installing pulls a per-platform driver from the signed index, verifies its SHA-256 and checks its ABI before it ever loads. Remove it any time with loadr plugin remove datadog.