Skip to content

Commit

Permalink
[forge] add swarm metrics for indexer processor latency
Browse files Browse the repository at this point in the history
  • Loading branch information
rustielin committed Oct 10, 2024
1 parent 136058a commit 2d2228e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
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
19 changes: 18 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,10 @@ 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"#;

let indexer_fullnode_processed_batch_samples = swarm
.query_range_metrics(
indexer_fullnode_processed_batch_query,
Expand Down Expand Up @@ -263,6 +267,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 +288,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))
}

0 comments on commit 2d2228e

Please sign in to comment.