[BUG] clickhouse: FORMAT substring check, envelope fallback and swallowed errors
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
- Domain
- databases
Research direction
Start in clickhouse/src/model/click-house-client.ts at the FORMAT check, response parsing, and non-OK response handling. Trace the callers that discard status and inspect buildTimeSeries() to understand how non-array responses become empty series. Done means trailing FORMAT clauses are handled correctly, malformed envelopes do not become empty data, and query errors are visible to the panel.
Written by the indexing model from the issue text.
Description
Summary
Three related problems in clickhouse/src/model/click-house-client.ts make the plugin either send a malformed request or fail silently, so the panel shows an empty chart with no reason.
1. The FORMAT detection is a substring test on the whole query
clickhouse/src/model/click-house-client.ts:60-62
let finalQuery = replaceTimeRangePlaceholders(params.query.trim(), params.start, params.end);
if (!finalQuery.toUpperCase().includes('FORMAT')) {
finalQuery += ' FORMAT JSON';
}
includes('FORMAT') matches anywhere, not just as a trailing ClickHouse format clause. The query is then fetched with Accept unspecified and parsed with response.json() (line 86), so any of the following end in the catch at line 92 → ClickHouse query failed:
- a column, alias or CTE named
format(SELECT format, count() ...), IF(x, 'format', 'other')/position(haystack, 'FORMAT')/ any string literal containing the word,- a real clause that is not the last token, e.g.
SELECT ... FORMAT Prettyused deliberately.
A trailing check (/FORMAT\s*\w*$/i, or always appending when the query does not end with one) would be enough.
2. A response without a data field degrades to a silent empty chart
const body = await response.json();
return { status: 'success', data: body.data || body };
When body.data is undefined the whole ClickHouse envelope (meta, rows, statistics, …) is returned instead of an array. buildTimeSeries() then does Object.keys(data[0] ?? {}), gets [], and returns an empty series list — indistinguishable from a genuinely empty result.
3. Errors are indistinguishable from "no data"
if (!response.ok) {
console.error('ClickHouse error response:', errorText);
return { status: 'error', data: [] };
}
The status is dropped by every caller, and ClickHouseQueryResponse.warnings? is never populated. A 500, a bad FORMAT, a permission error and an empty result all render as the same neutral "No data available" with nothing in the panel, the console being the only trace. Surfacing the message (e.g. via the result metadata, or a thrown error the panel can render) would turn hours of dead-end debugging into a one-line answer.
Environment
@perses-dev/clickhouse-plugin0.6.0and0.7.0-beta.6— identical code.- 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