Skip to content

Commit 684b0d3

Browse files
committed
axiom/query: sync aggregations
1 parent 929a43e commit 684b0d3

File tree

3 files changed

+38
-22
lines changed

3 files changed

+38
-22
lines changed

axiom/query/aggregation.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,24 @@ const (
2828
OpMax // max
2929
OpMaxIf // maxif
3030
OpTopk // topk
31+
OpTopkIf // topkif
3132
OpPercentiles // percentiles
33+
OpPercentilesIf // percentilesif
3234
OpHistogram // histogram
35+
OpHistogramIf // histogramif
3336
OpStandardDeviation // stdev
3437
OpStandardDeviationIf // stdevif
3538
OpVariance // variance
3639
OpVarianceIf // varianceif
3740
OpArgMin // argmin
3841
OpArgMax // argmax
3942
OpRate // rate
40-
OpPearson // pearson_correlation
4143
OpMakeSet // makeset
4244
OpMakeSetIf // makesetif
4345
OpMakeList // makelist
4446
OpMakeListIf // makelistif
47+
OpComputed // computed
48+
OpSpotlight // spotlight
4549
)
4650

4751
func aggregationOpFromString(s string) (op AggregationOp, err error) {
@@ -72,10 +76,16 @@ func aggregationOpFromString(s string) (op AggregationOp, err error) {
7276
op = OpMaxIf
7377
case OpTopk.String():
7478
op = OpTopk
79+
case OpTopkIf.String():
80+
op = OpTopkIf
7581
case OpPercentiles.String():
7682
op = OpPercentiles
83+
case OpPercentilesIf.String():
84+
op = OpPercentilesIf
7785
case OpHistogram.String():
7886
op = OpHistogram
87+
case OpHistogramIf.String():
88+
op = OpHistogramIf
7989
case OpStandardDeviation.String():
8090
op = OpStandardDeviation
8191
case OpStandardDeviationIf.String():
@@ -90,8 +100,6 @@ func aggregationOpFromString(s string) (op AggregationOp, err error) {
90100
op = OpArgMax
91101
case OpRate.String():
92102
op = OpRate
93-
case OpPearson.String():
94-
op = OpPearson
95103
case OpMakeSet.String():
96104
op = OpMakeSet
97105
case OpMakeSetIf.String():
@@ -100,6 +108,10 @@ func aggregationOpFromString(s string) (op AggregationOp, err error) {
100108
op = OpMakeList
101109
case OpMakeListIf.String():
102110
op = OpMakeListIf
111+
case OpComputed.String():
112+
op = OpComputed
113+
case OpSpotlight.String():
114+
op = OpSpotlight
103115
default:
104116
return OpUnknown, fmt.Errorf("unknown aggregation operation: %s", s)
105117
}

axiom/query/aggregation_string.go

Lines changed: 20 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

axiom/query/aggregation_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ func TestAggregationOp_Unmarshal(t *testing.T) {
2121
func TestAggregationOp_String(t *testing.T) {
2222
// Check outer bounds.
2323
assert.Equal(t, OpUnknown, AggregationOp(0))
24-
assert.Contains(t, (OpMakeListIf + 1).String(), "AggregationOp(")
24+
assert.Contains(t, (OpSpotlight + 1).String(), "AggregationOp(")
2525

26-
for op := OpUnknown; op <= OpMakeListIf; op++ {
26+
for op := OpUnknown; op <= OpSpotlight; op++ {
2727
s := op.String()
2828
assert.NotEmpty(t, s)
2929
assert.NotContains(t, s, "AggregationOp(")
3030
}
3131
}
3232

3333
func TestAggregationOpFromString(t *testing.T) {
34-
for op := OpCount; op <= OpMakeListIf; op++ {
34+
for op := OpCount; op <= OpSpotlight; op++ {
3535
s := op.String()
3636

3737
parsedOp, err := aggregationOpFromString(s)

0 commit comments

Comments
 (0)