diff --git a/glusterd2/transaction/rpc-client.go b/glusterd2/transaction/rpc-client.go index 5a5b8a2d0..373ac901c 100644 --- a/glusterd2/transaction/rpc-client.go +++ b/glusterd2/transaction/rpc-client.go @@ -16,7 +16,7 @@ import ( ) // runStepOn will run the step on the specified node -func runStepOn(step string, node uuid.UUID, c TxnCtx) error { +func runStepOn(origCtx netctx.Context, step string, node uuid.UUID, c TxnCtx) error { // TODO: I'm creating connections on demand. This should be changed so that // we have long term connections. p, err := peer.GetPeerF(node.String()) @@ -73,7 +73,7 @@ func runStepOn(step string, node uuid.UUID, c TxnCtx) error { var rsp *TxnStepResp - rsp, err = client.RunStep(netctx.TODO(), req) + rsp, err = client.RunStep(origCtx, req) if err != nil { logger.WithFields(log.Fields{ "error": err, diff --git a/glusterd2/transaction/rpc-service.go b/glusterd2/transaction/rpc-service.go index e040d7d98..bec886871 100644 --- a/glusterd2/transaction/rpc-service.go +++ b/glusterd2/transaction/rpc-service.go @@ -7,6 +7,7 @@ import ( "github.com/gluster/glusterd2/glusterd2/servers/peerrpc" log "github.com/sirupsen/logrus" + "go.opencensus.io/trace" "golang.org/x/net/context" "google.golang.org/grpc" ) @@ -37,6 +38,13 @@ func (p *txnSvc) RunStep(rpcCtx context.Context, req *TxnStepReq) (*TxnStepResp, logger = ctx.Logger().WithField("stepfunc", req.StepFunc) logger.Debug("RunStep request received") + if rpcCtx != nil { + reqID := ctx.GetTxnReqID() + spanName := req.StepFunc + " ReqID:" + reqID + _, span := trace.StartSpan(rpcCtx, spanName) + defer span.End() + } + f, ok = getStepFunc(req.StepFunc) if !ok { err = errors.New("step function not found in registry") diff --git a/glusterd2/transaction/step.go b/glusterd2/transaction/step.go index 2c8246c94..da2441377 100644 --- a/glusterd2/transaction/step.go +++ b/glusterd2/transaction/step.go @@ -139,7 +139,7 @@ func runStepFuncOnNode(origCtx context.Context, stepName string, ctx TxnCtx, nod err = runStepFuncLocally(origCtx, stepName, ctx) } else { // remote node - err = runStepOn(stepName, node, ctx) + err = runStepOn(origCtx, stepName, node, ctx) } respCh <- stepPeerResp{node, err}