Do not override context in existing child
passing context through a var declaration with the same name as the parent in a loop results in grandchildren-of-children without being tied to their parents.
@@ -645,7 +645,7 @@ func (p *gceProvider) apiRateLimit(ctx gocontext.Context) error {
// Sleep for up to 1 second
var span *trace.Span
if trace.FromContext(ctx) != nil {
- ctx, span = trace.StartSpan(ctx, "GCE.timeSleep.apiRateLimit")
+ _, span = trace.StartSpan(ctx, "GCE.timeSleep.apiRateLimit")
}
time.Sleep(time.Millisecond * time.Duration(mathrand.Intn(1000)))
@@ -1083,7 +1083,7 @@ func (p *gceProvider) stepWaitForInstanceIP(c *gceStartContext) multistep.StepAc
State: ProgressNeutral,
})
- ctx, span = trace.StartSpan(ctx, "GCE.timeSleep.WaitForInstanceIP")
+ _, span = trace.StartSpan(ctx, "GCE.timeSleep.WaitForInstanceIP")
time.Sleep(p.bootPrePollSleep)
span.End()
@@ -1162,7 +1162,7 @@ func (p *gceProvider) stepWaitForInstanceIP(c *gceStartContext) multistep.StepAc
c.progresser.Progress(&ProgressEntry{Message: ".", Raw: true})
var span *trace.Span
- ctx, span = trace.StartSpan(ctx, "GCE.timeSleep.afterInstanceInsertCompletion")
+ _, span = trace.StartSpan(ctx, "GCE.timeSleep.afterInstanceInsertCompletion")
time.Sleep(p.bootPollSleep)
span.End()
}
@@ -1628,7 +1628,7 @@ func (i *gceInstance) UploadScript(ctx gocontext.Context, script []byte) error {
i.progresser.Progress(&ProgressEntry{Message: ".", Raw: true})
var span *trace.Span
- ctx, span = trace.StartSpan(ctx, "GCE.timeSleep.uploadRetry")
+ _, span = trace.StartSpan(ctx, "GCE.timeSleep.uploadRetry")
time.Sleep(i.provider.uploadRetrySleep)
span.End()
