mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-13 18:48:09 +00:00
add onefuzz version & scaleset_id to telemetry from agent & supervisor (#94)
This commit is contained in:
@ -6,7 +6,7 @@ use crate::tasks::{analysis, coverage, fuzz, heartbeat::*, merge, report};
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use onefuzz::{
|
use onefuzz::{
|
||||||
blob::BlobContainerUrl,
|
blob::BlobContainerUrl,
|
||||||
machine_id::get_machine_id,
|
machine_id::{get_machine_id, get_scaleset_name},
|
||||||
telemetry::{self, Event::task_start, EventData},
|
telemetry::{self, Event::task_start, EventData},
|
||||||
};
|
};
|
||||||
use reqwest::Url;
|
use reqwest::Url;
|
||||||
@ -113,6 +113,10 @@ impl Config {
|
|||||||
telemetry::set_property(EventData::JobId(self.common().job_id));
|
telemetry::set_property(EventData::JobId(self.common().job_id));
|
||||||
telemetry::set_property(EventData::TaskId(self.common().task_id));
|
telemetry::set_property(EventData::TaskId(self.common().task_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()));
|
||||||
|
if let Ok(scaleset) = get_scaleset_name().await {
|
||||||
|
telemetry::set_property(EventData::ScalesetId(scaleset));
|
||||||
|
}
|
||||||
|
|
||||||
info!("agent ready, dispatching task");
|
info!("agent ready, dispatching task");
|
||||||
self.report_event();
|
self.report_event();
|
||||||
|
@ -16,7 +16,7 @@ use std::path::PathBuf;
|
|||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use onefuzz::{
|
use onefuzz::{
|
||||||
machine_id::get_machine_id,
|
machine_id::{get_machine_id, get_scaleset_name},
|
||||||
telemetry::{self, EventData},
|
telemetry::{self, EventData},
|
||||||
};
|
};
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
@ -120,6 +120,11 @@ fn load_config(opt: RunOpt) -> Result<StaticConfig> {
|
|||||||
|
|
||||||
async fn run_agent(config: StaticConfig) -> Result<()> {
|
async fn run_agent(config: StaticConfig) -> Result<()> {
|
||||||
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()));
|
||||||
|
if let Ok(scaleset) = get_scaleset_name().await {
|
||||||
|
telemetry::set_property(EventData::ScalesetId(scaleset));
|
||||||
|
}
|
||||||
|
|
||||||
let registration = config::Registration::create_managed(config.clone()).await?;
|
let registration = config::Registration::create_managed(config.clone()).await?;
|
||||||
verbose!("created managed registration: {:?}", registration);
|
verbose!("created managed registration: {:?}", registration);
|
||||||
|
|
||||||
|
@ -39,7 +39,9 @@ pub enum EventData {
|
|||||||
WorkerId(u64),
|
WorkerId(u64),
|
||||||
JobId(Uuid),
|
JobId(Uuid),
|
||||||
TaskId(Uuid),
|
TaskId(Uuid),
|
||||||
|
ScalesetId(String),
|
||||||
MachineId(Uuid),
|
MachineId(Uuid),
|
||||||
|
Version(String),
|
||||||
CommandLine(String),
|
CommandLine(String),
|
||||||
Type(String),
|
Type(String),
|
||||||
Mode(String),
|
Mode(String),
|
||||||
@ -67,8 +69,10 @@ pub enum EventData {
|
|||||||
impl EventData {
|
impl EventData {
|
||||||
pub fn as_values(&self) -> (&str, String) {
|
pub fn as_values(&self) -> (&str, String) {
|
||||||
match self {
|
match self {
|
||||||
|
Self::Version(x) => ("version", x.to_string()),
|
||||||
Self::JobId(x) => ("job_id", x.to_string()),
|
Self::JobId(x) => ("job_id", x.to_string()),
|
||||||
Self::TaskId(x) => ("task_id", x.to_string()),
|
Self::TaskId(x) => ("task_id", x.to_string()),
|
||||||
|
Self::ScalesetId(x) => ("scaleset_id", x.to_string()),
|
||||||
Self::MachineId(x) => ("machine_id", x.to_string()),
|
Self::MachineId(x) => ("machine_id", x.to_string()),
|
||||||
Self::CommandLine(x) => ("command_line", x.to_owned()),
|
Self::CommandLine(x) => ("command_line", x.to_owned()),
|
||||||
Self::Type(x) => ("event_type", x.to_owned()),
|
Self::Type(x) => ("event_type", x.to_owned()),
|
||||||
@ -98,9 +102,13 @@ impl EventData {
|
|||||||
|
|
||||||
pub fn can_share(&self) -> bool {
|
pub fn can_share(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
|
// TODO: Request CELA review of Version, as having this for central stats
|
||||||
|
// would be useful to track uptake of new releases
|
||||||
|
Self::Version(_) => false,
|
||||||
Self::TaskId(_) => true,
|
Self::TaskId(_) => true,
|
||||||
Self::JobId(_) => true,
|
Self::JobId(_) => true,
|
||||||
Self::MachineId(_) => true,
|
Self::MachineId(_) => true,
|
||||||
|
Self::ScalesetId(_) => false,
|
||||||
Self::CommandLine(_) => false,
|
Self::CommandLine(_) => false,
|
||||||
Self::Path(_) => false,
|
Self::Path(_) => false,
|
||||||
Self::Type(_) => true,
|
Self::Type(_) => true,
|
||||||
|
Reference in New Issue
Block a user