Metrics and telemetry ›
Set telemetry
PUT
/v1/telemetrySet the OTLP collector they are sent to.
RequestTypeScript
- import { Agental } from "agental-sdk";
- const agental = new Agental();
- await agental.setTelemetry({ endpoint: "https://otlp.example.com" });
Answer200 OK
- {
- "telemetry": {
- "endpoint": string,
- "headers": string[],
- "lastExportAt": string | null,
- "lastError": object | null,
- "createdAt": string,
- "updatedAt": string,
- },
- }
The collector is set, or replaced.
Headers
AuthorizationrequiredBearer key | An API key that may make this call. |
Body
endpointrequiredstring | 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" |
headersobject | 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
telemetryTelemetry6 fields
endpointstring
The collector's OTLP/HTTP base address.
More
Metrics are POSTed to <endpoint>/v1/metrics and events to <endpoint>/v1/logs.headersstring[]
The names of the headers sent with each export.
More
Their values are never shown.lastExportAtstringnull
When the collector last took the metrics.
More
Null until it has.lastErrorobjectnull3 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.messagestring
statusintegernull
What the collector answered, or null where it did not answer or nothing was sent.
atstring
createdAtstring
updatedAtstring
Errors and other answers
| 400 | invalid_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. |
| 403 | role_required in a team, only an owner or an admin sets its collector. |
| 501 | telemetry_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.