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

feat: Add metric for receiver block backfill failures #912

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions block-streamer/src/block_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,14 @@ async fn process_bitmap_indexer_blocks(

let mut last_published_block_height: u64 = start_block_height;

let indexer_name = indexer.get_full_name();

while let Some(block_height_result) = matching_block_heights.next().await {
match block_height_result {
Ok(block_height) => {
metrics::RECEIVER_BLOCKS_FAILURE
.with_label_values(&[&indexer_name])
.set(0);
redis
.publish_block(indexer, redis_stream.clone(), block_height, MAX_STREAM_SIZE)
.await?;
Expand All @@ -422,6 +427,9 @@ async fn process_bitmap_indexer_blocks(
last_published_block_height = block_height;
}
Err(err) => {
metrics::RECEIVER_BLOCKS_FAILURE
.with_label_values(&[&indexer_name])
.inc();
tracing::error!(
"Backfill using bitmap indexer failed unexpectedly: {:?}",
err
Expand Down
6 changes: 6 additions & 0 deletions block-streamer/src/graphql/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ impl GraphQLClientImpl {
.json(&body)
.send()
.await?;
if reqwest_response.status() != 200 {
tracing::error!(
"GraphQL query failed with status code: {}",
reqwest_response.status()
);
}

reqwest_response.json().await
}
Expand Down
6 changes: 6 additions & 0 deletions block-streamer/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ lazy_static! {
&["indexer"]
)
.unwrap();
pub static ref RECEIVER_BLOCKS_FAILURE: IntGaugeVec = register_int_gauge_vec!(
"queryapi_block_streamer_receiver_blocks_failure",
"Gauge which only has a nonzero value if an error occurs during receiver block backfill",
&["indexer"]
)
.unwrap();
}

pub struct LogCounter;
Expand Down
Loading