Grafana
GreptimeDB can be configured as a Grafana data source. You have the option to connect GreptimeDB with Grafana using one of three data sources: GreptimeDB, Prometheus, or MySQL.
GreptimeDB data source plugin
The GreptimeDB data source plugin is tailored for GreptimeDB: it provides better GreptimeDB SQL query support, plus Logs and Traces query types with OpenTelemetry presets and configurable column mappings. It is modified from the ClickHouse data source plugin.
Installation
The plugin is not published in the Grafana plugin catalog, so install the unsigned archive and
allow it explicitly in grafana.ini:
[plugins]
allow_loading_unsigned_plugins = info8fcc-greptimedb-datasource
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS is the equivalent environment variable. Grafana Cloud
does not accept unsigned plugins, so use a self-hosted Grafana. If you need a signed build bound to
your own Grafana root_url, contact us.
Make sure Grafana is installed and running before installing the plugin.
You can choose one of the following installation methods:
- Download
info8fcc-greptimedb-datasource-unsigned.zipfrom the release page and unzip it to your grafana plugin directory. - Use grafana cli to download and install:
grafana cli --pluginUrl https://github.com/GreptimeTeam/greptimedb-grafana-datasource/releases/latest/download/info8fcc-greptimedb-datasource-unsigned.zip plugins install info8fcc - Use our prebuilt Grafana docker
image, which ships the
plugin by default:
docker run -p 3000:3000 greptime/grafana-greptimedb:latest
Note that you may need to restart your grafana server after installing the plugin.
Connection settings
Fill in the following URL in the GreptimeDB server URL:
http://<host>:4000
In the Auth section, click basic auth, and fill in the username and password for GreptimeDB in the Basic Auth Details section (not set by default, no need to fill in).
- User:
<username> - Password:
<password>
Then click the Save & Test button to test the connection.
General Settings
Before selecting any query type, you first need to configure the Database and Table to query from.
| Setting | Description |
|---|---|
| Database | Select the database. |
| Table | Set the table. |
Every Builder panel automatically includes a Within Dashboard Time Range
filter. This generates $__timeFilter("col") in the SQL, which the plugin
expands to the dashboard's current time range.

Table Query
Choose the Table query type when your query results do not include a time column. Suitable for displaying tabular data.
| Setting | Description |
|---|---|
| Columns | Select the columns you want to retrieve. Multiple selections are allowed. |
| Filters | Set conditions to filter your data. |

Time Series Query
Select the Time Series query type when your query includes a time column and
numerical values. Ideal for visualizing metrics over time.
Time bucketing with date_bin
For aggregating metrics over a time range, use date_bin to downsample time
series data: it calculates time intervals and returns the start of the interval
nearest to each timestamp, so rows are grouped into time-based bins (windows).
Apply an aggregate or selector function to each window.
Example (or raw SQL):
SELECT date_bin('$__interval', timestamp) AS time,
SUM(`span_attributes.gen_ai.usage.input_tokens`) AS input_tokens
FROM opentelemetry_traces
WHERE $__timeFilter(timestamp)
GROUP BY time
ORDER BY time;
$__interval follows the Grafana panel interval; $__timeFilter limits the
dashboard time range. See SQL Macros for more macros.
| Setting | Description |
|---|---|
| Time | Select the time column. |
| Columns | Select label columns (e.g. host, region). |
| Aggregate functions | AVG / MAX / MIN / SUM / COUNT on value columns. |
| Group By | Select columns to group by. |
| Filters | Optional conditions: =, !=, >, <, LIKE, IN, IS NULL, AND/OR. |

Multi-Frame Splitting
When the query result contains time + string + number fields, the plugin automatically splits the long table into multiple frames — one per unique label combination. Grafana renders each frame as a separate series in the chart.
For example, GROUP BY host with three hosts produces three frames (host-a,
host-b, host-c), each with its own label and color.
To avoid splitting, use the Table query type instead.
Logs Query
Choose the Logs query type for log data.
| Setting | Description |
|---|---|
| Time | Select the timestamp column. |
| Message | Select the column containing the log content. |
| Log Level | (Optional) Select the column for log severity. |
| Context Columns | Extra columns shown when you expand a log line (from data source config). |

Full-text search: use matches_term(body, 'keyword') for exact
term/phrase matching.
Logs Context Query
Performs an approximate time range query based on the value of context columns in a log row.
- First, set the context column in Connection Page.

- Then, when making a query, include the context column in the query.

Traces Query
Select the Traces query type for distributed tracing data.
| Main Setting | Description |
|---|---|
| Trace Model | Select Trace Search to query a list of traces. |
| Trace Id Column | Default value: trace_id |
| Span Id Column | Default value: span_id |
| Parent Span ID Column | Default value: parent_span_id |
| Service Name Column | Default value: service_name |
| Operation Name Column | Default value: span_name |
| Start Time Column | Default value: timestamp |
| Duration Time Column | Default value: duration_nano |
| Duration Unit | Default value: nanoseconds |
| Tags Column | Multiple selections allowed. Corresponds to columns starting with span_attributes (e.g., span_attributes.http.method). |
| Service Tags Column | Multiple selections allowed. Corresponds to columns starting with resource_attributes (e.g., resource_attributes.host.name). |

Attribute Auto-Discovery
When the Trace ID query uses SELECT *, the plugin automatically discovers
all columns starting with span_attributes. and resource_attributes. and
includes them as expandable tags in the waterfall view. No need to manually
enumerate every attribute column.