datadog_client

Types

HTTP host for the Datadog API. Default datadoghq.com (US1). Use datadoghq.eu, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, etc.

pub type Client {
  Client(api_key: String, site: String)
}

Constructors

  • Client(api_key: String, site: String)

Failure modes returned by send.

pub type SendError {
  HttpError(String)
  ApiError(status: Int, body: String)
}

Constructors

  • HttpError(String)

    Transport-level failure (DNS, TCP, TLS, etc.).

  • ApiError(status: Int, body: String)

    Datadog returned a non-2xx status.

Values

pub fn new(api_key: String) -> Client

Build a client for the default site (datadoghq.com).

pub fn send(
  client: Client,
  metrics: List(metric.Metric),
) -> Result(response.Response(String), SendError)

POST one or more metrics to /api/v1/series. Erlang target.

pub fn send_one(
  client: Client,
  m: metric.Metric,
) -> Result(response.Response(String), SendError)

Send a single metric. Convenience over send. Erlang target.

pub fn to_request(
  client: Client,
  metrics: List(metric.Metric),
) -> request.Request(String)

Build the HTTPS request body for /api/v1/series without sending it. Use this if you want to send via your own HTTP backend.

pub fn with_site(client: Client, to site: String) -> Client

Override the Datadog site (e.g. "datadoghq.eu").

Search Document