CoollZzz opened a new pull request, #126:
URL: https://github.com/apache/iotdb-extras/pull/126
## Description
This change adds native IoTDB table-model support for Grafana template
variables and enables dynamic node discovery for IoTDB dashboards.
### Changes
- Added support for variable queries using the following format:
```text
table:<database>:<SQL>
- Executes table-model variable queries through the IoTDB native RPC client.
- Keeps existing legacy variable-query behavior unchanged.
- Adds validation for:
- missing database names;
- missing SQL statements;
- invalid query formats;
- multi-column query results;
- IoTDB query execution failures.
- Converts the single-column IoTDB result into the string array expected by
Grafana variables.
- Skips NULL variable values and preserves the returned order.
- Adds support for the $__activeFrom macro.
- Uses a five-minute active-node window so that:
- nodes with recent samples appear dynamically;
- nodes that stop reporting disappear after the TTL expires;
- historical IoTDB samples are not deleted.
- Adds injectable execution and clock hooks to make the table-variable
behavior testable without a live IoTDB server.
Files Changed
- connectors/grafana-plugin/pkg/plugin/iotdb_resource_handler.go
- connectors/grafana-plugin/pkg/plugin/plugin.go
- connectors/grafana-plugin/pkg/plugin/table_query.go
- connectors/grafana-plugin/pkg/plugin/table_variable_test.go
Validation
The following cases are covered by tests:
- parsing valid table:<database>:<SQL> queries;
- rejecting malformed table-model variable queries;
- executing table-model variable queries;
- preserving variable values and order;
- skipping NULL values;
- coercing non-string values;
- rejecting multi-column results;
- propagating IoTDB execution errors;
- expanding $__activeFrom into the calculated liveness-window timestamp;
- handling dynamic instance discovery through the IoTDB validation database.
This change only modifies the Grafana IoTDB plugin variable-query path.
Prometheus dashboards, IoTDB dashboard JSON files, and bridge SQL conversion
logic are not included in this change.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]