Skip to content

Commit

Permalink
indexer-alt: metric for affected row histogram (#20380)
Browse files Browse the repository at this point in the history
## Description

Add a metric to track the distribution of affected rows per database
transaction from the committer. This will help measure how many rows the
`sum_obj_types` pipeline is touching per write.

## Test plan

Local run, and test on deployment.

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
amnn authored Nov 22, 2024
1 parent 08b0ad2 commit 8da294b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/sui-indexer-alt/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ pub struct IndexerMetrics {
pub collector_gather_latency: HistogramVec,
pub collector_batch_size: HistogramVec,
pub committer_commit_latency: HistogramVec,
pub committer_tx_rows: HistogramVec,
pub watermark_gather_latency: HistogramVec,
pub watermark_commit_latency: HistogramVec,
pub watermark_pruner_read_latency: HistogramVec,
Expand Down Expand Up @@ -400,6 +401,14 @@ impl IndexerMetrics {
registry,
)
.unwrap(),
committer_tx_rows: register_histogram_vec_with_registry!(
"indexer_committer_tx_rows",
"Number of rows written to the database in a single database transaction by this committer",
&["pipeline"],
BATCH_SIZE_BUCKETS.to_vec(),
registry,
)
.unwrap(),
watermark_gather_latency: register_histogram_vec_with_registry!(
"indexer_watermark_gather_latency",
"Time taken to calculate the new high watermark after a write by this committer",
Expand Down
5 changes: 5 additions & 0 deletions crates/sui-indexer-alt/src/pipeline/concurrent/committer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ pub(super) fn committer<H: Handler + 'static>(
.with_label_values(&[H::NAME])
.inc_by(affected as u64);

metrics
.committer_tx_rows
.with_label_values(&[H::NAME])
.observe(affected as f64);

Ok(())
}
};
Expand Down
5 changes: 5 additions & 0 deletions crates/sui-indexer-alt/src/pipeline/sequential/committer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ pub(super) fn committer<H: Handler + 'static>(
.with_label_values(&[H::NAME])
.inc_by(affected as u64);

metrics
.committer_tx_rows
.with_label_values(&[H::NAME])
.observe(affected as f64);

metrics
.watermark_epoch_in_db
.with_label_values(&[H::NAME])
Expand Down

0 comments on commit 8da294b

Please sign in to comment.