Grafana

Embed
Preview of the card
<a href="https://forumulate.com/p/watchtower/docs/connectors-grafana"><img src="https://forumulate.com/api/public/orgs/watchtower/spaces/docs/pages/1e2f4979-d751-4be3-885b-8f93b88bdbf2/social-card.svg?v=3e7ae33eec8b" alt="Grafana" width="600" height="315"></a>

Grafana reads one Watchtower project through its built-in Prometheus, Loki and Tempo data sources. There is no Grafana plugin (the language rule keeps TypeScript to the web app and the browser SDK); the compatible read APIs below are the integration.

Credentials

Create a project API key with query:read (wtk_...). Grafana can send it either way:

  • Bearer: add the custom HTTP header Authorization = Bearer wtk_....

  • Basic auth: turn on Basic auth; the user is anything, the password is the wtk_... key.

Inaccessible projects answer 404. Replace {prj} with the project id and HOST with your Watchtower API host.

Data sources

Type

URL

Notes

Prometheus

https://HOST/v1/projects/{prj}/prometheus

Prometheus type, HTTP method GET.

Loki

https://HOST/v1/projects/{prj}/loki

LogQL subset; unsupported constructs return 422 naming them.

Tempo

https://HOST/v1/projects/{prj}/tempo

Trace by id, search, tags, q TraceQL.

Tempo endpoints

All under /v1/projects/{prj}/tempo:

  • GET /api/traces/{id} and /api/v2/traces/{id}: OTLP JSON by default, OTLP protobuf with Accept: application/protobuf. A short id is left-padded with zeros. Unknown ids give 404. Spans carry no events; at most 10,000 spans are returned.

  • GET /api/search?tags=k%3Dv&minDuration=&maxDuration=&start=&end=&limit=&q=: tags is logfmt (service.name=api http.method="GET"); service.name, name and status map to the span's own fields, resource.<key> to resource attributes, other keys to span attributes. q is TraceQL and cannot be combined with tags or durations (422). start and end are Unix seconds (default last hour); limit 1 to 200 (default 20). Results from q describe the first matched span of each trace.

  • GET /api/search/tags, GET /api/v2/search/tags, GET /api/search/tag/{name}/values, GET /api/v2/search/tag/{name}/values: names and values come from a sample of at most 100,000 spans in the last 24 h (500 names, 100 values at most).

  • GET /api/echo: connection test, returns echo.

Updated