Docs
Metrics and telemetry ›

Set telemetry

PUT/v1/telemetry

Set the OTLP collector they are sent to.

RequestTypeScript
  1. import { Agental } from "agental-sdk";
  2. const agental = new Agental();
  3. await agental.setTelemetry({ endpoint: "https://otlp.example.com" });
Answer200 OK
  1. {
  2. "telemetry": {
  3. "endpoint": string,
  4. "headers": string[],
  5. "lastExportAt": string | null,
  6. "lastError": object | null,
  7. "createdAt": string,
  8. "updatedAt": string,
  9. },
  10. }

The collector is set, or replaced.

Headers

Authorizationrequired
Bearer key
An API key that may make this call.

Body

endpointrequired
string
The collector's base address: https:// on port 443 or 4318, on the public internet. A trailing /v1/metrics or /v1/logs is taken off. Redirects are not followed. e.g. "https://otlp.datadoghq.com"
headers
object
Headers sent with each export, such as the collector's API key: at most 20. Their values are kept and never shown again. e.g. {"dd-api-key":"<DATADOG_API_KEY>"}

Returns

200 The collector is set, or replaced. Nothing is sent to it now: POST /v1/telemetry/test does that. From the next whole minute it is sent the sandboxes' metrics every minute, and each lifecycle event as it happens, and nothing from before. After it was down it is sent the metrics of the last 10 minutes and the events of the last 24 hours that it missed.

JSON1 field
telemetry
Telemetry6 fields
endpoint
string
The collector's OTLP/HTTP base address.
More Metrics are POSTed to <endpoint>/v1/metrics and events to <endpoint>/v1/logs.
headers
string[]
The names of the headers sent with each export.
More Their values are never shown.
lastExportAt
stringnull
When the collector last took the metrics.
More Null until it has.
lastError
objectnull3 fields
The last thing that went wrong in sending metrics or events, or a part the collector did not take.
More Null until something has.
message
string
status
integernull
What the collector answered, or null where it did not answer or nothing was sent.
at
string
createdAt
string
updatedAt
string

Errors and other answers

400invalid_request the endpoint is not https on port 443 or 4318, is not on the public internet, or holds a user name, a query or a fragment; or a header cannot be sent.
403role_required in a team, only an owner or an admin sets its collector.
501telemetry_unavailable nothing is sent to a collector here. GET /v1/policy says so as telemetry.

Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.