[BUG] clickhouse: queries without a time column render as a single row in Table panels
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- clickhouse, typescript
Research direction
Start in get-click-house-data.ts:26-48 and compare its output with the labels handling in get-click-house-log-data.ts:62. Update the no-timestamp result path so each input row becomes one series with non-numeric labels and a single value, while preserving the stated out-of-scope behavior for rows with several numeric columns.
Written by the indexing model from the issue text.
Description
Summary
ClickHouseTimeSeriesQuery.getTimeSeriesData() assumes every result has a time column. Queries that return no usable timestamp (normal table/aggregate SQL) produce NaN timestamps, and because Table renders one row per series while series is built one per column, a query with N rows renders as 1 row containing only the last value — and without labels, so no identity columns either.
Repro
SELECT repository,
count() AS jobs,
avg(duration_seconds) AS avg_duration
FROM ci_runs
GROUP BY repository
ORDER BY jobs DESC
LIMIT 10
Expected (a Table panel): 10 rows, columns repository, jobs, avg_duration.
Actual: 1 row, column jobs, value = the jobs of the last row of the result.
Cause
get-click-house-data.ts:26-48:
const timestamp = new Date(row.time).getTime(); // row.time is undefined -> NaN
const value = toTimeSeriesValue(row[metricName]);
return [timestamp, value];
metricNames=['repository', 'jobs', 'avg_duration'](onlytimeis excluded — and there is notimehere at all).repository→ every value coerces toNaN→null→ the whole "series" is filtered out at line 47.jobsandavg_durationsurvive as two series, each with 10 points that all sharetimestamp = NaN.labelsis never set on the returned series.
Table.buildRawTableData (Table-0.13.0/lib/table-data-utils.js) then does:
const value = ts.values.at(-1)?.[1]; // -> the LAST row's value only
return { timestamp, [valueColumnName]: value, ...ts.labels }; // ts.labels is undefined
→ one output row per series, one point kept, no identity columns.
Note the log query already returns labels correctly (get-click-house-log-data.ts:62); getTimeSeriesData simply never does.
Expected fix
When the result has no column parseable as a timestamp, treat it as a set of records rather than as a time range:
- emit one series per row,
labels= the non-numeric columns of that row,values = [[0, <value>]](or another sentinel) for the single numeric column.
That matches how Perses' Table consumes TimeSeries (one row per series, columns = labels + value) and is the shape a Prometheus instant query produces.
Out of scope for this issue
Results with several numeric columns per row (a 6-column Grafana table, say Quota, Limits, Requested, Used, Efficiency%) still cannot be expressed by the current Table model, which allows exactly one value column per row (value, or value #N when several query results are joined). Fixing the above makes single-value tables correct; multi-value tables likely need a Table model change and should be discussed separately.
Scope
From a replay of 215 migrated Grafana queries through the plugin's real transport: 30/30 Table queries are affected, 28 of which also collapse a dimension with ≥2 distinct values. Examples: ci-github-actions "By repository" (repository, 27 distinct), k8s-namespace-efficiency (37 distinct).
Environment
@perses-dev/clickhouse-plugin0.6.0and0.7.0-beta.6— identical behaviour.- Perses
0.54.0.
- Dominant language
- TypeScript
- Stars
- 33
- Forks
- 95
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 40
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from perses/plugins
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
-
[Trino] Split long-format results into one series per labelPossibly taken @dougkirkley claimed this 2 days ago. Openenhancement
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
[BUG] splunk: export parsing, job polling and missing values are not handled robustlyPossibly taken @AnKiT-GaRG2 claimed this 22 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
[BUG] clickhouse: getTimeSeriesData drops dimension columns, collapsing long-format results into one seriesPossibly taken @aminadojava claimed this 50 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 58/100
perses/plugins#843 · 1 reaction ·
Maintainers usually reply within 1 day
Similar issues
-
db-d1-sqlite: upsert is aliased to updateOne, so payload.kv.set never inserts new keysPossibly taken @pcbeingused333 claimed this today. OpenBug db: d1-sqlite Payload OSS
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#19766 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
device-management-toolkit/sample-web-ui#3711 ·
Maintainers usually reply within 1 day
-
bug impact:low Team: SecuritySolution Team:Defend Workflows v9.6.0
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
elastic/kibana#306401 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
agentes-chat/agentes-chat#927 ·
Maintainers usually reply within 1 day
-
Closing a pinned tab jumps to the Tabs section instead of the next open pinned tabPossibly taken @seenimohamed claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ardia-browser/ardia#2769 ·
Maintainers usually reply within 1 day