Thanks for the clarification, It makes sense, but why we are deleting the data as soon as Prometheus scrapes becuase next time (at t15minutes) we can't register same metric ,as it is already registered at time t1. We are using Prometheus go client and that's the limitation.
And if we delete data or unregistered at t15, and add new data or register again with new values then will loose data which was register by other go routines and which haven't processed yet. So how can we monitor dynamic metrics ?? Or how can we resolve above issue? Or can we do ,only set.value (for the metric was already register) instead of unregister and register again? Using goclient library.?? On Sat, Jan 23, 2021, 4:53 PM Stuart Clark <[email protected]> wrote: > On 23/01/2021 10:55, akshay sharma wrote: > > Thanks for your reply. > > > > Actually the issue which are facing is , > > Let the exporter expose metric at every 15minutes, and let the > > Prometheus to scrape data every 2mintues. > > > > But suppose at t1, Prometheus scrapes data and gets the metrics with > > some value say x(metric) and y(value). > > > > I've a alert rule if metric >= y, alerts should be raised. > > > > Now alert is raised as conditions is true, now Prometheus again > > scrapes data at t3 but now metrics is not available ..he gets nothing . > > Then when again alert rules evaluates it is getting no data . But why > > alert is getting resolved??? Because there is no value how the > > condition is true? ? > > Metric >=y ,will never be true in case of no data right.? Is need to > > understand this scenario. > > Because at time=t3 as far as Prometheus is concerned the metric no > longer exists. The way alerts work is that the expression is evaluated, > and if there is a resulting set of metrics (could be many due to > different label combinations) alerts are created. With your query the > metric no longer exists, so the metric >= y will not return anything, > hence any pre-existing alert will be resolved. > > The correct solution is to ensure the metric continues to exist, so > scraping at least every 2 minutes and ensuring the exporter always > returns data. > > -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CAOrgXNL8MoJdk3O1RwPBb8_ofp6%2B9-6NUjaYMr%2B5fCXkc9d-dQ%40mail.gmail.com.

