@ -493,7 +493,7 @@ func (ng *Engine) populateSeries(ctx context.Context, q storage.Queryable, s *Ev
level . Error ( ng . logger ) . Log ( "msg" , "error selecting series set" , "err" , err )
level . Error ( ng . logger ) . Log ( "msg" , "error selecting series set" , "err" , err )
return err
return err
}
}
n . series , err = expandSeriesSet ( set)
n . series , err = expandSeriesSet ( ctx, set)
if err != nil {
if err != nil {
// TODO(fabxc): use multi-error.
// TODO(fabxc): use multi-error.
level . Error ( ng . logger ) . Log ( "msg" , "error expanding series set" , "err" , err )
level . Error ( ng . logger ) . Log ( "msg" , "error expanding series set" , "err" , err )
@ -508,7 +508,7 @@ func (ng *Engine) populateSeries(ctx context.Context, q storage.Queryable, s *Ev
level . Error ( ng . logger ) . Log ( "msg" , "error selecting series set" , "err" , err )
level . Error ( ng . logger ) . Log ( "msg" , "error selecting series set" , "err" , err )
return err
return err
}
}
n . series , err = expandSeriesSet ( set)
n . series , err = expandSeriesSet ( ctx, set)
if err != nil {
if err != nil {
level . Error ( ng . logger ) . Log ( "msg" , "error expanding series set" , "err" , err )
level . Error ( ng . logger ) . Log ( "msg" , "error expanding series set" , "err" , err )
return err
return err
@ -538,8 +538,13 @@ func extractFuncFromPath(p []Node) string {
return extractFuncFromPath ( p [ : len ( p ) - 1 ] )
return extractFuncFromPath ( p [ : len ( p ) - 1 ] )
}
}
func expandSeriesSet ( it storage . SeriesSet ) ( res [ ] storage . Series , err error ) {
func expandSeriesSet ( ctx context . Context , it storage . SeriesSet ) ( res [ ] storage . Series , err error ) {
for it . Next ( ) {
for it . Next ( ) {
select {
case <- ctx . Done ( ) :
return nil , ctx . Err ( )
default :
}
res = append ( res , it . At ( ) )
res = append ( res , it . At ( ) )
}
}
return res , it . Err ( )
return res , it . Err ( )