Dashboards
Build Grafana dashboards to explore logs, traces, and metrics stored in a VeloDB Cloud warehouse. Grafana uses a MySQL data source to query the telemetry tables. The data path is:
Applications / infrastructure -> OpenTelemetry Collector with Doris exporter
-> VeloDB Cloud warehouse <- Grafana MySQL data source
Prerequisites
Before you start:
- Deploy the Collector and Grafana and verify that telemetry reaches the warehouse. See Quick Start.
- Configure the receivers for the data you want to visualize. The OTLP demo does not automatically populate host, JVM, Kubernetes, Nginx, or PostgreSQL monitoring data.
- Have a warehouse SQL user with read access to the telemetry tables. Use a read-only account for Grafana.
- Make sure Grafana can reach the warehouse MySQL endpoint and meet its TLS requirements. Copy the host and port from Connect in the VeloDB Cloud console. See Connection Methods.
If you have not configured a data source:
- In Grafana, click Connections > Data sources > Add data source.
- Select MySQL.
- Enter the warehouse MySQL host and port, the telemetry database (
otelin this guide), and the read-only SQL credentials. Configure the TLS options required by the warehouse. - Click Save & test to confirm the connection.
The demo names this data source Doris. That name identifies the integration, while the connection points to VeloDB Cloud. The examples below use the otel database and the exporter's default table names. Adjust them if your configuration uses different names.

Import prebuilt dashboards
The AIObserve Stack dashboard directory provides dashboard JSON files for common observability scenarios. Check the directory in your repository revision for the available files:
| Dashboard | File | What it monitors |
|---|---|---|
| Host Metrics | host_metrics_dashboard.json | CPU, memory, disk, network, system load |
| JVM Monitoring | jvm_metrics_dashboard.json | Heap memory, GC, threads, CPU utilization |
| K8s Observability | k8s_kubelet_dashboard.json | Pod / Node / Namespace resource usage |
| Nginx Logs | nginx_logs_dashboard.json | Requests, status codes, top URLs, error logs |
| PostgreSQL Metrics | postgresql-metrics-dashboard.json | Connections, transactions, DB size, Checkpoint, BGWriter |
To import a prebuilt dashboard:
-
In Grafana's left-side menu, click Dashboards > New > Import.
-
Click Upload dashboard JSON file and choose the JSON file under
grafana-dashboard/. -
On the import page, select your warehouse MySQL data source.
-
Click Import.
-
Repeat these steps for other dashboards whose collectors you have configured.
Once imported, variable selectors such as service and namespace query their candidate values from the warehouse. Empty selectors usually mean that the required receiver has not populated the expected metrics, the schema differs, or the selected time range contains no data.
Per-dashboard panel details
Host Metrics Dashboard
- Overview: CPU usage, memory usage, 1-minute load, root disk usage
- CPU: usage trend, usage by Mode
- Memory: memory details (Total / Available / Free / Cached / Buffers), usage trend
- System Load: 1 / 5 / 15-minute load, open file descriptors
- Disk: disk space usage table, read/write throughput
- Network: ingress/egress traffic, errors and packet drops

JVM Monitoring Dashboard
- Overview: heap usage, Full GC count, CPU usage, thread count
- Memory: heap and non-heap trends, with details for Old Gen, Eden, and Survivor pools
- GC: time (Young / Old) and counts
- Thread & CPU: thread count trend, CPU utilization

K8s Observability Dashboard
- Pods: CPU (millicores), memory, Limit utilization, status table (with restart count and uptime)
- Nodes: CPU / memory trends, status table
- Namespaces: CPU / memory aggregates, status table

Nginx Logs Dashboard
- Overview: requests, errors, 5xx / 4xx stats, status-code pie chart
- Trends: request volume / error log trends
- Analysis: Top URL, Top IP, HTTP method distribution, top error messages
- Recent Logs: access / error log details

PostgreSQL Metrics Dashboard
- Connections: active connections (split by database), max connections
- Transactions: commit rate, rollback count
- Storage: database size (split by database), number of databases, number of tables
- BGWriter: checkpoint count (scheduled / requested), buffer writes, BGWriter time

