I want to take the min of a metric based on one label, but perserve the other labels so I can extract them later.
Suppose I have these metrics:
Metric{label1="1",label2="2"} 0
Metric{label1="1",label2="3"} 1
Metric{label1="2",label2="2"} 10
Metric{label1="2",label2="3"} 100
If I do
min(Metric)by(label1)
I get the correct results:
{label1="1"} 0
{label1="2"} 10
but I lose the label2, which I would like to extract later.
Is there a way to min by label1, while still preserving label2 in the result?
What I want the output of my aggregation to be:
Metric{label1="1",label2="2"} 0
Metric{label1="2",label2="2"} 10
I think you want bottomk by(label1)(1, Metric)