refactor: add reporting module to framework #673
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This moves all generalizable code dealing with logging, metrics and Kafka reporting into a
reporting
module inside the framework and refactors the existing gateway to use that.What's good is that everything is generalizable, except for reporting client and indexer queries to Kafka, because the shape of these queries are specific to subgraphs. Therefor, the gateway now passes an event filter to the Kafka client to report any matching events with custom logic, which is defined via an event handler. This filtering and reporting was previously done inside the Kafka code, now it's customizable. That's all that really changes.
NOTE: I've tested that this still compiles, and I'm confident it doesn't break anything. But it may be worth testing locally or on testnet before rolling this out via a gateway release.