mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-19 08:01:25 +00:00
improve metrics
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* LICENSE-AGPL for a copy of the license.
|
||||
*/
|
||||
|
||||
use std::time::SystemTime;
|
||||
// use std::time::SystemTime;
|
||||
|
||||
use sqlx::{Pool, Postgres, Transaction};
|
||||
use tracing::instrument;
|
||||
@@ -159,7 +159,7 @@ pub async fn add_completed_job(
|
||||
.execute(&mut tx)
|
||||
.await
|
||||
.map_err(|e| Error::InternalErr(format!("Could not add completed job {job_id}: {e}")))?;
|
||||
println!("{:?}", SystemTime::now());
|
||||
// println!("{:?}", SystemTime::now());
|
||||
|
||||
let _ = delete_job(db, &queued_job.workspace_id, job_id).await?;
|
||||
if !queued_job.is_flow_step
|
||||
|
||||
@@ -794,11 +794,13 @@ pub async fn run_worker(
|
||||
.inc();
|
||||
}
|
||||
|
||||
let metrics = Metrics {
|
||||
worker_execution_failed: worker_execution_failed
|
||||
.get(&language)
|
||||
.expect("no timer found").clone(),
|
||||
};
|
||||
let metrics = if *METRICS_ENABLED {
|
||||
Some(Metrics {
|
||||
worker_execution_failed: worker_execution_failed
|
||||
.get(&language)
|
||||
.expect("no timer found").clone(),
|
||||
})
|
||||
} else { None };
|
||||
|
||||
let job_root = job.root_job.map(|x| x.to_string()).unwrap_or_else(|| "none".to_string());
|
||||
tracing::info!(worker = %worker_name, id = %job.id, root_id = %job_root, "fetched job {}, root job: {}", job.id, job_root);
|
||||
@@ -856,7 +858,7 @@ pub async fn run_worker(
|
||||
&authed_client.get_authed().await,
|
||||
job,
|
||||
err,
|
||||
Some(metrics),
|
||||
metrics,
|
||||
false,
|
||||
same_worker_tx.clone(),
|
||||
&worker_dir,
|
||||
@@ -1003,7 +1005,7 @@ async fn handle_queued_job(
|
||||
worker_name: &str,
|
||||
worker_dir: &str,
|
||||
job_dir: &str,
|
||||
metrics: Metrics,
|
||||
metrics: Option<Metrics>,
|
||||
same_worker_tx: Sender<Uuid>,
|
||||
base_internal_url: &str,
|
||||
) -> windmill_common::error::Result<()> {
|
||||
@@ -1102,7 +1104,7 @@ async fn handle_queued_job(
|
||||
&job.workspace_id,
|
||||
true,
|
||||
r,
|
||||
Some(metrics.clone()),
|
||||
metrics.clone(),
|
||||
false,
|
||||
same_worker_tx.clone(),
|
||||
worker_dir,
|
||||
@@ -1143,7 +1145,7 @@ async fn handle_queued_job(
|
||||
};
|
||||
|
||||
let result =
|
||||
add_completed_job_error(db, &job, logs, error_value, Some(metrics.clone()))
|
||||
add_completed_job_error(db, &job, logs, error_value, metrics.clone())
|
||||
.await?;
|
||||
if job.is_flow_step {
|
||||
if let Some(parent_job) = job.parent_job {
|
||||
@@ -1155,7 +1157,7 @@ async fn handle_queued_job(
|
||||
&job.workspace_id,
|
||||
false,
|
||||
result,
|
||||
Some(metrics),
|
||||
metrics,
|
||||
false,
|
||||
same_worker_tx,
|
||||
worker_dir,
|
||||
|
||||
Reference in New Issue
Block a user