Skip to content

Commit

Permalink
Add json label extraction to aggregation
Browse files Browse the repository at this point in the history
  • Loading branch information
splitice committed Jun 12, 2022
1 parent 711a372 commit 3cff1d0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pkg/logql/syntax/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2956,6 +2956,23 @@ func TestParse(t *testing.T) {
},
},
},
{
in: `count_over_time({ foo ="bar" } | json layer7_something_specific="layer7_something_specific" [12m])`,
exp: &RangeAggregationExpr{
Left: &LogRange{
Left: &PipelineExpr{
MultiStages: MultiStageExpr{
newJSONExpressionParser([]log.JSONExpression{
log.NewJSONExpr("layer7_something_specific", `layer7_something_specific`),
}),
},
Left: &MatchersExpr{Mts: []*labels.Matcher{mustNewMatcher(labels.MatchEqual, "foo", "bar")}},
},
Interval: 12 * time.Minute,
},
Operation: "count_over_time",
},
},
} {
t.Run(tc.in, func(t *testing.T) {
ast, err := ParseExpr(tc.in)
Expand Down

0 comments on commit 3cff1d0

Please sign in to comment.