Skip to content

feat(runpanelquery): run Infinity panels through /api/ds/query - #1345

Open
arunms-ziwo wants to merge 2 commits into
grafana:mainfrom
arunms-ziwo:feat/run-panel-query-infinity
Open

arunms-ziwo wants to merge 2 commits into
grafana:mainfrom
arunms-ziwo:feat/run-panel-query-infinity

Conversation

@arunms-ziwo

Copy link
Copy Markdown

What

run_panel_query now executes panels on the Infinity datasource (yesoreyeram-infinity-datasource). Infinity targets are structured (url, root_selector, parser, headers, inline data) and the plugin backend runs them for the backend parsers, so the target is sent to /api/ds/query as saved, with template variables substituted in every string field, the same way CloudWatch panels are executed. Panels using the default simple parser (browser-side) are refused with a message naming the parser to change; backend, uql, groq and jq-backend are accepted.

  • normalizeDatasourceType maps the plugin ID to infinity.
  • extractPanelInfo accepts an empty query expression for structured targets (CloudWatch and Infinity share one helper).
  • executeInfinityPanelQuery, routed from the datasource switch; empty-result hints for the URL and root_selector.
  • Tool description and README mention Infinity with a backend parser.

Why

Dashboards that read inventory or CMDB systems (NetBox and similar JSON APIs) through Infinity could not be executed with variable overrides; the tool answered "datasource type is not supported by run_panel_query".

Tiering

No new tool or parameter: one more datasource type behind the existing run_panel_query, gated by the same runpanelquery category. The tool description grows by a few words.

Tests

Unit tests (//go:build unit) for type normalisation, target extraction, the /api/ds/query payload (datasource, parser, substituted url and root_selector, time range), the parser gate and a nil target. go vet, gofmt, make lint-jsonschema lint-openapi and go test -tags unit ./tools pass locally.

run_panel_query rejected panels on the Infinity datasource
(yesoreyeram-infinity-datasource) with "datasource type is not supported",
so dashboards that read inventory systems such as NetBox over its JSON API
could not be executed with variable overrides.

Infinity queries are structured targets (url, root_selector, parser,
headers, inline data), not string expressions, and the plugin backend runs
them when the parser is backend, uql, groq or jq-backend. The target is
sent to /api/ds/query as saved, with template variables substituted in
every string field, the same way CloudWatch panels are executed. The
default "simple" parser parses in the browser, so those panels are refused
with a message naming the parser to change.

- normalizeDatasourceType maps the plugin ID to "infinity".
- extractPanelInfo accepts an empty query expression for structured
  targets (CloudWatch and Infinity).
- executeInfinityPanelQuery, routed from the datasource switch; empty-result
  hints for the URL and root_selector.
- Unit tests for the normalisation, target extraction, the /api/ds/query
  payload (datasource, parser, substituted url and root_selector, time
  range) and the parser gate.
@arunms-ziwo
arunms-ziwo requested a review from a team as a code owner October 16, 2026 13:10
@cla-assistant

cla-assistant Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit db1dc92. Configure here.

Comment thread tools/run_panel_query.go
Comment thread tools/run_panel_query.go Outdated
Review findings on the Infinity support:

- Only "backend" and "jq-backend" run inside the Infinity plugin backend
  (its isBackendQuery); UQL and GROQ transform the response in the
  browser, so they are refused like the default "simple" parser instead of
  returning untransformed data.
- extractPanelInfoV2 accepted an empty query expression for CloudWatch
  only, so a v2 Infinity panel failed before reaching the executor; it now
  uses the shared usesStructuredTarget check. Test added for the v2 path.
@arunms-ziwo

Copy link
Copy Markdown
Author

Both Bugbot findings addressed in the follow-up commit: the parser gate now accepts only backend and jq-backend (matching the plugin's isBackendQuery), refusing UQL and GROQ like simple; extractPanelInfoV2 uses the shared usesStructuredTarget check so v2 Infinity panels reach the executor, with a test for the v2 path.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant