Skip to content

Commit

Permalink
GROW-639 - Add Missing analytics data (#368)
Browse files Browse the repository at this point in the history
* GROW-639 - Add Missing analytics data

* Use CuSum from the relay session object
  • Loading branch information
nirtayeb authored Mar 28, 2023
1 parent 689db8b commit 424ad47
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
20 changes: 20 additions & 0 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29674,6 +29674,16 @@ paths:
in: query
required: false
type: boolean
- name: pagination.reverse
description: >-
reverse is set to true if results are to be returned in the
descending order.


Since: cosmos-sdk 0.43
in: query
required: false
type: boolean
tags:
- Query
'/lavanet/lava/epochstorage/fixated_params/{index}':
Expand Down Expand Up @@ -29933,6 +29943,16 @@ paths:
in: query
required: false
type: boolean
- name: pagination.reverse
description: >-
reverse is set to true if results are to be returned in the
descending order.


Since: cosmos-sdk 0.43
in: query
required: false
type: boolean
tags:
- Query
'/lavanet/lava/epochstorage/stake_storage/{index}':
Expand Down
9 changes: 8 additions & 1 deletion protocol/rpcconsumer/rpcconsumer_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,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 @@ -153,6 +153,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.RelaySession.CuSum
}

return returnedResult.Reply, returnedResult.ReplyServer, nil
}

Expand Down

0 comments on commit 424ad47

Please sign in to comment.