Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Count eth transactions and errors #1051

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

gvelez17
Copy link
Contributor

@gvelez17 gvelez17 commented May 30, 2023

Count Eth transactions and errors - #PLAT-1511

Description

We probably want to be alerted on eth insufficient funds and other eth transaction errors. Count the errors and also the totals. (we expect the totals to match the anchors)

How Has This Been Tested?

  • [ x] Unit tests

Definition of Done

Before submitting this PR, please make sure:

  • [x ] The work addresses the description and outcomes in the issue
  • [ x] My code follows conventions, is well commented, and easy to understand
  • [ x] My code builds and tests pass without any errors or warnings
  • [ ]x I have tagged the relevant reviewers

References:

Please list relevant documentation (e.g. tech specs, articles, related work etc.) relevant to this change, and note if the documentation has been updated.

@gvelez17 gvelez17 changed the title clean changes for metrics on eth transactions Count eth transactions and errors Jun 12, 2023
@gvelez17 gvelez17 marked this pull request as ready for review June 12, 2023 19:16
@gvelez17
Copy link
Contributor Author

Hey @stephhuynh18 this is the one you looked at before, its not addressing the infura api limits but i didn't want to discard it since i think we do want an alert on eth transaction errors

@@ -420,6 +423,7 @@ export class EthereumBlockchainService implements BlockchainService {
} catch (err: any) {
logger.err(err)
const { code } = err
Metrics.count(METRIC_NAMES.ETH_REQUEST_ERROR_TOTAL, 1, {'error_code': code})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a case where this "should" fail. Ex. First attempt is successful but times out before it can return success. Second attempt fails because the first attempt was successful (the error is nonce expired). Instead of throwing the error we check if the first attempt was successful.

If this count disregards the above scenario then you can also disregard this comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok yeah that would change the behavior aside from metrics - i guess i will defer this or icebox for now, bc i think changing the error behavior of cas is out of scope from measuring the things

The code should have something to do with the reason but not sure if it will sort these...

@@ -410,6 +412,7 @@ export class EthereumBlockchainService implements BlockchainService {
const txData = await this._buildTransactionRequest(rootCid)
const txResponses: Array<TransactionResponse> = []

Metrics.count(METRIC_NAMES.ETH_REQUEST_TOTAL, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this metric represent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah its just for comparing to the error total - its like how many times did we make an eth transaction request, vs how many times it errored

it might also be the same as the number of anchors but unless we have knowledge of the code we don't know that for sure

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes currently this should corresponding to the number of anchors. Do you want this to include the number of retries? If so then you should move it into the try block after _trySendTransaction.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think i want to move it to include retries, its just for the purpose of comparing to errors. we could remove it entirely and just count the errors maybe

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think i want to move it to include retries, its just for the purpose of comparing to errors. we could remove it entirely and just count the errors maybe

I think that makes sense

@gvelez17 gvelez17 marked this pull request as draft July 18, 2023 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants