2

I have a counter, for example, user_actions with label user_id. I want to get alert, when user_actions is disappeared for any user_id.

Literally, I need absent_over_time(user_actions[60m]), but taking into account user_id label.

Denis
  • 3,595
  • 12
  • 52
  • 86

1 Answers1

2

I couldn't come up with PromQL solution for this task, but it can be implemented with lag() function from MetricsQL. For instance, the following query would return all the user_actions time series that have no data points during the last 5 minutes (see 5*60 in the query). The query stops noticing such time series after 60 minutes (see 60m in square brackets):

lag(user_actions[60m]) > 5*60

See more details about lag() function in MetricsQL docs.

valyala
  • 11,669
  • 1
  • 59
  • 62