diff --git a/protocol/rpcconsumer/rpcconsumer_server.go b/protocol/rpcconsumer/rpcconsumer_server.go index ef54b1723c..f93a871dd6 100644 --- a/protocol/rpcconsumer/rpcconsumer_server.go +++ b/protocol/rpcconsumer/rpcconsumer_server.go @@ -90,7 +90,7 @@ func (rpccs *RPCConsumerServer) SendRelay( // compares the result with other providers if defined so // compares the response with other consumer wallets if defined so // asynchronously sends data reliability if necessary - + relaySentTime := time.Now() chainMessage, err := rpccs.chainParser.ParseMsg(url, []byte(req), connectionType) if err != nil { return nil, nil, err @@ -148,6 +148,13 @@ func (rpccs *RPCConsumerServer) SendRelay( // TODO: go over rpccs.requiredResponses and get majority returnedResult = iteratedResult } + + if analytics != nil { + currentLatency := time.Since(relaySentTime) + analytics.Latency = currentLatency.Milliseconds() + analytics.ComputeUnits = returnedResult.Request.CuSum + } + return returnedResult.Reply, returnedResult.ReplyServer, nil }