Data model
The Doris exporter stores each telemetry signal and metric type in a separate table. Query the table that contains the signal you need.
Tables
A SQL metric query needs both a table and a metric-name predicate:
| Table | Content | Value field | Query approach |
|---|---|---|---|
otel_metrics_gauge | Instantaneous metrics | value | Aggregate directly, e.g. AVG(value) |
otel_metrics_sum | Sum metrics | value, is_monotonic, aggregation_temporality | Choose rate or interval aggregation according to temporality |
otel_metrics_histogram | Histogram | count, sum, bucket_counts | Interpret counts and sums according to temporality |
otel_logs | Logs | body, severity_text | COUNT aggregation or detail queries |
otel_traces | Traces | duration, span_name | Sort or aggregate by duration |
To determine which table holds a metric, replace <metric-name> with its name and run:
SELECT 'gauge' AS type, metric_name
FROM otel.otel_metrics_gauge
WHERE metric_name = '<metric-name>'
GROUP BY metric_name
UNION ALL
SELECT 'sum', metric_name
FROM otel.otel_metrics_sum
WHERE metric_name = '<metric-name>'
GROUP BY metric_name
UNION ALL
SELECT 'histogram', metric_name
FROM otel.otel_metrics_histogram
WHERE metric_name = '<metric-name>'
GROUP BY metric_name;
To browse all available metrics, run the following on each table:
SELECT DISTINCT metric_name FROM otel.otel_metrics_gauge ORDER BY metric_name;
Attribute fields
OpenTelemetry attributes are stored in different VARIANT columns according to their scope. Use bracket syntax to extract a key:
| Table | Field | Content | Example |
|---|---|---|---|
| metrics | attributes | Metric dimensions (Prometheus labels) | attributes['mode'] |
| metrics | resource_attributes | Resource info (K8s pod/node, etc.) | resource_attributes['k8s.pod.name'] |
| logs | log_attributes | Log fields | log_attributes['status'] |
| traces | span_attributes | Span fields | span_attributes['http.method'] |
service_name and service_instance_id are top-level columns in the metrics schema shown here. Use them directly, for example, WHERE service_name = 'checkout'. Inspect your schema before copying queries from a different exporter version.
Cast extracted attributes to the SQL type required by the expression, especially for grouping, window partitions, and string operations:
-- Extract a value in SELECT
CAST(attributes['device'] AS VARCHAR) AS device
-- Pattern match in WHERE
CAST(attributes['device'] AS VARCHAR) NOT LIKE 'veth%'
-- Numeric comparison in WHERE
CAST(log_attributes['status'] AS INT) >= 500
-- Use in GROUP BY
GROUP BY CAST(resource_attributes['k8s.pod.name'] AS VARCHAR)
For simple equality predicates, an attribute can also be compared directly:
WHERE attributes['mode'] = 'idle'
Note:
A missing key inside a
VARIANTvalue returnsNULL. An unknown top-level column, such aslog_attributesin a metrics table without that column, causes a column-resolution error. Inspect both the table schema and attribute keys when troubleshooting.
Counter metrics and rate calculation
Gauge values describe measurements at a point in time. Choose an aggregation that matches the measurement, such as AVG(value) for average utilization.
A sum metric can be cumulative or delta, and can be monotonic or non-monotonic. Do not assume that every row in otel_metrics_sum is a cumulative counter. Inspect the metric metadata first:
SELECT metric_name, aggregation_temporality, is_monotonic
FROM otel.otel_metrics_sum
WHERE metric_name = '<metric-name>'
GROUP BY metric_name, aggregation_temporality, is_monotonic;
Replace <metric-name> with your metric. Use the following rules:
| Metric semantics | Calculation |
|---|---|
| Monotonic cumulative sum | Subtract successive samples in the same series, then divide by elapsed time for a per-second rate. Handle resets and duplicate timestamps. |
| Delta sum | Each sample already represents an interval. Aggregate intervals or divide by the corresponding interval length. Do not subtract successive delta values. |
| Non-monotonic sum | Values may decrease. Choose an aggregation that matches the metric definition. |
| Cumulative histogram | Subtract matching series' cumulative counts, sums, and buckets before calculating interval statistics. |
For a cumulative counter, LAG() can calculate a rate from adjacent samples. This is a sample-to-sample calculation, without Prometheus rate() extrapolation. The first sample in a query window has no preceding sample, and the examples below return NULL across a counter reset.
A series must keep its source identity and every attribute that distinguishes it from another series. For example:
| Scenario | Series dimensions to preserve |
|---|---|
| CPU time | Service, instance, CPU, and mode |
| Disk or network bytes | Service, instance, and device, plus any other labels emitted by the source |
| Garbage collection time | Service, instance, and garbage collector name |
Filtering to one host does not remove the need to separate devices, CPUs, or other dimensions on that host. The counter panel example shows this for a network metric.
Create a custom dashboard
Add panels for gauge metrics, cumulative counters, single values, and log records, then use variables to filter the dashboard.
Add a gauge metric panel
Create a time series panel for the k8s.pod.cpu.usage gauge. This metric requires a Kubernetes receiver configuration that collects pod CPU usage. Confirm that the metric and attributes exist in your tables first.
-
In Grafana's left-side menu, click Dashboards > New > New dashboard.
-
Click Add visualization.
-
Choose your warehouse MySQL data source.
-
Switch the query editor to Code mode.
Build the query in the following stages.
Write the base query. To monitor pod CPU, use the metric name k8s.pod.cpu.usage. It is a Gauge metric stored in otel_metrics_gauge, where value can be aggregated directly:
SELECT timestamp, value
FROM otel.otel_metrics_gauge
WHERE metric_name = 'k8s.pod.cpu.usage'
Add time filtering. Use either the time-filter macro or the dashboard time variables in SQL:
-- Option A: use the $__timeFilter macro (recommended)
WHERE metric_name = 'k8s.pod.cpu.usage'
AND $__timeFilter(timestamp)
-- Option B: use dashboard time variables
WHERE metric_name = 'k8s.pod.cpu.usage'
AND timestamp >= FROM_UNIXTIME($__from/1000)
AND timestamp < FROM_UNIXTIME($__to/1000)
$__from and $__to are millisecond timestamps. Divide by 1000 before using them in FROM_UNIXTIME().
Add time bucketing. To reduce the number of displayed points, aggregate them at a fixed interval. Use FLOOR(UNIX_TIMESTAMP(timestamp) / N) * N to round time to N-second buckets:
SELECT
FLOOR(UNIX_TIMESTAMP(timestamp) / 20) * 20 AS time,
AVG(value) AS value
FROM otel.otel_metrics_gauge
WHERE metric_name = 'k8s.pod.cpu.usage'
AND timestamp >= FROM_UNIXTIME($__from/1000)
AND timestamp < FROM_UNIXTIME($__to/1000)
GROUP BY time
ORDER BY time
Split into multiple series by dimension. The following examples use Grafana's three-column time series format:
| Column | Purpose |
|---|---|
time or time_sec | X-axis time. Either a datetime value or a UNIX timestamp in seconds. |
metric | Series name. Grafana splits into multiple lines by distinct values of this column. |
value | Y-axis value. |
Combine namespace and pod name in metric to keep equally named pods in different namespaces separate. If you collect multiple Kubernetes clusters, also filter to one cluster or include cluster identity in the series:
SELECT
FLOOR(UNIX_TIMESTAMP(timestamp) / 20) * 20 AS time,
CONCAT(
CAST(resource_attributes['k8s.namespace.name'] AS VARCHAR), '/',
CAST(resource_attributes['k8s.pod.name'] AS VARCHAR)
) AS metric,
AVG(value) AS value
FROM otel.otel_metrics_gauge
WHERE metric_name = 'k8s.pod.cpu.usage'
AND timestamp >= FROM_UNIXTIME($__from/1000)
AND timestamp < FROM_UNIXTIME($__to/1000)
GROUP BY time, metric
ORDER BY time
To monitor a different Gauge metric, change:
metric_name: the target metric name.- The
metriccolumn: the dimension used to split series, chosen fromattributesorresource_attributes.
-
Paste the complete SQL into the query editor.
-
Below the editor, set Format to Time series.
-
Set a panel title.
-
In Standard options > Unit, choose the unit reported by the metric.
-
Apply or save the panel using the action in your Grafana version.
Add a counter metric panel
For a monotonic cumulative counter, calculate a rate using the rules in Counter metrics and rate calculation. Confirm the metric temporality before using this query.
- On the dashboard, click Add > Visualization.
- Choose the data source and switch to Code mode.
The following example computes the receive byte rate for node_network_receive_bytes_total. It separates services, instances, and devices. It assumes these fields identify a series in your data. If the source emits other distinguishing attributes, include them in both window partitions and the displayed series name.
SELECT
t.timestamp AS time,
CONCAT(t.service_name, '/', t.service_instance_id, '/', t.device) AS metric,
CASE
WHEN UNIX_TIMESTAMP(t.timestamp) > UNIX_TIMESTAMP(t.prev_ts)
AND t.value >= t.prev_value
THEN (t.value - t.prev_value) / (UNIX_TIMESTAMP(t.timestamp) - UNIX_TIMESTAMP(t.prev_ts))
ELSE NULL
END AS value
FROM (
SELECT timestamp, service_name, service_instance_id,
CAST(attributes['device'] AS VARCHAR) AS device, value,
LAG(value) OVER (PARTITION BY service_name, service_instance_id,
CAST(attributes['device'] AS VARCHAR) ORDER BY timestamp) AS prev_value,
LAG(timestamp) OVER (PARTITION BY service_name, service_instance_id,
CAST(attributes['device'] AS VARCHAR) ORDER BY timestamp) AS prev_ts
FROM otel.otel_metrics_sum
WHERE metric_name = 'node_network_receive_bytes_total'
AND $__timeFilter(timestamp)
) t
WHERE t.prev_ts IS NOT NULL
ORDER BY time
To adapt the query:
- Change
metric_nameto the target metric name. - Keep the complete series identity in
PARTITION BYand the displayed series name. - Verify that
is_monotonicis true and the source exports cumulative values.
Paste the query, select Time series as the format, choose the metric unit, and save the panel.
Add a Stat panel
A Stat panel can show a single value such as available memory for one host. The query below selects the latest sample for a specific service instance. Replace <service-instance-id> with the target instance.
- Click Add > Visualization and switch to Code mode.
The following query gets the latest metric value within the time range:
SELECT value
FROM otel.otel_metrics_gauge
WHERE metric_name = 'node_memory_MemAvailable_bytes'
AND service_instance_id = '<service-instance-id>'
AND $__timeFilter(timestamp)
ORDER BY timestamp DESC
LIMIT 1
To combine multiple metrics, see Optimization tips.
- Paste the SQL and set Format to Table (Stat panels use Table format).
- In the right-side panel settings, change the panel type to Stat.
- In Standard options > Unit, choose an appropriate unit.
- Click Apply.
Add a Table panel
A table panel displays multiple rows and columns. SQL column aliases become the column headers.
- Click Add > Visualization and switch to Code mode.
The following query shows recent log details:
SELECT
timestamp,
service_name,
severity_text,
body,
CAST(log_attributes['your_key'] AS VARCHAR) AS your_key
FROM otel.otel_logs
WHERE $__timeFilter(timestamp)
ORDER BY timestamp DESC
LIMIT 100
Replace your_key with the actual log attribute field name. To see the available attributes, run:
SELECT log_attributes FROM otel.otel_logs LIMIT 1;
- Paste the SQL and set Format to Table.
- Click Apply.
Add template variables
Template variables add interactive dropdown filters to a dashboard, letting users filter data without modifying the SQL.
Create a single-select variable
-
Open the dashboard settings, then select Variables > New variable.
-
Set Name to
service_name, Type to Query, and Data source to your warehouse data source. -
Enter the following query and save the variable:
SELECT DISTINCT service_nameFROM otel.otel_metrics_gaugeWHERE service_name != ''AND service_name IS NOT NULLAND $__timeFilter(timestamp)ORDER BY service_name;
In a panel's SQL, use Grafana's sqlstring formatter to quote the selected value:
AND service_name = ${service_name:sqlstring}
Create a multi-select variable
-
Create a query variable named
namespace. -
Enable Multi-value and Include All option. Leave the custom all value empty so Grafana expands the list of available values.
-
Enter this query and save the variable:
SELECT DISTINCTCAST(resource_attributes['k8s.namespace.name'] AS VARCHAR) AS __textFROM otel.otel_metrics_gaugeWHERE metric_name = 'k8s.pod.phase'AND $__timeFilter(timestamp)ORDER BY 1;
The __text alias controls the displayed dropdown text. Use IN with the sqlstring formatter in panel queries:
AND CAST(resource_attributes['k8s.namespace.name'] AS VARCHAR)
IN (${namespace:sqlstring})
Do not add another pair of quotes around ${namespace:sqlstring}. It expands to a comma-separated list of quoted values.
Create a cascading variable
To make pod choices depend on the selected namespace, create a pod query variable using:
SELECT DISTINCT
CAST(resource_attributes['k8s.pod.name'] AS VARCHAR) AS __text
FROM otel.otel_metrics_gauge
WHERE metric_name = 'k8s.pod.phase'
AND $__timeFilter(timestamp)
AND CAST(resource_attributes['k8s.namespace.name'] AS VARCHAR)
IN (${namespace:sqlstring})
ORDER BY 1;
Set time-dependent variables to refresh when the time range changes. If a dropdown is empty, check the metric name, resource attribute keys, and dashboard time range.
Optimization tips
The following are common optimization techniques used in the prebuilt dashboards.
Adjust the time-bucket interval. Choose a bucket size that matches the time range. Modify N in FLOOR(UNIX_TIMESTAMP(timestamp) / N) * N:
- 20 seconds: suited to short-window real-time monitoring.
- 60 seconds: suited to hour-level overviews.
- 300 seconds: suited to day-level trends.
Set meaningful series names. Use CONCAT() to combine multiple fields:
CONCAT(device, ' read') AS metric
Use CASE WHEN to map numeric values to readable text:
CASE WHEN value = 2 THEN 'Running'
WHEN value = 1 THEN 'Pending'
WHEN value = 3 THEN 'Succeeded'
WHEN value = 4 THEN 'Failed'
ELSE 'Unknown'
END AS status
Handle divide-by-zero and NULLs. Use NULLIF to guard against divide-by-zero and COALESCE to provide default values:
/ NULLIF(SUM(...), 0)
COALESCE(restarts, 0)
Query multiple metrics in one SQL. For metrics sampled at matching timestamps, conditional aggregation can combine values without a join. The following query assumes service_instance_id identifies each host. Filter or include additional identity columns if needed:
SELECT timestamp AS time, service_instance_id,
SUM(CASE WHEN metric_name = 'node_memory_MemAvailable_bytes' THEN value END) AS available,
SUM(CASE WHEN metric_name = 'node_memory_MemTotal_bytes' THEN value END) AS total
FROM otel.otel_metrics_gauge
WHERE metric_name IN ('node_memory_MemTotal_bytes', 'node_memory_MemAvailable_bytes')
AND $__timeFilter(timestamp)
GROUP BY timestamp, service_instance_id
ORDER BY time;
Filter out noise data. Exclude virtual network interfaces:
AND CAST(attributes['device'] AS VARCHAR) NOT LIKE 'veth%'
AND CAST(attributes['device'] AS VARCHAR) NOT LIKE 'br-%'
AND CAST(attributes['device'] AS VARCHAR) != 'lo'
Keep only real filesystems:
AND CAST(attributes['fstype'] AS VARCHAR) IN ('ext4', 'xfs', 'btrfs')
Reference
OTel table schema
The fields below describe the schema used by the examples. Exporter versions and custom table definitions can differ. Run DESCRIBE otel.otel_metrics_sum, DESCRIBE otel.otel_logs, or DESCRIBE otel.otel_traces in the warehouse to inspect the actual schema.
Metrics tables (gauge, sum, and histogram shared fields)
| Field | Type | Description |
|---|---|---|
service_name | varchar(200) | Service name |
timestamp | datetime(6) | Data timestamp |
service_instance_id | varchar(200) | Service instance ID |
metric_name | varchar(200) | Metric name |
metric_description | string | Metric description |
metric_unit | text | Metric unit |
attributes | variant (JSON) | Metric dimensions |
resource_attributes | variant (JSON) | Resource attributes |
scope_name | text | Instrumentation scope name |
gauge-only field: value (double)
sum extra fields: value (double), aggregation_temporality (text), is_monotonic (boolean)
histogram extra fields: count (bigint), sum (double), bucket_counts (array<bigint>), explicit_bounds (array<double>), min (double), max (double)
Logs table
| Field | Type | Description |
|---|---|---|
timestamp | datetime(6) | Log timestamp |
service_name | varchar(200) | Service name |
service_instance_id | varchar(200) | Service instance ID |
trace_id | varchar(200) | Associated trace ID |
span_id | text | Associated span ID |
severity_number | int | Severity number |
severity_text | text | Severity text (INFO / WARN / ERROR) |
body | text | Log body |
resource_attributes | variant (JSON) | Resource attributes |
log_attributes | variant (JSON) | Log attributes |
Traces table
| Field | Type | Description |
|---|---|---|
timestamp | datetime(6) | Span start time |
service_name | varchar(200) | Service name |
trace_id | varchar(200) | Trace ID |
span_id | text | Span ID |
parent_span_id | text | Parent span ID |
span_name | text | Span name |
span_kind | text | Span kind (CLIENT / SERVER / INTERNAL) |
end_time | datetime(6) | Span end time |
duration | bigint | Duration (nanoseconds) |
span_attributes | variant (JSON) | Span attributes |
events | array | Span events |
links | array | Span links |
status_code | text | Status code (OK / ERROR / UNSET) |
status_message | text | Status message |
resource_attributes | variant (JSON) | Resource attributes |
Syntax cheat sheet
| Purpose | Syntax |
|---|---|
| Time filter (macro) | $__timeFilter(timestamp) |
| Time filter (manual) | timestamp >= FROM_UNIXTIME($__from/1000) |
| Time bucket (20 seconds) | FLOOR(UNIX_TIMESTAMP(timestamp) / 20) * 20 AS time |
| Time bucket (1 minute) | FLOOR(UNIX_TIMESTAMP(timestamp) / 60) * 60 AS time |
| Attribute access | attributes['key'] |
| Attribute CAST | CAST(attributes['key'] AS VARCHAR) |
| Single-select variable | service_name = ${service_name:sqlstring} |
| Multi-select variable | IN (${namespace:sqlstring}) |
| Divide-by-zero guard | / NULLIF(..., 0) |
| Default value | COALESCE(..., 0) |
| Series naming | CONCAT(device, ' read') AS metric |
| Status mapping | CASE WHEN value = 2 THEN 'Running' ... END |
| URL stripping query string | SUBSTRING_INDEX(url, '?', 1) |
| Filter out virtual network cards | NOT LIKE 'veth%' + NOT LIKE 'br-%' + != 'lo' |
Common errors
| Symptom | Check and resolution |
|---|---|
| Data source connection fails | Verify the warehouse endpoint, network path, read privileges, and required TLS settings from the Grafana host. |
| A panel is empty | Widen the time range and inspect the expected table, metric name, and attribute keys. Importing a dashboard does not configure its collectors. |
| Counter rates spike or become negative | Confirm cumulative temporality and monotonicity, preserve full series identity, and handle resets and duplicate timestamps. |
| Time series appears in the wrong period | Grafana's Unix time column uses seconds. Keep milliseconds only for $__from and $__to before conversion, and align Collector, database session, and Grafana timezone settings. |
| Multi-select filters cause SQL errors | Use ${variable:sqlstring} with IN (...) and inspect the expanded SQL in Grafana. |
Query cost and cleanup
Short refresh intervals, long time ranges, and many panels increase warehouse query load. Start with a narrow time range and adjust refresh intervals to your monitoring needs. See Billing.
Remove test dashboards and variables when you finish. Stop demo data producers separately. Deleting a dashboard does not remove the warehouse tables or stop ingestion.