Skip to content

Commit

Permalink
one possible solution
Browse files Browse the repository at this point in the history
  • Loading branch information
slim-bean committed Feb 24, 2021
1 parent ebfbf27 commit 51de82a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions pkg/logql/log/parser_hints.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ func (p *parserHint) NoLabels() bool {

// newParserHint creates a new parser hint using the list of labels that are seen and required in a query.
func newParserHint(requiredLabelNames, groups []string, without, noLabels bool, metricLabelName string) *parserHint {
//Strip the _extracted suffix from any labels which had collisions with stream labels
for i := range requiredLabelNames {
requiredLabelNames[i] = strings.TrimSuffix(requiredLabelNames[i], "_extracted")
}
if len(groups) > 0 {
requiredLabelNames = append(requiredLabelNames, groups...)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/logql/log/parser_hints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ func Test_ParserHints(t *testing.T) {
`{}`,
},
{
`sum(count_over_time({app="nginx"} | json | cluster_extracted="us-east-west" [1m]))`,
`sum by (cluster_extracted)(count_over_time({app="nginx"} | json | cluster_extracted="us-east-west" [1m]))`,
jsonLine,
true,
1.0,
`{}`,
`{cluster_extracted="us-east-west"}`,
},
} {
tt := tt
Expand Down

0 comments on commit 51de82a

Please sign in to comment.