Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TraceQL] quantile_over_time 1 of 2 - lang/parser #3605

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update quantile_over_time to support ints for more natural p0 and p100
  • Loading branch information
mdisibio committed Apr 29, 2024
commit daf553c87dab5957574d69ba464f97bf615b2628
17 changes: 10 additions & 7 deletions pkg/traceql/expr.y
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
staticStr string
staticFloat float64
staticDuration time.Duration
floatList []float64
numericList []float64

hint *Hint
hintList []*Hint
Expand Down Expand Up @@ -77,7 +77,7 @@ import (
%type <attributeField> attributeField
%type <attribute> attribute

%type <floatList> floatList
%type <numericList> numericList

%type <hint> hint
%type <hintList> hintList
Expand Down Expand Up @@ -176,9 +176,12 @@ attributeList:
| attributeList COMMA attribute { $$ = append($1, $3) }
;

floatList:
FLOAT { $$ = []float64{$1} }
| floatList COMMA FLOAT { $$ = append($1, $3) }
// Comma-separated list of numeric values. Casts all to floats
numericList:
FLOAT { $$ = []float64{$1} }
| INTEGER { $$ = []float64{float64($1)}}
| numericList COMMA FLOAT { $$ = append($1, $3) }
| numericList COMMA INTEGER { $$ = append($1, float64($3))}
;

spansetExpression: // shares the same operators as scalarPipelineExpression. split out for readability
Expand Down Expand Up @@ -278,8 +281,8 @@ metricsAggregation:
| RATE OPEN_PARENS CLOSE_PARENS BY OPEN_PARENS attributeList CLOSE_PARENS { $$ = newMetricsAggregate(metricsAggregateRate, $6) }
| COUNT_OVER_TIME OPEN_PARENS CLOSE_PARENS { $$ = newMetricsAggregate(metricsAggregateCountOverTime, nil) }
| COUNT_OVER_TIME OPEN_PARENS CLOSE_PARENS BY OPEN_PARENS attributeList CLOSE_PARENS { $$ = newMetricsAggregate(metricsAggregateCountOverTime, $6) }
| QUANTILE_OVER_TIME OPEN_PARENS attribute COMMA floatList CLOSE_PARENS { $$ = newMetricsAggregateQuantileOverTime($3, $5, nil) }
| QUANTILE_OVER_TIME OPEN_PARENS attribute COMMA floatList CLOSE_PARENS BY OPEN_PARENS attributeList CLOSE_PARENS { $$ = newMetricsAggregateQuantileOverTime($3, $5, $9) }
| QUANTILE_OVER_TIME OPEN_PARENS attribute COMMA numericList CLOSE_PARENS { $$ = newMetricsAggregateQuantileOverTime($3, $5, nil) }
| QUANTILE_OVER_TIME OPEN_PARENS attribute COMMA numericList CLOSE_PARENS BY OPEN_PARENS attributeList CLOSE_PARENS { $$ = newMetricsAggregateQuantileOverTime($3, $5, $9) }
;

// **********************
Expand Down
Loading
Loading