diff --git a/app/vmalert/rule/rule.go b/app/vmalert/rule/rule.go index 46e388c7f..e5e224881 100644 --- a/app/vmalert/rule/rule.go +++ b/app/vmalert/rule/rule.go @@ -32,7 +32,7 @@ type Rule interface { close() } -var errDuplicate = errors.New("result contains metrics with the same labelset after applying rule labels. See https://docs.victoriametrics.com/vmalert/#series-with-the-same-labelset for details") +var errDuplicate = errors.New("result contains metrics with the same labelset during evaluation. See https://docs.victoriametrics.com/vmalert/#series-with-the-same-labelset for details") type ruleState struct { sync.RWMutex diff --git a/docs/stream-aggregation.md b/docs/stream-aggregation.md index bd418dd14..be2c2b5ba 100644 --- a/docs/stream-aggregation.md +++ b/docs/stream-aggregation.md @@ -598,9 +598,6 @@ some_counter:5m_increase / 5m This is similar to `rate(some_counter[5m])`. -Please note, opposite to [rate](https://docs.victoriametrics.com/metricsql/#rate), `increase` aggregations can be -combined safely afterwards. This is helpful when the aggregation is calculated by more than one vmagent. - Aggregating irregular and sporadic metrics (received from [Lambdas](https://aws.amazon.com/lambda/) or [Cloud Functions](https://cloud.google.com/functions)) can be controlled via [staleness_interval](#staleness) option. diff --git a/docs/vmalert.md b/docs/vmalert.md index 40dd5aa93..e8c79b264 100644 --- a/docs/vmalert.md +++ b/docs/vmalert.md @@ -902,6 +902,25 @@ max(vmalert_alerting_rules_last_evaluation_series_fetched) by(group, alertname) See more details [here](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4039). This feature is available only if vmalert is using VictoriaMetrics v1.90 or higher as a datasource. +### Series with the same labelset + +vmalert can produce the following error message: +``` +result contains metrics with the same labelset during evaluation +``` + +The error means there is a collision between [time series](https://docs.victoriametrics.com/keyConcepts.html#time-series) +during evaluation. + +For example, a rule with `expr: {__name__=~"vmalert_alerts_.*"} > 0` returns two distinct time series in response: +``` +{__name__="vmalert_alerts_pending",job="vmalert",alertname="HostContextSwitching"} 12 +{__name__="vmalert_alerts_firing",job="vmalert",alertname="HostContextSwitching"} 0 +``` + +As label `__name__` will be dropped during evaluation, leads to duplicated time series. +To fix this, one could use function like [label_replace](https://docs.victoriametrics.com/metricsql/#label_replace) to preserve the distinct labelset. + ## mTLS protection By default `vmalert` accepts http requests at `8880` port (this port can be changed via `-httpListenAddr` command-line flags),