14 Nov 2024 01:33 PM
Hi Team,
I'm using single synthetic monitoring configuration where I have configured 3 http requests and I would like to monitor all 3 http url in a dashboard. If any http url receives status code other than 200 then it should fail.
I use below DQL query to fetch the metrics, the average value dt.synthetic.http.request.executions comes 1 if there is a success and gives null when it fails.
When I try to fetch arraylast() value, DQL ignores all null values and picks latest numerical value from an array. Is there a function to change null values into numerical value i.e 0 so that I can pick that value and mark my application down.
timeseries requests = avg(dt.synthetic.http.request.executions),
filter: { http_monitor.result.http_status.code == 200 AND matchesValue(entityAttr(dt.entity.http_check_step, "entity.name"), "test-monitor") }
| fieldsAdd final=if(arrayLast(requests)==1, "UP", else: "DOWN")
Solved! Go to Solution.
14 Nov 2024 03:08 PM
Can you try this? 🙂
timeseries requests = avg(dt.synthetic.http.request.executions),
filter: { http_monitor.result.http_status.code == 200 AND matchesValue(entityAttr(dt.entity.http_check_step, "entity.name"), "test-monitor") }
| fieldsAdd requests =if(isNull(requests[]),0,else:requests[])
| fieldsAdd final=if(arrayLast(requests)==1, "UP", else: "DOWN")
14 Nov 2024 04:20 PM
This works, much appreciated