diff --git a/crates/orchestrator/src/jobs/mod.rs b/crates/orchestrator/src/jobs/mod.rs index 5eeb3c98..3e1e532e 100644 --- a/crates/orchestrator/src/jobs/mod.rs +++ b/crates/orchestrator/src/jobs/mod.rs @@ -236,9 +236,7 @@ pub async fn process_job(id: Uuid, config: Arc) -> Result<(), JobError> Ok(Ok(external_id)) => { tracing::debug!(job_id = ?id, "Successfully processed job"); // Add the time of processing to the metadata. - if job.job_type == JobType::ProofCreation { - job.metadata.insert("processing_completed_at".to_string(), Utc::now().timestamp_millis().to_string()); - } + job.metadata.insert("processing_completed_at".to_string(), Utc::now().timestamp_millis().to_string()); external_id } Ok(Err(e)) => { @@ -357,16 +355,16 @@ pub async fn verify_job(id: Uuid, config: Arc) -> Result<(), JobError> { match verification_status { JobVerificationStatus::Verified => { tracing::info!(job_id = ?id, "Job verified successfully"); - if job.job_type == JobType::ProofCreation { - match job - .metadata - .get("processing_completed_at") - .and_then(|time| time.parse::().ok()) - .map(|start| Utc::now().timestamp_millis() - start) - { - Some(time_taken) => ORCHESTRATOR_METRICS.proving_time.record(time_taken as f64, &[]), - None => tracing::warn!("Failed to calculate proving time: Invalid or missing processing time"), - } + match job + .metadata + .get("processing_completed_at") + .and_then(|time| time.parse::().ok()) + .map(|start| Utc::now().timestamp_millis() - start) + { + Some(time_taken) => ORCHESTRATOR_METRICS + .verification_time + .record(time_taken as f64, &[KeyValue::new("operation_job_type", format!("{:?}", job.job_type))]), + None => tracing::warn!("Failed to calculate verification time: Invalid or missing processing time"), } let mut metadata = job.metadata.clone(); metadata.remove("processing_completed_at"); diff --git a/crates/orchestrator/src/metrics.rs b/crates/orchestrator/src/metrics.rs index e4726526..9fddfbe7 100644 --- a/crates/orchestrator/src/metrics.rs +++ b/crates/orchestrator/src/metrics.rs @@ -12,7 +12,7 @@ pub struct OrchestratorMetrics { pub successful_job_operations: Counter, pub failed_job_operations: Counter, pub failed_jobs: Counter, - pub proving_time: Gauge, + pub verification_time: Gauge, pub jobs_response_time: Gauge, pub db_calls_response_time: Gauge, } @@ -58,10 +58,10 @@ impl Metrics for OrchestratorMetrics { "jobs".to_string(), ); - let proving_time = register_gauge_metric_instrument( + let verification_time = register_gauge_metric_instrument( &orchestrator_meter, - "proving_time".to_string(), - "A gauge to show the time taken for proving task".to_string(), + "verification_time".to_string(), + "A gauge to show the time taken for verification of tasks".to_string(), "ms".to_string(), ); @@ -84,7 +84,7 @@ impl Metrics for OrchestratorMetrics { successful_job_operations, failed_job_operations, failed_jobs, - proving_time, + verification_time, jobs_response_time, db_calls_response_time, }