mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-06 02:00:46 +00:00
fixup
This commit is contained in:
1 file changed
+5
-5
@@ -18,7 +18,7 @@ use crate::job::job_loop::process_single_job_error::ProcessSingleJobError;
|
||||
use crate::job::job_loop::process_single_job_success_case::ProcessSingleJobSuccessCase;
|
||||
use crate::job_dependencies::JobDependencies;
|
||||
|
||||
use opentelemetry::{global as otel, KeyValue as OtelAttribute};
|
||||
use opentelemetry::{global as otel, KeyValue as OtelAttribute, metrics::Unit};
|
||||
|
||||
// Job runner timeouts (guards MySQL)
|
||||
const START_TIMEOUT_MILLIS : u64 = 500;
|
||||
@@ -124,7 +124,7 @@ async fn process_job_batch(job_dependencies: &JobDependencies, jobs: Vec<Availab
|
||||
let job_count = jobs.len();
|
||||
let meter = otel::meter(OTEL_METER_NAME);
|
||||
// TODO: total_duration as histogram for min/max/avg/percentiles
|
||||
let job_duration_metric = meter.i64_observable_gauge("job_duration").with_unit(metrics::Unit::new("ms")).init();
|
||||
let job_duration_metric = meter.i64_observable_gauge("job_duration").with_unit(Unit::new("ms")).init();
|
||||
|
||||
for (i, job) in jobs.into_iter().enumerate() {
|
||||
let start_time = Instant::now();
|
||||
@@ -155,12 +155,12 @@ async fn process_job_batch(job_dependencies: &JobDependencies, jobs: Vec<Availab
|
||||
}
|
||||
}
|
||||
let job_duration = Instant::now().duration_since(start_time);;
|
||||
job_duration_metric.observe(job_duration.as_millis(),
|
||||
job_duration_metric.observe(job_duration.as_millis() as i64,
|
||||
&[
|
||||
// TODO: need job_ prefix?
|
||||
OtelAttribute::new("job_id", format!("{}", job.id)),
|
||||
OtelAttribute::new("job_id", format!("{:?}", job.id)),
|
||||
OtelAttribute::new("job_inference_category", job.inference_category.to_str()),
|
||||
OtelAttribute::new("job_inference_token", job.inference_job_token.as_str()),
|
||||
OtelAttribute::new("job_inference_token", job.inference_job_token.as_str().to_owned()),
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user