Data querying issue on Grafana ClickHouse with Cloudflare Analytics Engine

  • What Grafana version and what operating system are you using?
    Grafana v9.1.4

  • What are you trying to achieve?
    We are trying to create dashboards in Grafana using Cloudflare worker metrics

  • How are you trying to achieve it?
    We are using the Grafana ClickHouse as a data source to get metrics from the Cloudflare Analytics engine.

  • What happened?
    we are encountering issues when trying to execute the following query to obtain an aggregated time series of various error codes for each time block.

We are referring the following document - clickhouse-grafana/README.md at master · Altinity/clickhouse-grafana · GitHub

$columns(blob4, count(*) c) FROM "T_API-staging" WHERE (blob1 = 'success') AND (double1 = 0);

Which should be computed as:

SELECT
t,
groupArray((errorCode, c)) AS groupArr
FROM
(
SELECT
(intDiv(toUInt32(timestamp), 60) * 60) * 1000 AS t,
blob4 AS errorCode,
count(*) AS c
FROM "T_API-staging"
WHERE (blob1 = 'success') AND (double1 = 0)
GROUP BY
t,
errorCode
ORDER BY
t,
errorCode
)
GROUP BY t
ORDER BY t

Instead of getting the data, we got the following error

Input was invalid: sql parser error: Expected an SQL statement, found: $columns

If we try to write the computed query directly, so don’t use the macros, we got this error instead:

Input was invalid: unsupported expression type: (errorCode, c)

Could someone please assist us in obtaining the relevant data from the Cloudflare Analytics engine?

  • What did you expect to happen?
    Getting the data from Cloudflare Analytics engine

  • Can you copy/paste the configuration(s) that you are having problems with?
    Already mentioned on - What happened?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    Already mentioned on - What happened?

  • Did you follow any online instructions? If so, what is the URL?
    We are referring the following document - clickhouse-grafana/README.md at master · Altinity/clickhouse-grafana · GitHub

I really appreciate any help you can provide.