prometheuspromql

Prometheus offset in seconds since midnight


I have a counter metric of api calls. I would like to check how many calls were made TODAY (i.e since midnight). my initial though was to use the delta function which seems to fit, but I cannot figure out how do I calculate the offset from time() to midnight


Solution

  • time() % 86400 will give the number of seconds since midnight UTC.