-
Notifications
You must be signed in to change notification settings - Fork 1
expose prometheus metrics + cloudrun compatible #24
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address the comments and I'll make the review
My idealism and tediousness don't allow me to concentrate on the main things
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't seen this in action. After you address the comments, please help @ecp88 to launch this
8c6404c
to
c05f926
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please re-check the messages that we already have in the PR?
E.g., this one is ignored
https://github.com/near/near-indexer-events/pull/24/files#r1031328820
After you fix the issue, please mark the message as resolved. If you doubt in the proposed solution, leave the thread unresolved and ask any questions/leave the comments in the same thread
Also, please have a look at khorolets/near-indexer-for-explorer#14 , it's better to use the same approach
Thank you @telezhnaya! I'll keep this in mind for future PRs. Unfortunately, I do not think we can use the same approach as in this PR. The Default provider searches in .aws/credentials for credential details, while we need to be able to pass in these details as environment variables so we can configure it from Cloud Run for example. I pushed another update to this PR which hides setting up configuration details from the Update: Yes we can use this approach. We just need to make sure the env variables comply with what the AWS credentials provider expects. |
In this case, we have to revert khorolets/near-indexer-for-explorer#14 as well, right? We will have the same deploy process anyway |
Yes, that is correct |
@telezhnaya @roshaans The default credentials provider will also source from the environment, but note that it looks for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for smaller set of changes!
I kindly ask you further not to ignore the comments I'm leaving. I'm waiting that you either
- fix the issue (and try to remember the idea and not to repeat such issues further)
OR - argue and explain your approach (I highly welcome this)
As any other reviewer, I feel demotivated when I have to repeat the same comments, especially in the same review at the same lines.
src/main.rs
Outdated
} | ||
|
||
async fn handle_streamer_message( | ||
streamer_message: near_indexer_primitives::StreamerMessage, | ||
pool: &sqlx::Pool<sqlx::Postgres>, | ||
) -> anyhow::Result<u64> { | ||
metrics::BLOCK_PROCESSED_TOTAL.inc(); | ||
metrics::LATEST_BLOCK_HEIGHT.set(streamer_message.block.header.height.try_into().unwrap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've already told you about unwrap
in general and this cast in particular.
It gives unreadable error, we won't be able to investigate this in production.
Moreover, here you silently do the cast that we actually can't do because u64 could not be safely casted to i64.
I asked you to leave the comment why we have to do this, and I'm asking you again. Please be more careful to the comments in the review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have waited for your feedback before resolving the conversation -> #24 (comment)
I've added a comment and converted it in a way that it will propagate a meaningful error.
@morgsmccauley you might want to take care of this later
https://github.com/khorolets/near-indexer-for-explorer/blob/0bdd70e919c3781df9bf2dc900b2e2d73b5257cb/indexer/src/main.rs#L26
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lazy_static! { | ||
pub static ref BLOCK_PROCESSED_TOTAL: IntCounter = try_create_int_counter( | ||
"indexer_events_total_blocks_processed", | ||
"Total number of blocks processed by indexer regardless of restarts. Used to calculate Block Processing Rate(BPS)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better, thank you!
This PR enables us to look into the performance of the micro-indexers and makes them compatible with GCP's Cloud Run service.
/metrics
- Block Processing Speed
- Latest Block Height indexed by Indexer