Skip to content

Commit

Permalink
Add GetTransactionExecutionMetricsAfter (#1501)
Browse files Browse the repository at this point in the history
* added GetTransactionExecutionMetricsAfter

* move new proto methods to execution

* update comment in protobuf method

* cleanup unnecesary changes

* expand comments

* Update protobuf/flow/execution/execution.proto

Co-authored-by: Leo Zhang <[email protected]>

---------

Co-authored-by: Leo Zhang <[email protected]>
  • Loading branch information
janezpodhostnik and zhangchiqing authored Sep 4, 2024
1 parent b600cd0 commit 8519ab2
Show file tree
Hide file tree
Showing 3 changed files with 498 additions and 89 deletions.
83 changes: 74 additions & 9 deletions protobuf/flow/execution/execution.proto
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,22 @@ service ExecutionAPI {
rpc GetTransactionResultsByBlockID(GetTransactionsByBlockIDRequest)
returns (GetTransactionResultsResponse);

// GetTransactionErrorMessage gets the error messages of a failed transaction by id.
// GetTransactionErrorMessage gets the error messages of a failed transaction
// by id.
rpc GetTransactionErrorMessage(GetTransactionErrorMessageRequest)
returns (GetTransactionErrorMessageResponse);
returns (GetTransactionErrorMessageResponse);

// GetTransactionErrorMessageByIndex gets the error messages of a failed transaction at the index.
rpc GetTransactionErrorMessageByIndex(GetTransactionErrorMessageByIndexRequest)
returns (GetTransactionErrorMessageResponse);
// GetTransactionErrorMessageByIndex gets the error messages of a failed
// transaction at the index.
rpc GetTransactionErrorMessageByIndex(
GetTransactionErrorMessageByIndexRequest)
returns (GetTransactionErrorMessageResponse);

// GetTransactionErrorMessagesByBlockID gets the error messages of all failed transactions in the
// block ordered by transaction index.
rpc GetTransactionErrorMessagesByBlockID(GetTransactionErrorMessagesByBlockIDRequest)
returns (GetTransactionErrorMessagesResponse);
// GetTransactionErrorMessagesByBlockID gets the error messages of all failed
// transactions in the block ordered by transaction index.
rpc GetTransactionErrorMessagesByBlockID(
GetTransactionErrorMessagesByBlockIDRequest)
returns (GetTransactionErrorMessagesResponse);

// Registers

Expand All @@ -75,9 +79,24 @@ service ExecutionAPI {
// GetLatestBlockHeader gets the latest sealed or unsealed block header.
rpc GetLatestBlockHeader(GetLatestBlockHeaderRequest)
returns (BlockHeaderResponse);

// GetBlockHeaderByID gets a block header by ID.
rpc GetBlockHeaderByID(GetBlockHeaderByIDRequest)
returns (BlockHeaderResponse);

// GetTransactionExecutionMetricsAfter gets the transaction execution metrics
// for blocks after the given block height. The blocks will be sorted by
// descending block height.
// If no data is available for the given block height, the response will be
// empty. The execution node will only store metrics for a limited number of
// blocks,  so the request may return an empty response if the requested
// block height is too far in the past.
//
// Errors:
// - No errors are expected.
rpc GetTransactionExecutionMetricsAfter(
GetTransactionExecutionMetricsAfterRequest)
returns (GetTransactionExecutionMetricsAfterResponse);
}

// Ping
Expand Down Expand Up @@ -211,3 +230,49 @@ message GetBlockHeaderByIDRequest {
message BlockHeaderResponse {
entities.BlockHeader block = 1;
}


// The request for GetTransactionExecutionMetricsAfter
message GetTransactionExecutionMetricsAfterRequest {
// Block height after which to get transaction execution metrics.
// this block height will not be included in the response.
uint64 block_height = 1;
}

// The response for GetTransactionExecutionMetricsAfter
// The response contains the execution metrics for transactions in each block
// after the requested block height (block_height + 1). The execution node only keeps a limited
// number of blocks in memory, so the response may not contain metrics for all
// blocks. Only finalized and executed blocks will be in the response.
// The blocks are sorted by block height in descending order.
message GetTransactionExecutionMetricsAfterResponse {
// the execution effort weight of a computation kind
message ExecutionEffortWeight {
// computation kind id
uint64 kind = 1;
// the weight of the computation kind
uint64 weight = 2;
}

// the data for one transaction
message Transaction {
// the transaction id
bytes transaction_id = 1;
// the execution time of the transaction in nanoseconds
uint64 execution_time = 2;
// the execution effort weights of the transaction
repeated ExecutionEffortWeight execution_effort_weights = 3;
}

// the data for one block
message Result {
// the block height of the block
uint64 block_height = 1;
// the list of transactions in the block
repeated Transaction transactions = 2;
}

// a list of results for each block sorted by block height in
// descending order
repeated Result results = 1;
}
Loading

0 comments on commit 8519ab2

Please sign in to comment.