Skip to content

Commit

Permalink
[forge] add metrics for indexer processor latency & tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
rustielin committed Oct 10, 2024
1 parent 85bba15 commit cc13744
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/forge-unstable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ jobs:
secrets: inherit
with:
IMAGE_TAG: ${{ needs.determine-test-metadata.outputs.IMAGE_TAG }}
FORGE_NAMESPACE: forge-indexer-test-${{ needs.determine-test-metadata.outputs.BRANCH_HASH }}
COMMENT_HEADER: forge-indexer
FORGE_TEST_SUITE: indexer_test
FORGE_ENABLE_INDEXER: true
2 changes: 1 addition & 1 deletion testsuite/forge-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2400,7 +2400,7 @@ fn indexer_test() -> ForgeConfig {
(
TransactionWorkload::new(TransactionTypeArg::TokenV2AmbassadorMint, 20000)
.with_unique_senders(),
(3200, 0.5, 0.5, 0.5),
(2000, 0.5, 0.5, 0.5),
),
(
TransactionWorkload::new(TransactionTypeArg::PublishPackage, 200)
Expand Down
20 changes: 19 additions & 1 deletion testsuite/forge/src/interface/prometheus_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub enum LatencyBreakdownSlice {
IndexerFullnodeProcessedBatch,
IndexerCacheWorkerProcessedBatch,
IndexerDataServiceAllChunksSent,
// TODO: add processor insertion into DB latency
IndexerProcessorLatency,
}

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -236,6 +236,11 @@ pub async fn fetch_latency_breakdown(
let indexer_data_service_all_chunks_sent_query =
r#"max(indexer_grpc_duration_in_secs{step="4", service_type="data_service"})"#;

// These are the non-SDK core indexer processors
let indexer_processor_latency_query =
r#"max by (processor_name) indexer_processor_data_processed_latency_in_secs"#;
// These are the SDK processor latencies TODO

let indexer_fullnode_processed_batch_samples = swarm
.query_range_metrics(
indexer_fullnode_processed_batch_query,
Expand Down Expand Up @@ -263,6 +268,15 @@ pub async fn fetch_latency_breakdown(
)
.await?;

let indexer_processor_latency_samples = swarm
.query_range_metrics(
indexer_processor_latency_query,
start_time as i64,
end_time as i64,
None,
)
.await?;

samples.insert(
LatencyBreakdownSlice::IndexerFullnodeProcessedBatch,
MetricSamples::new(indexer_fullnode_processed_batch_samples),
Expand All @@ -275,6 +289,10 @@ pub async fn fetch_latency_breakdown(
LatencyBreakdownSlice::IndexerDataServiceAllChunksSent,
MetricSamples::new(indexer_data_service_all_chunks_sent_samples),
);
samples.insert(
LatencyBreakdownSlice::IndexerProcessorLatency,
MetricSamples::new(indexer_processor_latency_samples),
);
}
Ok(LatencyBreakdown::new(samples))
}
2 changes: 1 addition & 1 deletion testsuite/forge/src/success_criteria.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl MetricsThreshold {
}

if metrics.is_empty() {
bail!("Empty metrics provided");
bail!("Empty metrics provided for {}", metrics_name);
}
let breach_count = metrics
.iter()
Expand Down

0 comments on commit cc13744

Please sign in to comment.