profile
viewpoint

Fiery-Fenix/page-visibility 4

Page Visibility API Wrapper and Polyfill

Fiery-Fenix/bem-node 0

bem nodejs singlepage javascript

Fiery-Fenix/clickhouse-grafana 0

Clickhouse datasource for grafana

Fiery-Fenix/go-clickhouse 0

Golang SQL database driver for Yandex ClickHouse

Fiery-Fenix/grafana 0

The tool for beautiful monitoring and metric analytics & dashboards for Graphite, InfluxDB & Prometheus & More

Fiery-Fenix/node-m3u8 0

Streaming parser for m3u8 files in node

Fiery-Fenix/openvpn-install 0

OpenVPN server installer script

Fiery-Fenix/puppeteer 0

Headless Chrome Node API

Fiery-Fenix/telegraf 0

The plugin-driven server agent for collecting & reporting metrics.

issue commentVertamedia/clickhouse-grafana

[Bug] Panic in backend plugin in case of Array(Tuple(Nullable(String), ... )) type

Sorry for that, forgot to attach sample query to reproduce:

select now() as t, groupArray((label, value))
from (
  select 'test' as label, 1 as value
  union all
  select NULL as label, 2 as value
)

Type of returned field is Array(Tuple(Nullable(String), UInt8))

Fiery-Fenix

comment created time in 5 days

issue openedVertamedia/clickhouse-grafana

[Bug] Panic in backend plugin in case of Array(Tuple(Nullable(String), ... )) type

Grafana version: Grafana v8.3.3 (30bb7a93ca) ClickHouse Grafana plugin version: 2.4.0, also reproduceable on 2.4.1 and 2.4.2

Synopsis: If alerting query from ClickHouse is returning type Array(Tuple(Nullable(String), ...)), backed plugin crashed with a panic. Log from Grafana:

t=2022-01-12T17:35:20+0000 lvl=dbug msg="panic: interface conversion: main.Value is *string, not string" logger=plugin.initializer pluginID=vertamedia-clickhouse-datasource
t=2022-01-12T17:35:20+0000 lvl=dbug msg= logger=plugin.initializer pluginID=vertamedia-clickhouse-datasource
t=2022-01-12T17:35:20+0000 lvl=dbug msg="goroutine 67011 [running]:" logger=plugin.initializer pluginID=vertamedia-clickhouse-datasource
t=2022-01-12T17:35:20+0000 lvl=dbug msg="main.(*Response).toFramesWithTimeStamp(0xc00039da00, 0x8, 0xc002204280, 0x0, 0xc000479050, 0x0)" logger=plugin.initializer pluginID=vertamedia-clickhouse-datasource
t=2022-01-12T17:35:20+0000 lvl=dbug msg="\t/go/src/grafana-clickhouse/pkg/response.go:119 +0xd1b" logger=plugin.initializer pluginID=vertamedia-clickhouse-datasource
t=2022-01-12T17:35:20+0000 lvl=dbug msg="main.(*Response).toFrames(0xc000132ea0, 0xc4be50, 0xc0003b2280)" logger=plugin.initializer pluginID=vertamedia-clickhouse-datasource
t=2022-01-12T17:35:20+0000 lvl=dbug msg="\t/go/src/grafana-clickhouse/pkg/response.go:34 +0x65" logger=plugin.initializer pluginID=vertamedia-clickhouse-datasource
t=2022-01-12T17:35:20+0000 lvl=dbug msg="main.(*ClickHouseDatasource).executeQuery(0x17, {0x4, {0xc000039ba0, 0x20}, 0x0, 0x0, 0xc0000dd810}, {0xc4be50, 0xc0003b2280}, 0xc00060bc20)" logger=plugin.initializer pluginID=vertamedia-clickhouse-datasource
t=2022-01-12T17:35:20+0000 lvl=dbug msg="\t/go/src/grafana-clickhouse/pkg/datasource.go:61 +0x157" logger=plugin.initializer pluginID=vertamedia-clickhouse-datasource
t=2022-01-12T17:35:20+0000 lvl=dbug msg=main.(*ClickHouseDatasource).QueryData.func2() logger=plugin.initializer pluginID=vertamedia-clickhouse-datasource
t=2022-01-12T17:35:20+0000 lvl=dbug msg="\t/go/src/grafana-clickhouse/pkg/datasource.go:93 +0xae" logger=plugin.initializer pluginID=vertamedia-clickhouse-datasource
t=2022-01-12T17:35:20+0000 lvl=dbug msg=golang.org/x/sync/errgroup.(*Group).Go.func1() logger=plugin.initializer pluginID=vertamedia-clickhouse-datasource
t=2022-01-12T17:35:20+0000 lvl=dbug msg="\t/go/pkg/mod/golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:57 +0x67" logger=plugin.initializer pluginID=vertamedia-clickhouse-datasource
t=2022-01-12T17:35:20+0000 lvl=dbug msg="created by golang.org/x/sync/errgroup.(*Group).Go" logger=plugin.initializer pluginID=vertamedia-clickhouse-datasource
t=2022-01-12T17:35:20+0000 lvl=dbug msg="\t/go/pkg/mod/golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:54 +0x92" logger=plugin.initializer pluginID=vertamedia-clickhouse-datasource
t=2022-01-12T17:35:20+0000 lvl=dbug msg="plugin process exited" logger=plugin.initializer pluginID=vertamedia-clickhouse-datasource path=/var/lib/grafana/plugins/vertamedia-clickhouse-datasource/vertamedia-clickhouse-plugin_linux_amd64 pid=29507 error="exit status 2"

Go stack trace:

panic: interface conversion: main.Value is *string, not string

goroutine 67011 [running]:
main.(*Response).toFramesWithTimeStamp(0xc00039da00, 0x8, 0xc002204280, 0x0, 0xc000479050, 0x0)
    /go/src/grafana-clickhouse/pkg/response.go:119 +0xd1b
main.(*Response).toFrames(0xc000132ea0, 0xc4be50, 0xc0003b2280)
    /go/src/grafana-clickhouse/pkg/response.go:34 +0x65
main.(*ClickHouseDatasource).executeQuery(0x17, {0x4, {0xc000039ba0, 0x20}, 0x0, 0x0, 0xc0000dd810}, {0xc4be50, 0xc0003b2280}, 0xc00060bc20)
    /go/src/grafana-clickhouse/pkg/datasource.go:61 +0x157
main.(*ClickHouseDatasource).QueryData.func2()
    /go/src/grafana-clickhouse/pkg/datasource.go:93 +0xae
golang.org/x/sync/errgroup.(*Group).Go.func1()
    /go/pkg/mod/golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:57 +0x67
created by golang.org/x/sync/errgroup.(*Group).Go
    /go/pkg/mod/golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:54 +0x92

Root cause is here: https://github.com/Vertamedia/clickhouse-grafana/blob/master/pkg/response.go#L119 - tsName.(string), function ParseValue could return both pointer and value, there should be some advanced check for pointer instead of direct converting to string.

created time in 6 days

more