Repository navigation
[Feature request] Grafana plugin: no table model support and poor tree model UX — needs overhaul | Grafana #18258
Description
Activity
I'd like to take this on.
It spans the frontend, the Go backend, and the REST layer, so I'd approach it incrementally:
- Table model support first — a tree/table switch in QueryEditor, a database → table → column browser, and standard SQL against table-model data, reusing IoTDB's existing SQL query interface where possible rather than adding new REST endpoints.
- Tree-model UX next — a visual Query Builder with the raw SQL editor kept as the advanced mode, path-picker performance (caching / batch loading / search), and syncing the aggregate function list.
- Modernization alongside — Grafana plugin SDK upgrade and the Go backend cleanup (
ioutil, error handling, thevaluescontract).
I'd start with a focused, independently-reviewable PR for table-model querying, then iterate. Happy to adjust the sequencing if you'd prefer a different starting point.
Can grafana plugin use https://github.com/apache/iotdb-client-go instead of REST api to connect the IoTDB? I just think the proformance of the native client is more powerful. @CritasWang
Status update, since this has been assigned to me and the thread has not been told what landed.
On the native-client suggestion. Adopted, and it is in the merged code — thanks @HTHou for raising it originally. The table-model path in iotdb-extras#114 goes through
apache/iotdb-client-gov2 (v2.0.8) over the native protocol rather than REST. That PR merged on 2026-07-23.What is delivered. Table-model querying: a mode selector, raw SQL with a database field, native-client execution, and both time-series and table result formats, with the row/column contract pinned by tests against a real server.
What is not. Three things, and I would rather be explicit than let this look further along than it is:
- The database → table → column browser is not built. Table mode currently takes SQL, not a guided selection, so the discoverability half of Problem 1 is still open.
- The tree-model UX section (2.1–2.6) is untouched. The stale aggregate list this issue quotes is still exactly that array on master.
- Modernization is partial. iotdb-extras#118 moves the frontend off the archived
@grafana/toolkitto@grafana/create-plugin, which is one of the three bullets under item 3 and only its frontend half. That PR is open and currently has review comments to address.
So of the three top-level asks here, roughly half of one is done. I do not think this should be closed.
Proposed order -- this is my plan unless the maintainers would rather reprioritise: finish #118, then the DB→table→column browser (it is the piece that makes table mode usable without knowing the schema), then the tree-model UX items, which are the largest and least entangled with the rest.
I also owe this thread a screenshot of the plugin running against a real Grafana rather than only test output; I will attach that on #118.
Search before asking
Motivation
Background
The current IoTDB Grafana data source plugin (in
iotdb-extras/connectors/grafana-plugin) only supports the tree model. Since IoTDB 2.0 introduced the table model, the plugin has fallen behind. Even for tree-model users, the UX is rough compared to other Grafana data source plugins.Problem 1: No table model support
The plugin has zero awareness of the table model:
SQL: Full Customized(manual SQL) andSQL: Drop-down List(hierarchical tree path picker). Both are hardwired to theroot.path system. There is no database/table/column browser for the table model./grafana/v1/query/expression,/grafana/v1/variable,/grafana/v1/node. ThegetNodeshandler (used by the Drop-down List picker) traversesroot.-prefixed hierarchical paths, which has no equivalent in the table model's flat two-dimensional structure.Problem 2: Poor tree-model UX
2.1 "SQL: Full Customized" mode is too raw
It's essentially four text boxes (SELECT / FROM / WHERE / CONTROL). Users must manually type IoTDB-specific SQL syntax. For Grafana operators unfamiliar with IoTDB SQL, the barrier is high and the error rate is high.
2.2 Drop-down List path picker is slow and unintuitive
The TIME-SERIES picker expands each level via a separate HTTP call to
/grafana/v1/node. With a large number of time series, every level expansion stalls on a network round-trip, and the nested-dropdown UX makes it hard to locate a target series quickly.2.3 Missing modern Query Builder experience
Compared to other data source plugins (Prometheus, InfluxDB, MySQL, etc.), the IoTDB plugin lacks:
2.4 Go backend tech debt
ioutil.ReadAllvaluesas[]interface{}requiring type-guessing (recoverType), making the data contract fragile2.5 Stale aggregate function list
The dropdown in QueryEditor lists
SUM, COUNT, AVG, EXTREME, MAX_VALUE, MIN_VALUE, FIRST_VALUE, LAST_VALUE, MAX_TIME, MIN_TIME, which may not cover all built-in aggregate functions available in newer IoTDB versions.2.6 Limited template variable support
Variable values rely on executing SQL via
/grafana/v1/variable— they must be queryable from IoTDB. Static variable types like constants or custom lists require workarounds.What we'd like to see
Table model support
SELECT ... FROM database.table WHERE ...)Tree model UX overhaul
Codebase modernization
Related repos
Plugin code lives at apache/iotdb-extras under
connectors/grafana-plugin/. The three REST endpoints it calls (/grafana/v1/*) live in this repository's REST module.背景
当前 IoTDB Grafana 数据源插件(位于
iotdb-extras/connectors/grafana-plugin)仅支持树模型。IoTDB 2.0 引入表模型后,插件已明显滞后。即便是树模型用户,与其他 Grafana 数据源插件相比,使用体验也较差。问题 1:完全不支持表模型
插件对表模型完全无感知:
root.路径体系,没有数据库/表/列的浏览器。/grafana/v1/query/expression、/grafana/v1/variable、/grafana/v1/node。getNodes处理器(供下拉选择器使用)遍历root.前缀的层级路径,表模型的平面二维结构没有对等物。问题 2:树模型使用体验较差
2.1 「SQL: Full Customized」模式过于原始
本质是四个文本框(SELECT / FROM / WHERE / CONTROL),用户需手动输入 IoTDB 特有 SQL 语法。对不熟悉 IoTDB SQL 的 Grafana 运维人员来说门槛高、出错率高。
2.2 下拉列表选择路径慢且不直观
TIME-SERIES 选择器每展开一级需调用一次
/grafana/v1/node。序列数量大时,每次展开都要等待网络往返,且嵌套下拉的交互难以快速定位目标序列。2.3 缺乏现代化的 Query Builder 体验
相比其他数据源插件(Prometheus、InfluxDB、MySQL 等),IoTDB 插件缺少:
2.4 Go 后端技术债务
ioutil.ReadAllvalues使用[]interface{}靠类型猜测(recoverType),数据契约不严格2.5 聚合函数列表陈旧
QueryEditor 中的聚合函数下拉列表为
SUM, COUNT, AVG, EXTREME, MAX_VALUE, MIN_VALUE, FIRST_VALUE, LAST_VALUE, MAX_TIME, MIN_TIME,可能未覆盖新版 IoTDB 的全部内置聚合函数。2.6 模板变量支持有限
变量值依赖
/grafana/v1/variable执行 SQL 查询获取——值必须能从 IoTDB 查到。常量或自定义列表等静态变量类型需要变通方案。期望改进
新增表模型支持
优化树模型使用体验
代码现代化
相关仓库
插件代码位于 apache/iotdb-extras 的
connectors/grafana-plugin/目录。插件调用的三个 REST 端点(/grafana/v1/*)位于本仓库的 REST 模块。Solution
No response
Alternatives
No response
Are you willing to submit a PR?