Client and status¶
Datadog has no health or version endpoint, so health(), ping() and validateApiKey() all use
GET https://api.<site>/api/v1/validate with the API key; serverVersion() is UNSUPPORTED.
See also Client for the lifecycle rules.
| Function | Request | Result | Errors |
|---|---|---|---|
fromEnv() |
— | client | CONFIG (no API key, unknown site, invalid value) |
health() |
GET /api/v1/validate |
HealthStatus: 2xx ok; 401/403 unauthorized (healthy=false); 429 degraded; 5xx unhealthy; network unreachable |
only CANCELLED, CONFIG |
ping() |
GET /api/v1/validate |
latency | 403 → AUTHENTICATION; 2xx without {"valid": true} → UNAVAILABLE |
validateApiKey() |
GET /api/v1/validate |
true / false (403) |
other failures as mapped errors |
serverVersion() |
none | — | always UNSUPPORTED |
close() |
flushes log clients | — | never; later calls raise CANCELLED |
Check the key¶
const client = DatadogLogsClient.fromEnv();
const health = await client.health(); // { healthy, status, details: { apiKeyValid } }
if (!(await client.validateApiKey())) throw new Error("check DD_API_KEY and DD_SITE");
console.log(await client.ping(), "ms");
await client.serverVersion().catch((e) => console.log(e.code)); // "UNSUPPORTED"
Sites and tags¶
The site resolver maps a site to its two base URLs and parseTags applies the DD_TAGS rules
(comma and/or whitespace separated, duplicates dropped).
| Language | Site resolver | Tags |
|---|---|---|
| TypeScript | resolveSite("datadoghq.eu") → { site, intakeUrl, apiUrl }, DATADOG_SITES, isDatadogSite |
parseTags("a:1, b:2") |
| Rust | resolve_site("datadoghq.eu")? → SiteEndpoints |
parse_tags("a:1, b:2") |
| Go | datadoglogs.ResolveSite("datadoghq.eu"), datadoglogs.Sites |
datadoglogs.ParseTags("a:1, b:2") |
| Python | resolve_site("datadoghq.eu") |
parse_tags("a:1, b:2") |
| Java | DatadogSites.resolve("datadoghq.eu") |
DatadogLogsConfig.parseTags("a:1, b:2") |