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

Create metrics to track block ingestion and GraphQL query execution #1403

Merged
merged 8 commits into from
Dec 13, 2019

Conversation

fordN
Copy link
Contributor

@fordN fordN commented Dec 11, 2019

This PR creates two new metrics structs for instrumenting the Block Ingestor and the GraphQL server.

  1. BlockIngestorMetrics with a gauge vec to track the number of blocks being synced from Ethereum, labeled by networks name.

  2. GraphQLServiceMetrics which includes a histogram vec for tracking query execution time of successful queries, labeled by subgraph deployment id.

@fordN fordN requested review from Jannis and a team December 11, 2019 22:10
chain/ethereum/src/block_ingestor.rs Outdated Show resolved Hide resolved
chain/ethereum/src/block_ingestor.rs Outdated Show resolved Hide resolved
chain/ethereum/src/block_ingestor.rs Outdated Show resolved Hide resolved
chain/ethereum/src/block_ingestor.rs Outdated Show resolved Hide resolved
@@ -115,6 +147,10 @@ where
LogCode::BlockIngestionStatus
};
if distance > 0 {
self.ingestor_metrics.observe_blocks_synced(
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not the right place IMHO. At this point we have't written the block to our db yet, so as far as our system is concerned, we are not up to date with the chain yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

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'm not sure I follow how that would work. Also generally, it is tricky because ingest_blocks() will get called again for any missing blocks.

What about observing the chain_head_number from the ChainHeadUpdateListener?

Copy link
Contributor

Choose a reason for hiding this comment

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

I like that idea!

chain/ethereum/src/block_ingestor.rs Outdated Show resolved Hide resolved
server/http/src/server.rs Outdated Show resolved Hide resolved
server/http/src/service.rs Outdated Show resolved Hide resolved
server/http/src/service.rs Outdated Show resolved Hide resolved
server/http/src/service.rs Show resolved Hide resolved
@fordN fordN force-pushed the ford/ingestor-and-query-metrics branch from 801f0b6 to 0a08711 Compare December 12, 2019 22:43
server/http/src/service.rs Outdated Show resolved Hide resolved
store/postgres/src/chain_head_listener.rs Show resolved Hide resolved
@fordN fordN requested a review from Jannis December 13, 2019 16:37
@fordN fordN force-pushed the ford/ingestor-and-query-metrics branch from 512085d to 7ee9d96 Compare December 13, 2019 17:12
@fordN fordN merged commit 86f10ae into master Dec 13, 2019
@fordN fordN deleted the ford/ingestor-and-query-metrics branch April 2, 2020 08:43
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

4 participants