Skip to content

Commit 4b5951b

Browse files
authored
fix(async search): return agg interval in req (#293)
1 parent 86c0de1 commit 4b5951b

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

proxy/search/async.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ func buildRequestAggs(in []*storeapi.AggQuery) []AggQuery {
479479
GroupBy: agg.GroupBy,
480480
Func: agg.Func.MustAggFunc(),
481481
Quantiles: agg.Quantiles,
482+
Interval: seq.MID(agg.Interval),
482483
})
483484
}
484485
return reqAggs

proxyapi/grpc_async_search.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,17 @@ func (g *grpcV1) DeleteAsyncSearch(
181181

182182
func makeProtoRequestAggregations(sourceAggs []search.AggQuery) []*seqproxyapi.AggQuery {
183183
aggs := make([]*seqproxyapi.AggQuery, 0, len(sourceAggs))
184-
for _, agg := range sourceAggs {
184+
for _, a := range sourceAggs {
185185
agg := &seqproxyapi.AggQuery{
186-
Field: agg.Field,
187-
GroupBy: agg.GroupBy,
188-
Func: seqproxyapi.AggFunc(agg.Func),
189-
Quantiles: agg.Quantiles,
186+
Field: a.Field,
187+
GroupBy: a.GroupBy,
188+
Func: seqproxyapi.AggFunc(a.Func),
189+
Quantiles: a.Quantiles,
190+
}
191+
192+
if a.Interval != 0 {
193+
interval := seq.MIDToDuration(a.Interval).String()
194+
agg.Interval = &interval
190195
}
191196

192197
// Support legacy format in which field means groupBy.

storeapi/grpc_async_search.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ func convertAggQueriesToProto(query []processor.AggQuery) []*storeapi.AggQuery {
149149
if q.GroupBy != nil {
150150
pq.GroupBy = q.GroupBy.Field
151151
}
152+
if q.Interval != 0 {
153+
pq.Interval = q.Interval
154+
}
152155
res = append(res, pq)
153156
}
154157
return res

0 commit comments

Comments
 (0)