mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-17 12:28:07 +00:00
Update Task Heartbeat to include Job_id (#594)
This commit is contained in:
@ -47,7 +47,7 @@ impl CommonConfig {
|
||||
pub async fn init_heartbeat(&self) -> Result<Option<TaskHeartbeatClient>> {
|
||||
match &self.heartbeat_queue {
|
||||
Some(url) => {
|
||||
let hb = init_task_heartbeat(url.clone(), self.task_id).await?;
|
||||
let hb = init_task_heartbeat(url.clone(), self.task_id, self.job_id).await?;
|
||||
Ok(Some(hb))
|
||||
}
|
||||
None => Ok(None),
|
||||
|
@ -26,18 +26,24 @@ struct Heartbeat {
|
||||
#[derive(Clone)]
|
||||
pub struct TaskContext {
|
||||
task_id: Uuid,
|
||||
job_id: Uuid,
|
||||
machine_id: Uuid,
|
||||
machine_name: String,
|
||||
}
|
||||
|
||||
pub type TaskHeartbeatClient = HeartbeatClient<TaskContext, HeartbeatData>;
|
||||
|
||||
pub async fn init_task_heartbeat(queue_url: Url, task_id: Uuid) -> Result<TaskHeartbeatClient> {
|
||||
pub async fn init_task_heartbeat(
|
||||
queue_url: Url,
|
||||
task_id: Uuid,
|
||||
job_id: Uuid,
|
||||
) -> Result<TaskHeartbeatClient> {
|
||||
let machine_id = get_machine_id().await?;
|
||||
let machine_name = get_machine_name().await?;
|
||||
let hb = HeartbeatClient::init_heartbeat(
|
||||
TaskContext {
|
||||
task_id,
|
||||
job_id,
|
||||
machine_id,
|
||||
machine_name,
|
||||
},
|
||||
|
Reference in New Issue
Block a user