Skip to main content

Datadog Backend

Uses the Datadog Logs API v2 for logs, Metrics API v1 for time series, and APM Traces API v2 for distributed tracing.

TINKR_BACKEND=datadog

Authentication

Datadog requires two keys:

  • API key (DD_API_KEY) — identifies your organization; used for all API calls
  • Application key (DD_APP_KEY) — grants read access to your Datadog account data

Both must be present for Tinkr to function.

Store them in your cloud secrets manager (AWS Secrets Manager, GCP Secret Manager, or Azure Key Vault) and inject as environment variables. Never hardcode them.


Environment variables

VariableRequiredDescription
DD_API_KEYYesDatadog API key
DD_APP_KEYYesDatadog application key
DD_SITENoDatadog site (default: datadoghq.com; EU: datadoghq.eu)

Profile configuration

~/.tinkr/config.toml
[profiles.datadog-prod]
backend = "datadog"
site = "datadoghq.com"
~/.tinkr/.env
DD_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
DD_APP_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Log query

Tinkr calls the Datadog Logs API v2 (POST /api/v2/logs/events/search):

{
"filter": {
"query": "service:payments-api status:error",
"from": "now-1h",
"to": "now"
},
"sort": "-timestamp",
"page": { "limit": 100 }
}

The service name is matched using the service tag. Ensure your application sets the DD_SERVICE environment variable or service tag.


Metrics

Tinkr calls the Datadog Metrics API v1 (GET /api/v1/query):

q=avg:trace.web.request{service:payments-api}.as_count()&from=...&to=...

Common Datadog metrics:

MetricDescription
trace.web.requestHTTP request count
trace.web.request.durationRequest duration
trace.web.request.errorsRequest error count
aws.ecs.cpuutilizationECS container CPU
aws.ecs.memory_utilizationECS container memory
system.cpu.userHost CPU
system.mem.usedHost memory

Distributed tracing (APM)

Tinkr calls the Datadog APM Traces API v2 (POST /api/v2/spans/events/search):

{
"filter": {
"query": "@service:payments-api",
"from": "now-1h",
"to": "now"
}
}

APM must be enabled in your application. Use the Datadog APM library (ddtrace) or the OpenTelemetry SDK with the Datadog exporter.

# Python
pip install ddtrace
ddtrace-run python app.py

# Node.js
DD_TRACE_ENABLED=true node app.js

Traces are automatically correlated with logs when DD_LOGS_INJECTION=true is set.


Datadog site

RegionDD_SITE
US1 (default)datadoghq.com
EUdatadoghq.eu
US3us3.datadoghq.com
US5us5.datadoghq.com
AP1ap1.datadoghq.com
Govddog-gov.com

Local development

export TINKR_BACKEND=datadog
export DD_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export DD_APP_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
uv run tinkr-server