CaptainHastings
CaptainHastings

Reputation: 1597

Grafana query for time delta

I have an app which, among other things, continuously publishes current time in milliseconds since epoch (System.currentTimeMillis()).

What I want to do is write a query in grafana dashboard such that: a) It shows "Up" if the difference between current time in grafana & my published time is less than 1 min. b) Shows "Down" is the above query doesn't hold or there is no data.

Any ideas, pointers will be most helpful.

Thanks

Upvotes: 0

Views: 1519

Answers (1)

aran
aran

Reputation: 11900

Well, you could pass the value of your real timestamp to grafana, as a "long" or "timestamp" field , named real_ts (maybe there's another way, sorry, not expert in grafana).

Then, substract grafana's timestamp with your real_ts field's value, and if >60 seconds, print Down, if not, print Up.

Upvotes: 3

Related Questions