Skip to content

Commit e662cfd

Browse files
committed
Fix explain for label_replace
Signed-off-by: 🌲 Harry 🌊 John 🏔 <[email protected]>
1 parent 41d0d9f commit e662cfd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

engine/engine_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4804,6 +4804,16 @@ func TestQueryStats(t *testing.T) {
48044804
end: time.Unix(1800, 0),
48054805
step: time.Second * 30,
48064806
},
4807+
{
4808+
name: "label_replace",
4809+
load: `load 2m
4810+
http_requests_total{pod="nginx-1"} 1+1x5
4811+
http_requests_total{pod="nginx-2"} 1+2x5`,
4812+
query: `label_replace(http_requests_total, "replace", "$1", "pod", "(.*)")`,
4813+
start: time.Unix(1, 0),
4814+
end: time.Unix(1800, 0),
4815+
step: time.Second * 30,
4816+
},
48074817
}
48084818

48094819
for _, tc := range cases {

execution/function/relabel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (o *relabelOperator) String() string {
4747
}
4848

4949
func (o *relabelOperator) Explain() (next []model.VectorOperator) {
50-
return []model.VectorOperator{}
50+
return []model.VectorOperator{o.next}
5151
}
5252

5353
func (o *relabelOperator) Series(ctx context.Context) ([]labels.Labels, error) {

0 commit comments

Comments
 (0)