I am new to Grafana and Timestream and want to expore their suitability for my needs.
My goal is to visualize a number of certain events in the logs.
I have a field repsesenting a session id (cmcd_sid ) and some indicator - cmcd_bs:
cmcd_sid cmcd_bs <other fields>
"78b459fc-9fab-4286-8840-8f1420f528da" -
"78b459fc-9fab-4286-8840-8f1420f528da" -
"78b459fc-9fab-4286-8840-8f1420f528da" true
So what I need is to get and visualize number of sessions (cmcd_sid) that have more than 1% of cmcd_bs=true
WITH total_requests AS (
SELECT cast (count(*) as double) as CNT_TOTAL, cmcd_sid as SID_TOTAL FROM $__database.$__table
WHERE cmcd_sid is not NULL
AND time > ago(3h)
GROUP BY cmcd_sid
), bs_requests AS (
SELECT cast (count(*) as double) as CNT_BS, cmcd_sid as SID_BS FROM $__database.$__table
WHERE cmcd_bs is not NULL
AND time > ago(3h)
GROUP BY cmcd_sid
)
SELECT count(DISTINCT SID_BS), SID_BS
FROM total_requests, bs_requests
WHERE SID_TOTAL = SID_BS
AND CNT_BS / CNT_TOTAL * 100 > 1
GROUP BY SID_B
I wrote a query that gave me those sessions but when I try to visualize it in Grafana it throws "Data does not have a time field"
Ideally, I want to have a graph depicting how many these sessions I have for a period of time but not sure how I can incorporate time field into the query?