[VOL-3070]Enrich span with 'device-id' and propagate context into go routine carrying the span information
Change-Id: I6509de7542942dbcc29a090a47ff0a2732507860
diff --git a/rw_core/core/device/agent_port.go b/rw_core/core/device/agent_port.go
index 2840235..8e68318 100644
--- a/rw_core/core/device/agent_port.go
+++ b/rw_core/core/device/agent_port.go
@@ -84,7 +84,7 @@
// TODO: VOL-2707
logger.Warnw(ctx, "unable-to-update-logical-port-state", log.Fields{"error": err})
}
- }(portID, context.Background())
+ }(portID, log.WithSpanFromContext(context.Background(), ctx))
}
}
portHandle.Unlock()
@@ -242,7 +242,7 @@
if err != nil {
return err
}
- subCtx, cancel := context.WithTimeout(context.Background(), agent.defaultTimeout)
+ subCtx, cancel := context.WithTimeout(log.WithSpanFromContext(context.Background(), ctx), agent.defaultTimeout)
ch, err := agent.adapterProxy.DisablePort(ctx, device, &newPort)
if err != nil {
cancel()
@@ -278,7 +278,7 @@
if err != nil {
return err
}
- subCtx, cancel := context.WithTimeout(context.Background(), agent.defaultTimeout)
+ subCtx, cancel := context.WithTimeout(log.WithSpanFromContext(context.Background(), ctx), agent.defaultTimeout)
ch, err := agent.adapterProxy.EnablePort(ctx, device, &newPort)
if err != nil {
cancel()