Repository navigation
Description
Follow-ups from reviewing #598 at 042fcd3. None of these block that PR; the first one is the most important.
1. A fresh gallery import can open filtered to empty-session events (important). In dashboards/grafana/gallery/bqaa-dashboard-efficiency-trial.gallery.json the Session variable's current selection is cleared (around line 1846) and its option query (around 1863) can return "". When the selection is unset, Grafana initializes it to "" and keeps it if that matches a returned option, so a single event with an empty session ID (which the SDK writer accepts) narrows the whole dashboard before the viewer picks anything. The trial dashboard explicitly selects All (bqaa-dashboard-efficiency-trial.json around line 323), so the two diverge: with session IDs "", known-1 and known-2, the trial counts 3 events on first load and the gallery counts 1. Suggest excluding "" from the four filter dropdown queries in the trial and regenerating the gallery, while keeping those events in panel queries so All still counts them, plus a first-load regression test with a blank option.
2. Drift tests collapse duplicate entries. tests/test_grafana_gallery_export.py indexes panels by id and variables and __inputs by name (around lines 157-167 and 330) without checking list lengths, so a duplicate inserted before the real entry is silently dropped. A second VAR_PROJECT input or project constant variable carrying a real project ID passes all 46 tests. Asserting raw counts or comparing ordered id/name lists would close it, as the __requires check already does.
3. Constant __inputs are only checked for type and value. Labels (what the import screen shows), descriptions and extra keys aren't pinned (around lines 329-353), so a later export could carry instance-identifying text there. Pinning the full expected dict, like DATASOURCE_INPUT, would cover this.
4. Panel nesting isn't compared. Flattening panels drops parent/child structure, so moving the Trace detail panel under a table panel or into a row still passes, even though viewPanel=19 would then have nothing to open. Comparing a parent map per panel would catch it.
5. JSON booleans compare equal to numbers. The recursive comparison (around line 147) treats true as equal to 1, so changing a target's format from 1 to true, which the BigQuery backend rejects, passes.
6. The hidden-footer allowance drops configuration. _panel_change_allowed (around lines 212-214) lets options.footer disappear from any table with a hidden footer. Panel 22's sum reducer is in fact dropped in the shipped gallery, not moved into field defaults as the comment says. Pinning that one migration exactly would keep further losses from slipping through.
7. The sanitization scan is narrow. test_gallery_holds_no_urls_credentials_or_hosts only blocks http(s)://, email-like strings and localhost, and _datasource_uids only sees dict-form datasource references. A scheme-less internal host, a private IP, or a string-form datasource UID added to both files passes. The shipped file passes stricter checks today.
8. README regeneration steps.
- The steps don't say the exporting instance's data source must be named
BigQuerywith the plugin version fromrun_local.py. With the provideddatasource.example.yamlname, the export comes out asDS_BQAA_BIGQUERYand the gallery tests fail. - The conversion redirects into the gallery file before
jqparses the download, then removes the download unconditionally, so a truncated download leaves an empty gallery file, deletes the input, and still exits 0. Writing to a temporary file and replacing only on success would fix it. - The file table near the top of the README doesn't list the trial dashboard or the gallery export.
9. Older issue, not from #598: the trace link passes the literal session ID as var-session_id, and Grafana treats All there as its select-all token, so a session literally named All opens other sessions' traces. A dedicated exact-session parameter would avoid that.
Related: #598
Activity
caohy1988 commentedon Nov 30, 2026
Follow-ups from #634 (at fc1deb4). None of these block it.
_datasource_refs(aroundtests/test_grafana_gallery_export.py:240) skips anulldatasource. A panel and its target both set to null in both files still pass, even though Grafana would resolve them to the instance default. A legacy"${datasource}"string reference also got through in one check. Inspecting every presentdatasourcekey and requiring an object with an alloweduidwould close both.bq-proxy.analytics.example.co.ukorbq-proxy.analytics.svc, single-label hosts and IPv6 literals. It also flags valid content: a SQL path likeJSON_VALUE(attributes, '$.resource.labels.app')and a description mentioningbuild 12.3.4.1. The committed files scan clean, so this only matters for future edits. Checking decoded string values in context, with a few positive and negative fixtures, would make it sturdier._diff(around line 172) still treats1and1.0as equal. Requiring identical leaf types would also cover the bool special case.jq(exit 0) and replaces the gallery with an empty file. A check that exactly one dashboard object was decoded, withpanelsas an array, before themvwould catch it. Also, a parse error leaves an emptyconverted.jsonbehind. That's harmless since it's gitignored.fix(dashboards): address the #599 Grafana gallery follow-ups (#634)