Skip to content

Commit

Permalink
GROW-639 - Add Missing analytics data
Browse files Browse the repository at this point in the history
  • Loading branch information
nirtayeb committed Mar 21, 2023
1 parent e1d83b9 commit 680585c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion protocol/rpcconsumer/rpcconsumer_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 680585c

Please sign in to comment.