Skip to content

Commit

Permalink
Do not declare reference, instead declare value object
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
  • Loading branch information
pedro-stanaka committed May 23, 2024
1 parent 8fcb50a commit 847f0d4
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions pkg/query/remote_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func (r *remoteQuery) Exec(ctx context.Context) *promql.Result {
result = make(promql.Vector, 0)
warnings annotations.Annotations
builder = labels.NewScratchBuilder(8)
qryStats *querypb.QueryStats
qryStats querypb.QueryStats
)
for {
msg, err := qry.Recv()
Expand All @@ -307,7 +307,7 @@ func (r *remoteQuery) Exec(ctx context.Context) *promql.Result {
continue
}
if s := msg.GetStats(); s != nil {
qryStats = s
qryStats = *s
continue
}

Expand All @@ -325,10 +325,8 @@ func (r *remoteQuery) Exec(ctx context.Context) *promql.Result {
result = append(result, promql.Sample{Metric: builder.Labels(), F: ts.Samples[0].Value, T: r.start.UnixMilli()})
}
}
if qryStats != nil {
r.samplesStats.UpdatePeak(int(qryStats.PeakSamples))
r.samplesStats.TotalSamples = qryStats.SamplesTotal
}
r.samplesStats.UpdatePeak(int(qryStats.PeakSamples))
r.samplesStats.TotalSamples = qryStats.SamplesTotal

return &promql.Result{
Value: result,
Expand Down Expand Up @@ -359,7 +357,7 @@ func (r *remoteQuery) Exec(ctx context.Context) *promql.Result {
result = make(promql.Matrix, 0)
warnings annotations.Annotations
builder = labels.NewScratchBuilder(8)
qryStats *querypb.QueryStats
qryStats querypb.QueryStats
)
for {
msg, err := qry.Recv()
Expand All @@ -375,7 +373,7 @@ func (r *remoteQuery) Exec(ctx context.Context) *promql.Result {
continue
}
if s := msg.GetStats(); s != nil {
qryStats = s
qryStats = *s
continue
}

Expand Down Expand Up @@ -403,10 +401,8 @@ func (r *remoteQuery) Exec(ctx context.Context) *promql.Result {
}
result = append(result, series)
}
if qryStats != nil {
r.samplesStats.UpdatePeak(int(qryStats.PeakSamples))
r.samplesStats.TotalSamples = qryStats.SamplesTotal
}
r.samplesStats.UpdatePeak(int(qryStats.PeakSamples))
r.samplesStats.TotalSamples = qryStats.SamplesTotal

return &promql.Result{Value: result, Warnings: warnings}
}
Expand Down

0 comments on commit 847f0d4

Please sign in to comment.