Ask Your Question
1

How can an instant vector's values be restricted to the maximum value of another instant vector using promQL?

asked 2023-06-03 01:53:48 +0000

scrum gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-06-03 02:21:02 +0000

qstack gravatar image

You can use the "min()" function in PromQL to restrict the values of an instant vector to the maximum value of another instant vector. Here is an example query:

min(instantVector1, max_over_time(instantVector2[5m]))

This query takes the minimum value between the instantVector1 and the maximum value of instantVector2 over the past 5 minutes. In other words, it restricts the values of instantVector1 to be no greater than the maximum value of instantVector2 over the past 5 minutes.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-03 01:53:48 +0000

Seen: 16 times

Last updated: Jun 03 '23