Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

add roles to agent & supervisor #527

Merged
5 commits merged into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/agent/onefuzz-agent/src/tasks/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use crate::tasks::{analysis, coverage, fuzz, heartbeat::*, merge, report};
use anyhow::Result;
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 serde::{self, Deserialize};
use std::path::PathBuf;
Expand Down Expand Up @@ -151,6 +151,7 @@ impl Config {
telemetry::set_property(EventData::MachineId(get_machine_id().await?));
telemetry::set_property(EventData::Version(env!("ONEFUZZ_VERSION").to_string()));
telemetry::set_property(EventData::InstanceId(self.common().instance_id));
telemetry::set_property(EventData::Role(Role::Agent));
let scaleset = get_scaleset_name().await?;
if let Some(scaleset_name) = &scaleset {
telemetry::set_property(EventData::ScalesetId(scaleset_name.to_string()));
Expand Down
3 changes: 2 additions & 1 deletion src/agent/onefuzz-supervisor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use onefuzz::{
machine_id::{get_machine_id, get_scaleset_name},
process::ExitStatus,
};
use onefuzz_telemetry::{self as telemetry, EventData};
use onefuzz_telemetry::{self as telemetry, EventData, Role};
use structopt::StructOpt;

pub mod agent;
Expand Down Expand Up @@ -171,6 +171,7 @@ async fn run_agent(config: StaticConfig) -> Result<()> {
telemetry::set_property(EventData::InstanceId(config.instance_id));
telemetry::set_property(EventData::MachineId(get_machine_id().await?));
telemetry::set_property(EventData::Version(env!("ONEFUZZ_VERSION").to_string()));
telemetry::set_property(EventData::Role(Role::Supervisor));
let scaleset = get_scaleset_name().await?;
if let Some(scaleset_name) = &scaleset {
telemetry::set_property(EventData::ScalesetId(scaleset_name.to_string()));
Expand Down
4 changes: 4 additions & 0 deletions src/agent/onefuzz-telemetry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ pub enum ClientType {

#[derive(Clone, Debug, PartialEq)]
pub enum Role {
Agent,
Proxy,
Supervisor,
}

impl Role {
pub fn as_str(&self) -> &'static str {
match self {
Self::Agent => "agent",
Self::Proxy => "proxy",
Self::Supervisor => "supervisor",
}
}
}
Expand Down