Reference to the union, intersect, and complement logical set functions

Summary

union(<tsExpression1>, <tsExpression2> ...)

intersect(<tsExpression1>, <tsExpression2>, ...)

complement(<tsExpression1>, <tsExpression2>, ...)

Functions that let you perform logical set operations, similar to the PromQL PromQL Logical/Set Binary Operators

  • union() is similar to the OR operator and lets you combine time series.
  • intersect() is similar to the AND operator.
  • complement() indicates an UNLESS relationship between two time series.

For each function, you have to specify at least two ts() expressions as parameters. You can specify additional ts() expressions.

Parameters

ParameterDescription
tsExpression1 First expression in the set.
tsExpression2 Second expression in the set.

Description

Allows you to perform logical set operations on two or more time series. These operators match the PromQL Logical/Set Binary Operators or (union), unless (complement), and (intersection).

  • union() takes at least 2 time series as parameters and returns the points from the first time series plus all points in the other time series which do not have exactly matching point tags.
  • intersect() takes at least 2 time series as parameters and returns the points of the first series for which there are points with exactly matching point tags in the other time series.
  • complement() takes at least 2 time series as parameters and returns the points of the first series for which there are no points in the other series that have exactly matching point tags.