When computing, how to handle null values.
laimeng-git opened this issue · comments
Proposal
I have two metrics, A and B. I want the result of A + B to be as follows: for time points where A does not exist, the result should be the value of B at that time point; for time points where B does not exist, the result should be the value of A at that time point; and for time points where both A and B exist, the result should be A + B. How can I write this in PromQL? Currently, I can use (A + B) or A or B , but are there other ways to write it that are more performant and easier to read? If not, I would like to add an operator that specifies how to handle null values, such as A + null_as(0) B , which would be clearer, more readable, and potentially more performant.
There's a similar discussion in issue #13625
Yeah, this is a duplicate of #13625.