-
-
Notifications
You must be signed in to change notification settings - Fork 69
ClickHouse Metrics
Lorenzo Mangani edited this page Jan 13, 2021
·
28 revisions
cLoki provides a simplified query model for querying any data in clickhouse, generating metrics and tags dynamically.
parameter | description |
---|---|
db | clickhouse database name |
table | clickhouse table name |
tag | column(s) for tags, comma separated |
metric | function for metric values |
where | where condition (optional) |
interval | interval in seconds (optional) |
clickhouse({ db="my_database", table="my_table", tag="source_ip", metric="avg(mos)", where="mos > 0", interval="60" })
SELECT source_ip, groupArray((t, c)) AS groupArr
FROM (
SELECT (intDiv(toUInt32(record_datetime), 60) * 60) * 1000 AS t, source_ip, avg(mos) c
FROM my_database.my_table
PREWHERE record_datetime BETWEEN 1610533076 AND 1610536677 AND mos > 0
GROUP BY t, source_ip ORDER BY t, source_ip
)
GROUP BY source_ip ORDER BY source_ip