Skip to content

Commit

Permalink
fix(bridge-withdrawer): also set metric when value 0 (#1771)
Browse files Browse the repository at this point in the history
## Summary
The metric `batch_total_settled_value` was not being set to zero when
blocks where empty, resulting in maintaining previous value and
resetting incorrectly when no txs processed.

## Changes
- Updated metric to be set to 0 when block is empty

## Changelogs
Changelogs updated.

## Metrics
- `batch_total_settled_value` improved
  • Loading branch information
joroshiba authored Oct 31, 2024
1 parent ca72c64 commit 5fc9c56
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
4 changes: 4 additions & 0 deletions crates/astria-bridge-withdrawer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Set `batch_total_settled_value` metric to 0 when no withdrawals are settled [#1778](https://github.com/astriaorg/astria/pull/1768)

## [1.0.0] - 2024-10-25

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,17 +380,16 @@ async fn get_and_forward_block_events(
if actions.is_empty() {
info!(
"no withdrawal actions found for block `{block_hash}` at rollup height \
`{rollup_height}; skipping"
`{rollup_height}"
);
} else {
submitter_handle
.send_batch(Batch {
actions,
rollup_height,
})
.await
.wrap_err("failed to send batched events; receiver dropped?")?;
}
submitter_handle
.send_batch(Batch {
actions,
rollup_height,
})
.await
.wrap_err("failed to send batched events; receiver dropped?")?;

Ok(())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ impl Submitter {
metrics,
..
} = self;

if actions.is_empty() {
metrics.set_batch_total_settled_value(0);

return Ok(());
}

// get nonce and make unsigned transaction
let nonce = get_pending_nonce(
sequencer_grpc_client.clone(),
Expand Down

0 comments on commit 5fc9c56

Please sign in to comment.