Promql outer join support

116 views
Skip to first unread message

Garrett Li

unread,
Aug 7, 2019, 6:09:30 AM8/7/19
to Prometheus Users
Outer join (especially left join & right join) are very useful.
For example: We have one host level CPU alert (CPU > 70%), and we have another spatial aggregation metrics on pool level (host count in a pool). If we wants to get all pool alerting host rate, right join is required to implement it (since host level CPU alert metric doesn't have full set of the pools, only includes the pool which has host CPU > 70%).

I know we can use inner join with OR modifier to work around, however, it is not straight-forward, is there any keyword to support the outer join?

Garrett Li

unread,
Aug 21, 2019, 3:03:08 AM8/21/19
to Prometheus Users
`group_left` and `group_right` can be used to resolve the problem.

ayoub mrini

unread,
Oct 15, 2019, 4:01:36 AM10/15/19
to Prometheus Users
Hello, Garrett Li,

I need to do an outer join, I would like you to provide an example, suppose we have two series of metric1: {label1=v1, label2=v2} and {label1=v3, label2=v4}
and one series of metric2: {label1=v1, label3=v5}

how can we join the two metrics without loosing {label1=v3, label2=v4}, in other words, how can we get  {label1=v1, label2=v2, label3=v5} and  {label1=v3, label2=v4, label3=None(or sth else)}

If we do sth like:    metric1 * on(label1) group_left(label3) metric2  we will only get  {label1=v1, label2=v2, label3=v5} 

Thanks
Reply all
Reply to author
Forward
0 new messages