> #metrics(5min) /#metrics(30 mins) > 50
Thinks: if you're only interested in the *number* of timeseries for each metric name, then you can do
count by (__name__) ({__name__=~".+"})
(warning: potentially expensive query if you have many timeseries). Then you could move the metric name into a label:
label_replace(count by (__name__) ({__name__=~".+"}), "metric", "$1", "__name__", "(.+)") * 1
At that point, you have something you could alert on. Example: find metrics which have at least 1% more timeseries than they did 30 minutes ago:
(label_replace(count by (__name__) ({__name__=~".+"}), "metric", "$1", "__name__", "(.+)") * 1) / (label_replace(count by (__name__) ({__name__=~".+"} offset 30m), "metric", "$1", "__name__", "(.+)") * 1) > 1.01
This won't detect *completely new* metrics which appear, but you could have a separate rule for these, e.g. (untested):
(label_replace(count by (__name__) ({__name__=~".+"}), "metric", "$1", "__name__", "(.+)") * 1) unless (label_replace(count by (__name__) ({__name__=~".+"} offset 30m), "metric", "$1", "__name__", "(.+)") * 1)
Or to detect *every* new timeseries, including new timeseries for existing metrics:
{__name__=~".+"} unless {__name__=~".+"} offset 30m