Reference
Datasource discovery
The datasource discovery endpoints of the HTTP API.
GET /datasources/{uid}/schema
Read the tables, or the columns of one table, of a ClickHouse, Elasticsearch or OpenSearch datasource, or the services and span names of Tempo.
It runs the same code, validation and limits as the agent’s get_schema tool. Without table it lists the tables; with table it lists that table’s columns with their types, and offset pages on from a next_offset. A Tempo datasource has no tables: it answers the services, span names and attribute names it holds, and a request with table or offset is a 400. Prometheus and Loki datasources answer 400 invalid_request; their label names are read with the labels route. An unknown datasource is a 404 not_found. Any query parameter not listed below, or one given twice, is a 400.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
uid (required) |
path | string |
|
table |
query | string |
The table whose columns to list. |
offset |
query | integer |
How many items to skip, from a previous answer’s next_offset. |
Responses
| Status | Description | Body |
|---|---|---|
200 |
One page of tables, or of columns, or the Tempo services and span names. | DatasourceTables or DatasourceColumns or DatasourceSpanSchema |
400 |
The request is malformed or fails validation. | Error |
401 |
Authentication is missing or invalid. | Error |
404 |
The resource does not exist, or the caller cannot see it; the two are never told apart. | Error |
422 |
The query or its variables cannot run, or its result exceeds a limit. | Error |
429 |
The caller already has the maximum number of query requests in flight, or the server’s shared upstream call slots stayed busy for 5 seconds. | Error |
500 |
The server failed to handle the request. | Error |
502 |
The datasource is unavailable. | Error |
504 |
The datasource did not answer within the query timeout. | Error |
GET /datasources/{uid}/sample
Read a few rows of a ClickHouse table, or a few log lines or documents of a Loki, Elasticsearch or OpenSearch datasource.
It runs the same code, validation and limits as the agent’s sample_rows tool. table is required on ClickHouse; on Loki it is an optional stream selector, and Elasticsearch and OpenSearch read their index pattern without it. Cell values are cut to 300 bytes, and truncated is true when columns, cells or rows were dropped to fit. Any query parameter not listed below, or one given twice, is a 400.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
uid (required) |
path | string |
|
table |
query | string |
|
limit |
query | integer |
Maximum rows to return. Between 1 and 20. Default 5. |
Responses
| Status | Description | Body |
|---|---|---|
200 |
Up to limit rows with their column names. |
DatasourceSample |
400 |
The request is malformed or fails validation. | Error |
401 |
Authentication is missing or invalid. | Error |
404 |
The resource does not exist, or the caller cannot see it; the two are never told apart. | Error |
422 |
The query or its variables cannot run, or its result exceeds a limit. | Error |
429 |
The caller already has the maximum number of query requests in flight, or the server’s shared upstream call slots stayed busy for 5 seconds. | Error |
500 |
The server failed to handle the request. | Error |
502 |
The datasource is unavailable. | Error |
504 |
The datasource did not answer within the query timeout. | Error |
Generated from api/openapi.yaml at c770e5e0. Report a problem.