I have metric that exports "current time" from the device in UNIX time, now I would like to compare that time with "crawling time", but I seem to have some problems with that.
I tried multiple ways:
example:
my_device_time{somelabel="asd"} < (time() - 120)
Should return me rows that have a time difference of 2 or more minutes but do not seem to work.
The second (preferred way) would be something like that (in grafana):
my_device_time{somelabel="asd"} < (crawledTime() - 60)
So questions:
Is it possible to get Time field as unixtimestamp for compare or how should I compare metric value (unixtime) against current timestamp with promql?
timestamp(my_device_time) - my_device_time()
timestamp() will return crawl time in unixtime, so found the solution on my own.