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

add itemBasedAnalyzer; refactor evm analyzers accordingly #511

Merged
merged 1 commit into from Sep 12, 2023

Conversation

Andrew7234
Copy link
Collaborator

@Andrew7234 Andrew7234 commented Aug 30, 2023

https://app.clickup.com/t/866afuw9w

Reviewers: item.go is the main file of interest, please start there :)

Design spec:
https://docs.google.com/document/d/11JiEg5-FYXMxWEvizsXN7JdC3mTYS_nfKEm1_BxyaFA/edit#heading=h.fe8yeyiyi2yc

Todo:

  • itemBasedAnalyzer tests [x]
  • update metadata registry analyzer [x]
  • update node stats analyzer [x]
  • consolidate analyzer args into cfg struct [x]
  • node_stats and metadata_registry analyzers require more work to make them compatible with regression tests.. might put this in the e2e_regression test PR tho

Testing:
Added endpoints to the e2e tests to test the item based analyzers and compared the results between main and this branch. Results were out of order (since no order is specified for some endpoints) but identical as expected.

@Andrew7234 Andrew7234 self-assigned this Sep 5, 2023
@pro-wh pro-wh mentioned this pull request Sep 6, 2023
@Andrew7234 Andrew7234 marked this pull request as ready for review September 6, 2023 05:27
}

func (p *processor) GetItems(ctx context.Context, limit uint64) ([]common.ChainName, error) {
return []common.ChainName{common.ChainNameMainnet}, nil
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

note: for this and the node_stats analyzer, this fixed queue means that these analyzers are not yet compatible with the e2e_regression tests. This will likely need to be slightly reworked withstopOnEmptyBatch but I'd prefer to leave it for a future PR as this one is already somewhat long, and the regression tests do not currently test those analyzers so there is no loss of functionality.

Copy link
Collaborator

Choose a reason for hiding this comment

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

does this fully coincide with the use of fixedInterval?

Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 I'd say at least for now, let's just exclude those two analyzers from e2e tests because they don't interact with other analyzers in a very meaningful way. We can include them later perhaps, though I'm a little doubtful it's even worth the hassle.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

does this fully coincide with the use of fixedInterval?

currently yes

Copy link
Collaborator

@pro-wh pro-wh left a comment

Choose a reason for hiding this comment

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

👍 on item analyzer and analyzer refactors

Copy link
Collaborator

@mitjat mitjat left a comment

Choose a reason for hiding this comment

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

lotsa red! 🤘
and with tests ❤️

Looks good by and large, I have only one or two nontrivial comments.

Despite the new unit tests, can you please also run e2e tests? It's a pretty big systemic change.
When running locally, you don't need to worry about caches and/or analyzers supporting StopOnEmptyBatch ... just enable all analyzers in config, then manually run analysis, kill analyzers when you can tell from the logs they're done, and run run.sh (which you possibly want to extend with an endpoint or two to exercise all the analyzers).

return
}
// Update queueLength
a.sendQueueLengthMetric(ctx)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm a little worried that the SQL query that determines the queue length might end up being the most expensive operation of them all, which is hard to justify.
No action needed, just something to keep an eye on. We can make this more complicated and opt to only update the metric if it's older than a minute, or similar.

analyzer/metadata_registry/metadata_registry.go Outdated Show resolved Hide resolved
}

func (p *processor) GetItems(ctx context.Context, limit uint64) ([]common.ChainName, error) {
return []common.ChainName{common.ChainNameMainnet}, nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 I'd say at least for now, let's just exclude those two analyzers from e2e tests because they don't interact with other analyzers in a very meaningful way. We can include them later perhaps, though I'm a little doubtful it's even worth the hassle.

analyzer/node_stats/node_stats.go Show resolved Hide resolved
analyzer/item/item.go Show resolved Hide resolved
analyzer/item/item.go Outdated Show resolved Hide resolved
analyzer/evmverifier/evmverifier.go Outdated Show resolved Hide resolved
analyzer/evmverifier/evmverifier.go Outdated Show resolved Hide resolved
analyzer/evmtokens/evm_tokens.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@mitjat mitjat left a comment

Choose a reason for hiding this comment

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

Thank you! LGTM assuming e2e tests pass.

cmd/analyzer/analyzer.go Show resolved Hide resolved
analyzer/item/item.go Outdated Show resolved Hide resolved
analyzer/item/item.go Show resolved Hide resolved
cmd/analyzer/analyzer.go Outdated Show resolved Hide resolved
enable stopOnEmptyBatch

nit: pointer receivers

refactor node_stats and metadata_registry analyzers

move metadata_registry to own package

add itemBasedAnalyzer tests

adjust tests

nit

nits

test

nits

move closingChannel() to util

address comments

add interItemDelay flag

refactor item analyzer args into cfg

change stopOnEmptyBatch -> stopOnEmptyQueue

propagate error from batch; nit

linter

update tests

nit
@Andrew7234 Andrew7234 merged commit 83c6af0 into main Sep 12, 2023
6 checks passed
@Andrew7234 Andrew7234 deleted the andrew7234/item-based-analyzer branch September 12, 2023 18:13
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.

None yet

3 participants