Altinity / clickhouse-grafana

Altinity Grafana datasource plugin for ClickHouse®
MIT License
713 stars 120 forks source link

databend datase return 400 error code which not correctly handled on plugin side #538

Closed Mrzzzzz closed 3 months ago

Mrzzzzz commented 4 months ago

164c72644547ccc0c0bdaa92d02c9f5 b2eefa9d2376ada5e9d92770a4f7175 An unexpected error happened 详情 Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7Bcode%2C%20message%7D for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

at div
at div
at div
at https://192.168.100.137:30663/grafana/public/build/2077.a35416a524fb1433fe6e.js:5:55699
at div
at I (https://192.168.100.137:30663/grafana/public/build/5226.48dbd59a341e1b9072d3.js:209:87823)
at nt (https://192.168.100.137:30663/grafana/public/build/6579.28317b1012d2483cf0c8.js:513:14278)
at pl (https://192.168.100.137:30663/grafana/public/build/6579.28317b1012d2483cf0c8.js:1010:3967)
at gi (https://192.168.100.137:30663/grafana/public/build/6579.28317b1012d2483cf0c8.js:1010:4211)
at div
at s (https://192.168.100.137:30663/grafana/public/build/2077.a35416a524fb1433fe6e.js:2488:12263)
at div
at div
at div
at V (https://192.168.100.137:30663/grafana/public/build/5226.48dbd59a341e1b9072d3.js:140:13278)
at r (https://192.168.100.137:30663/grafana/public/build/2077.a35416a524fb1433fe6e.js:518:3183)
at Ch (https://192.168.100.137:30663/grafana/public/build/6579.28317b1012d2483cf0c8.js:1245:153)
at tn (https://192.168.100.137:30663/grafana/public/build/5226.48dbd59a341e1b9072d3.js:175:120702)
at WithTheme(Connect(Ch))
at div
at zs (https://192.168.100.137:30663/grafana/public/build/6579.28317b1012d2483cf0c8.js:1254:57)
at tn (https://192.168.100.137:30663/grafana/public/build/5226.48dbd59a341e1b9072d3.js:175:120702)
at WithTheme(Connect(zs))
at f (https://192.168.100.137:30663/grafana/public/build/2077.a35416a524fb1433fe6e.js:1320:180)
at m (https://192.168.100.137:30663/grafana/public/build/2077.a35416a524fb1433fe6e.js:1320:754)
at div
at r (https://192.168.100.137:30663/grafana/public/build/2060.bc8dca0113c3ef0872b8.js:1:2292)
at div
at r (https://192.168.100.137:30663/grafana/public/build/2060.bc8dca0113c3ef0872b8.js:1:4276)
at C (https://192.168.100.137:30663/grafana/public/build/2060.bc8dca0113c3ef0872b8.js:1:9630)
at div
at cs (https://192.168.100.137:30663/grafana/public/build/6579.28317b1012d2483cf0c8.js:1260:21)
at Suspense
at f (https://192.168.100.137:30663/grafana/public/build/2077.a35416a524fb1433fe6e.js:1320:180)
at Wm (https://192.168.100.137:30663/grafana/public/build/2077.a35416a524fb1433fe6e.js:9259:330)
at Ke (https://192.168.100.137:30663/grafana/public/build/5226.48dbd59a341e1b9072d3.js:206:23585)
at Ci (https://192.168.100.137:30663/grafana/public/build/5226.48dbd59a341e1b9072d3.js:197:4727)
at An (https://192.168.100.137:30663/grafana/public/build/5226.48dbd59a341e1b9072d3.js:197:10217)
at Do (https://192.168.100.137:30663/grafana/public/build/5226.48dbd59a341e1b9072d3.js:206:11746)
at Ke (https://192.168.100.137:30663/grafana/public/build/5226.48dbd59a341e1b9072d3.js:206:25781)
at div
at div
at div
at main
at Gc (https://192.168.100.137:30663/grafana/public/build/2077.a35416a524fb1433fe6e.js:9256:2428)
at Ci (https://192.168.100.137:30663/grafana/public/build/5226.48dbd59a341e1b9072d3.js:197:4727)
at An (https://192.168.100.137:30663/grafana/public/build/5226.48dbd59a341e1b9072d3.js:197:10217)
at Tn (https://192.168.100.137:30663/grafana/public/build/5226.48dbd59a341e1b9072d3.js:197:9607)
at es (https://192.168.100.137:30663/grafana/public/build/5226.48dbd59a341e1b9072d3.js:206:12045)
at Ke (https://192.168.100.137:30663/grafana/public/build/5226.48dbd59a341e1b9072d3.js:206:19753)
at div
at c (https://192.168.100.137:30663/grafana/public/build/2077.a35416a524fb1433fe6e.js:2337:3973)
at g (https://192.168.100.137:30663/grafana/public/build/5226.48dbd59a341e1b9072d3.js:46:13846)
at i (https://192.168.100.137:30663/grafana/public/build/2077.a35416a524fb1433fe6e.js:4996:18170)
at f (https://192.168.100.137:30663/grafana/public/build/2077.a35416a524fb1433fe6e.js:1320:180)
at m (https://192.168.100.137:30663/grafana/public/build/2077.a35416a524fb1433fe6e.js:1320:754)
at E (https://192.168.100.137:30663/grafana/public/build/5226.48dbd59a341e1b9072d3.js:175:118397)
at dl (https://192.168.100.137:30663/grafana/public/build/2077.a35416a524fb1433fe6e.js:9270:122)
Mrzzzzz commented 4 months ago

grafana version 10.0.3 Altinity plugin for ClickHouse 3.0.0

Mrzzzzz commented 4 months ago

image

Slach commented 4 months ago

According to shared screenshots everything should be ok.

Could you try with latest pre-release? You need download https://github.com/Altinity/clickhouse-grafana/releases/download/v3.0.3/vertamedia-clickhouse-datasource-3.0.3.zip into /var/lib/grafana/plugins/vertamedia-clickhouse-datasource/ and restart grafana-server

something like that

wget https://github.com/Altinity/clickhouse-grafana/releases/download/v3.0.3/vertamedia-clickhouse-datasource-3.0.3.zip -q -O - | sudo unzip -d /var/lib/grafana/plugins/vertamedia-clickhouse-datasource/ -q

sudo chown grafana -R /var/lib/grafana/plugins/vertamedia-clickhouse-datasource 
systemctl restart grafana-server

or using grafana cli interface

grafana cli --pluginUrl https://github.com/Altinity/clickhouse-grafana/releases/download/v3.0.3/vertamedia-clickhouse-datasource-3.0.3.zip plugins install vertamedia-clickhouse-datasource
Mrzzzzz commented 4 months ago

According to shared screenshots everything should be ok.

Could you try with latest pre-release? You need download https://github.com/Altinity/clickhouse-grafana/releases/download/v3.0.3/vertamedia-clickhouse-datasource-3.0.3.zip into /var/lib/grafana/plugins/vertamedia-clickhouse-datasource/ and restart grafana-server

something like that

wget https://github.com/Altinity/clickhouse-grafana/releases/download/v3.0.3/vertamedia-clickhouse-datasource-3.0.3.zip -q -O - | sudo unzip -d /var/lib/grafana/plugins/vertamedia-clickhouse-datasource/ -q

sudo chown grafana -R /var/lib/grafana/plugins/vertamedia-clickhouse-datasource 
systemctl restart grafana-server

or using grafana cli interface

grafana cli --pluginUrl https://github.com/Altinity/clickhouse-grafana/releases/download/v3.0.3/vertamedia-clickhouse-datasource-3.0.3.zip plugins install vertamedia-clickhouse-datasource

image image Upgraded or the same error

Mrzzzzz commented 4 months ago

Does it not support databend database queries

Slach commented 4 months ago

Are you use clickhouse compatible https://github.com/datafuselabs/databend ?

Is databend support HTTP protocol for queries?

Mrzzzzz commented 4 months ago

您是否使用与 clickhouse 兼容的https://github.com/datafuselabs/databend?

是否databend支持HTTP协议查询?

Yes, you can already search for the outbound list in the picture, but clicking on the query results in an error

Slach commented 4 months ago

Could you press CTRL+SHIFT+I -> Network tab and try to find request and response from grafana to grafana backend dataproxy is return 200 code with properly result?

moreover, could you share

curl -vvv "http://databend:your-password@databend-query:8124/?query=SELECT version()"
Mrzzzzz commented 4 months ago

databend-query:8124 8d448b6b2a7980a8aa14b339c06c828 140839acf60aff63d981c2daf4c2dd3 {"error":{"code":"400","message":"UnknownFunction. Code: 1008, Text = error: \n --> SQL:1:16\n |\n1 | SELECT (intDiv(toUInt32(undefined), 2) 2) 1000 as t, count() FROM default.employee_data WHERE undefined >= toDateTime(1713424120) AND undefined <= toDateTime(1713427720) GROUP BY t ORDER BY t FORMAT JSON\n | ^^^^^^^^^^^^^^^^^^^ no function matches the given name: 'touint32', do you mean 'to_uint32', 'to_int32', 'to_uint8', 'try_to_uint32', 'to_uint16', 'to_uint64', 'to_int8'?\n\n."}}

Mrzzzzz commented 4 months ago

curl -vvv "http://databend:your-password@databend-query:8124/?query=SELECT version()"

image

Slach commented 4 months ago

no function matches the given name: 'touint32', do you mean 'to_uint32', 'to_int32', 'to_uint8', 'try_to_uint32', 'to_uint16', 'to_uint64', 'to_int8'?

It means databend doesn't support standard clickhouse functions like toUInt32 and have different SQL dialect, and can't be used as source server for ClickHouse plugin execution

check

curl -vvv "http://databend:your-password@databend-query:8124/?query=SELECT+toUInt32(1)"

and better create issue in https://github.com/datafuselabs/databend/issues in this case

I will try to reproduce it later

Mrzzzzz commented 4 months ago

no function matches the given name: 'touint32', do you mean 'to_uint32', 'to_int32', 'to_uint8', 'try_to_uint32', 'to_uint16', 'to_uint64', 'to_int8'?

It means databend doesn't support standard clickhouse functions like toUInt32 and have different SQL dialect, and can't be used as source server for ClickHouse plugin execution

check

curl -vvv "http://databend:your-password@databend-query:8124/?query=SELECT+toUInt32(1)"

and better create issue in https://github.com/datafuselabs/databend/issues in this case

I will try to reproduce it later

ok thank