Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected error when using $conditionalTest macro #524

Closed
dl-github-reporter opened this issue Mar 4, 2024 · 11 comments · Fixed by #526
Closed

Unexpected error when using $conditionalTest macro #524

dl-github-reporter opened this issue Mar 4, 2024 · 11 comments · Fixed by #526
Assignees
Milestone

Comments

@dl-github-reporter
Copy link

Plugin crashes while start typing macro $conditionalTest in SQL query editor form.

Reproduced on version:

  • self-hosted Grafana v10.3.3
  • vertamedia-clickhouse-datasource v3.0.0

Error log in plugin interface

image

An unexpected error happened
Сведения
[object Object]

    at eval (https://data.mitgo.tech/public/plugins/vertamedia-clickhouse-datasource/module.js?_cache=3.0.0:3:3703346)
    at i (https://data.mitgo.tech/public/build/8378.36d9cd16557e09d3c339.js:1:172)
    at o (https://data.mitgo.tech/public/build/8378.36d9cd16557e09d3c339.js:192:118841)
    at g (https://data.mitgo.tech/public/build/8378.36d9cd16557e09d3c339.js:192:119350)
    at div
    at div
    at div
    at fs (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:124:25127)
    at It (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:187:4993)
    at za (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:124:29667)
    at Rs (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:124:29797)
    at E (https://data.mitgo.tech/public/build/8378.36d9cd16557e09d3c339.js:425:68)
    at div
    at K (https://data.mitgo.tech/public/build/8378.36d9cd16557e09d3c339.js:4108:820)
    at div
    at mu (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:124:30083)
    at It (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:187:4993)
    at y (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:187:2689)
    at Xo (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:124:12772)
    at ft (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:66:950)
    at Oa (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:124:14520)
    at g (https://data.mitgo.tech/public/build/8378.36d9cd16557e09d3c339.js:4109:6041)
    at div
    at div
    at div
    at div
    at div
    at q (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:124:36551)
    at u (https://data.mitgo.tech/public/build/8378.36d9cd16557e09d3c339.js:192:29691)
    at H (https://data.mitgo.tech/public/build/8378.36d9cd16557e09d3c339.js:4114:56)
    at Hs (https://data.mitgo.tech/public/build/DashboardPageProxy.309311965b4cd0612f76.js:315:9492)
    at div
    at r (https://data.mitgo.tech/public/build/8378.36d9cd16557e09d3c339.js:284:49421)
    at div
    at https://data.mitgo.tech/public/build/DashboardPageProxy.309311965b4cd0612f76.js:315:10940
    at div
    at div
    at i (https://data.mitgo.tech/public/build/8474.aca7493112eb29aea9e3.js:1:2301)
    at div
    at i (https://data.mitgo.tech/public/build/8474.aca7493112eb29aea9e3.js:1:4289)
    at _ (https://data.mitgo.tech/public/build/8474.aca7493112eb29aea9e3.js:1:9608)
    at div
    at i (https://data.mitgo.tech/public/build/8474.aca7493112eb29aea9e3.js:1:2301)
    at div
    at i (https://data.mitgo.tech/public/build/8474.aca7493112eb29aea9e3.js:1:4289)
    at _ (https://data.mitgo.tech/public/build/8474.aca7493112eb29aea9e3.js:1:9608)
    at div
    at div
    at div
    at U (https://data.mitgo.tech/public/build/8378.36d9cd16557e09d3c339.js:357:21347)
    at Xs (https://data.mitgo.tech/public/build/DashboardPageProxy.309311965b4cd0612f76.js:332:526)
    at Ut (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:183:66326)
    at WithTheme(Connect(Xs))
    at vn (https://data.mitgo.tech/public/build/DashboardPageProxy.309311965b4cd0612f76.js:407:474)
    at DashboardPage
    at Ut (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:183:66326)
    at So (https://data.mitgo.tech/public/build/DashboardPageProxy.309311965b4cd0612f76.js:407:6597)
    at Suspense
    at o (https://data.mitgo.tech/public/build/8378.36d9cd16557e09d3c339.js:192:118841)
    at Gc (https://data.mitgo.tech/public/build/8378.36d9cd16557e09d3c339.js:5420:9842)
    at ve (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:228:23578)
    at la (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:209:4728)
    at Zn (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:209:10219)
    at el (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:228:11773)
    at ve (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:228:25773)
    at div
    at div
    at main
    at div
    at ag (https://data.mitgo.tech/public/build/8378.36d9cd16557e09d3c339.js:5420:2407)
    at la (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:209:4728)
    at Zn (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:209:10219)
    at _n (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:209:9608)
    at Il (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:228:12072)
    at ve (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:228:19749)
    at div
    at i (https://data.mitgo.tech/public/build/8378.36d9cd16557e09d3c339.js:212:13888)
    at v (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:41:14038)
    at p (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:662:233850)
    at c (https://data.mitgo.tech/public/build/8378.36d9cd16557e09d3c339.js:566:21348)
    at o (https://data.mitgo.tech/public/build/8378.36d9cd16557e09d3c339.js:192:118841)
    at g (https://data.mitgo.tech/public/build/8378.36d9cd16557e09d3c339.js:192:119350)
    at Re (https://data.mitgo.tech/public/build/9733.976a8afd1c8ec137399a.js:187:529)
    at Eu (https://data.mitgo.tech/public/build/8378.36d9cd16557e09d3c339.js:5431:122)

Error log in browser console

image

@dl-github-reporter
Copy link
Author

Current workaround for this problem is downgrade to vertamedia-clickhouse-datasource v2.5.4
$conditionalTest works there

@Slach Slach self-assigned this Mar 5, 2024
@Slach Slach added this to the 3.0.1 milestone Mar 5, 2024
@Slach
Copy link
Collaborator

Slach commented Mar 5, 2024

Could you provide ogirinal SQL query which you tried to use with $conditionalTest macro?

And maybe CREATE TABLE statements
and panel JSON for reproduce?

@dl-github-reporter
Copy link
Author

dl-github-reporter commented Mar 6, 2024

@Slach it is business dashboard with financial data under NDA.
Will try to reproduce error in other dashboard and send required query and JSON, if succeed.

@dl-github-reporter
Copy link
Author

@Slach reproduced this error locally in other dashboard based on system.query_log table

ClickHouse Loading Stats.json

Error occurres during editing query in SQL query editor

For example

SELECT
    $timeSeries as t,
    if(initial_user='', 'unknown', initial_user) as user,
    count() as queries
FROM clusterAllReplicas(clickhouse_cluster, $table)

WHERE $timeFilter
    and query_kind = 'Select'
    and type in ('QueryFinish','ExceptionWhileProcessing')

GROUP BY t,user

ORDER BY t, queries desc

image

image

@Slach
Copy link
Collaborator

Slach commented Mar 6, 2024

shared query is not contains $conditionalTest
only screenshot
which query exactly did you try?

SELECT
    $timeSeries as t,
    if(initial_user='', 'unknown', initial_user) as user,
    count() as queries,
    $conditionalTest(what here?)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FROM clusterAllReplicas(clickhouse_cluster, $table)

WHERE $timeFilter
    and query_kind = 'Select'
    and type in ('QueryFinish','ExceptionWhileProcessing')

GROUP BY t,user

ORDER BY t, queries desc

@Slach
Copy link
Collaborator

Slach commented Mar 7, 2024

ok. found it in shared JSON, thank for sharing, we will try to reproduce and fix it

@Slach
Copy link
Collaborator

Slach commented Mar 7, 2024

ClickHouse.Loading.Stats.json
@lunaticusgreen could you look and try to reproduce?

@dl-github-reporter
Copy link
Author

which query exactly did you try?

Doesn't matter, error occurs when I add new $conditionalTest in any query.
On the screen was an example of query I started editing.

JS code crashed right in the moment I ended typing $conditionalTest

@dl-github-reporter
Copy link
Author

@Slach @lunaticusgreen

error_screencast.webm

@isaacd9
Copy link

isaacd9 commented Mar 18, 2024

I'm experiencing the same

@Slach Slach mentioned this issue Mar 22, 2024
@Slach
Copy link
Collaborator

Slach commented Mar 22, 2024

fixed in #526

@Slach Slach closed this as completed Mar 22, 2024
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 a pull request may close this issue.

3 participants