title: How to calculate uptime percentage using grafana singlestat and prometheus
body: <p>Currently I am calculating uptime % using below query. </p>
  
  <p>But if I try to test by restarting a service that is if i restart at 12:00 and if i try to test at 12:05 it should show 100% availability , but in my case it is not showing that way.</p>
  
  <p>Please help out with correct calculation for uptime %</p>
  
  <p>Query which was used is</p>
  
  <p>avg_over_time(up{instance="$instance", job!="jobid"}[${__range_s}s])*100</p>
  
  <p>prometheus grafana metrics promql</p>