How can i get the time period related to the specific event in the selected time period

I want to calculate the sla of our services, so i need to get the failure time during the selected time.For instance,if i chose last 1 hour, i need to know how long did my service keep alive during last one hour,the sla equals time(the service up)/1hour*100.Is there any function to get the time ?

It depends on used TSDB and structure of your metric(s). In theory you don’t need any special function, just standard aggregation and group by time period.
My InfluxDB example for inspiration:

1 Like

i am now using influxdb as my storage,i will try that first , thanks~