@grow-codes/datadog-logs - v0.1.1
    Preparing search index...

    Class DatadogLogsClient

    Client for Datadog Log Management: API key checks, the logs intake (logClient, exporter) and the query API (query, needs appKey).

    const client = DatadogLogsClient.fromEnv();
    const logs = client.logClient({ resource: { "service.name": "checkout" } });
    logs.logger().info("user signed in", { user: { id: 42 } });
    await client.close();
    Index

    The immutable configuration.

    • Flushes and closes every log client, then releases connections. Idempotent.

      Returns Promise<void>

    • Reachability through GET /api/v1/validate (Datadog has no health endpoint). 2xx → healthy (details.apiKeyValid); 401/403 → healthy=false, status="unauthorized"; 429 → degraded; 5xx → unhealthy; network errors → unreachable. Never throws except CANCELLED (also on a closed client) / CONFIG.

      Parameters

      Returns Promise<HealthStatus>

    • Authenticated round trip GET /api/v1/validate; returns the latency in milliseconds. 403 → AuthenticationError; a 2xx without {"valid": true} → UnavailableError.

      Parameters

      Returns Promise<number>

    • Datadog is a SaaS without a version endpoint: always throws UnsupportedError.

      Parameters

      Returns Promise<string>

    • Whether the API key is valid (GET /api/v1/validate): true for {"valid": true}, false for 403. Other failures throw the mapped error.

      Parameters

      Returns Promise<boolean>