mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-18 12:48:07 +00:00
add roles to agent & supervisor (#527)
This commit is contained in:
@ -5,7 +5,7 @@
|
|||||||
use crate::tasks::{analysis, coverage, fuzz, heartbeat::*, merge, report};
|
use crate::tasks::{analysis, coverage, fuzz, heartbeat::*, merge, report};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use onefuzz::machine_id::{get_machine_id, get_scaleset_name};
|
use onefuzz::machine_id::{get_machine_id, get_scaleset_name};
|
||||||
use onefuzz_telemetry::{self as telemetry, Event::task_start, EventData};
|
use onefuzz_telemetry::{self as telemetry, Event::task_start, EventData, Role};
|
||||||
use reqwest::Url;
|
use reqwest::Url;
|
||||||
use serde::{self, Deserialize};
|
use serde::{self, Deserialize};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@ -151,6 +151,7 @@ impl Config {
|
|||||||
telemetry::set_property(EventData::MachineId(get_machine_id().await?));
|
telemetry::set_property(EventData::MachineId(get_machine_id().await?));
|
||||||
telemetry::set_property(EventData::Version(env!("ONEFUZZ_VERSION").to_string()));
|
telemetry::set_property(EventData::Version(env!("ONEFUZZ_VERSION").to_string()));
|
||||||
telemetry::set_property(EventData::InstanceId(self.common().instance_id));
|
telemetry::set_property(EventData::InstanceId(self.common().instance_id));
|
||||||
|
telemetry::set_property(EventData::Role(Role::Agent));
|
||||||
let scaleset = get_scaleset_name().await?;
|
let scaleset = get_scaleset_name().await?;
|
||||||
if let Some(scaleset_name) = &scaleset {
|
if let Some(scaleset_name) = &scaleset {
|
||||||
telemetry::set_property(EventData::ScalesetId(scaleset_name.to_string()));
|
telemetry::set_property(EventData::ScalesetId(scaleset_name.to_string()));
|
||||||
|
@ -26,7 +26,7 @@ use onefuzz::{
|
|||||||
machine_id::{get_machine_id, get_scaleset_name},
|
machine_id::{get_machine_id, get_scaleset_name},
|
||||||
process::ExitStatus,
|
process::ExitStatus,
|
||||||
};
|
};
|
||||||
use onefuzz_telemetry::{self as telemetry, EventData};
|
use onefuzz_telemetry::{self as telemetry, EventData, Role};
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
|
|
||||||
pub mod agent;
|
pub mod agent;
|
||||||
@ -171,6 +171,7 @@ async fn run_agent(config: StaticConfig) -> Result<()> {
|
|||||||
telemetry::set_property(EventData::InstanceId(config.instance_id));
|
telemetry::set_property(EventData::InstanceId(config.instance_id));
|
||||||
telemetry::set_property(EventData::MachineId(get_machine_id().await?));
|
telemetry::set_property(EventData::MachineId(get_machine_id().await?));
|
||||||
telemetry::set_property(EventData::Version(env!("ONEFUZZ_VERSION").to_string()));
|
telemetry::set_property(EventData::Version(env!("ONEFUZZ_VERSION").to_string()));
|
||||||
|
telemetry::set_property(EventData::Role(Role::Supervisor));
|
||||||
let scaleset = get_scaleset_name().await?;
|
let scaleset = get_scaleset_name().await?;
|
||||||
if let Some(scaleset_name) = &scaleset {
|
if let Some(scaleset_name) = &scaleset {
|
||||||
telemetry::set_property(EventData::ScalesetId(scaleset_name.to_string()));
|
telemetry::set_property(EventData::ScalesetId(scaleset_name.to_string()));
|
||||||
|
@ -14,13 +14,17 @@ pub enum ClientType {
|
|||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub enum Role {
|
pub enum Role {
|
||||||
|
Agent,
|
||||||
Proxy,
|
Proxy,
|
||||||
|
Supervisor,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Role {
|
impl Role {
|
||||||
pub fn as_str(&self) -> &'static str {
|
pub fn as_str(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
|
Self::Agent => "agent",
|
||||||
Self::Proxy => "proxy",
|
Self::Proxy => "proxy",
|
||||||
|
Self::Supervisor => "supervisor",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user