mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-17 20:38:06 +00:00
split telemetry into it's own crate (#501)
Splits out telemetry crate such that it can be reused by other components (specifically the proxy-manager) easily.
This commit is contained in:
@ -31,6 +31,7 @@ uuid = { version = "0.8", features = ["serde", "v4"] }
|
||||
onefuzz = { path = "../onefuzz" }
|
||||
storage-queue = { path = "../storage-queue" }
|
||||
reqwest-retry = { path = "../reqwest-retry" }
|
||||
onefuzz-telemetry = { path = "../onefuzz-telemetry" }
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3.1"
|
||||
|
@ -3,12 +3,11 @@
|
||||
|
||||
#[macro_use]
|
||||
extern crate anyhow;
|
||||
|
||||
#[macro_use]
|
||||
extern crate onefuzz;
|
||||
|
||||
#[macro_use]
|
||||
extern crate clap;
|
||||
#[macro_use]
|
||||
extern crate onefuzz_telemetry;
|
||||
extern crate onefuzz;
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::{App, ArgMatches, SubCommand};
|
||||
|
@ -4,7 +4,6 @@
|
||||
use crate::tasks::config::{CommonConfig, Config};
|
||||
use anyhow::Result;
|
||||
use clap::{App, Arg, SubCommand};
|
||||
use onefuzz::telemetry;
|
||||
use std::path::PathBuf;
|
||||
|
||||
pub async fn run(args: &clap::ArgMatches<'_>) -> Result<()> {
|
||||
@ -19,12 +18,12 @@ pub async fn run(args: &clap::ArgMatches<'_>) -> Result<()> {
|
||||
error!("error running task: {}", err);
|
||||
}
|
||||
|
||||
telemetry::try_flush_and_close();
|
||||
onefuzz_telemetry::try_flush_and_close();
|
||||
result
|
||||
}
|
||||
|
||||
fn init_telemetry(config: &CommonConfig) {
|
||||
telemetry::set_appinsights_clients(config.instrumentation_key, config.telemetry_key);
|
||||
onefuzz_telemetry::set_appinsights_clients(config.instrumentation_key, config.telemetry_key);
|
||||
}
|
||||
|
||||
pub fn args(name: &str) -> App<'static, 'static> {
|
||||
|
@ -4,10 +4,8 @@
|
||||
#![allow(clippy::large_enum_variant)]
|
||||
use crate::tasks::{analysis, coverage, fuzz, heartbeat::*, merge, report};
|
||||
use anyhow::Result;
|
||||
use onefuzz::{
|
||||
machine_id::{get_machine_id, get_scaleset_name},
|
||||
telemetry::{self, Event::task_start, EventData},
|
||||
};
|
||||
use onefuzz::machine_id::{get_machine_id, get_scaleset_name};
|
||||
use onefuzz_telemetry::{self as telemetry, Event::task_start, EventData};
|
||||
use reqwest::Url;
|
||||
use serde::{self, Deserialize};
|
||||
use std::path::PathBuf;
|
||||
|
@ -39,10 +39,8 @@ use crate::tasks::{
|
||||
use anyhow::{Context, Result};
|
||||
use async_trait::async_trait;
|
||||
use futures::stream::StreamExt;
|
||||
use onefuzz::{
|
||||
fs::list_files, libfuzzer::LibFuzzer, syncdir::SyncedDir, telemetry::Event::coverage_data,
|
||||
telemetry::EventData,
|
||||
};
|
||||
use onefuzz::{fs::list_files, libfuzzer::LibFuzzer, syncdir::SyncedDir};
|
||||
use onefuzz_telemetry::{Event::coverage_data, EventData};
|
||||
use reqwest::Url;
|
||||
use serde::Deserialize;
|
||||
use std::collections::HashMap;
|
||||
|
@ -15,8 +15,8 @@ use onefuzz::{
|
||||
process::monitor_process,
|
||||
sha256,
|
||||
syncdir::{continuous_sync, SyncOperation::Pull, SyncedDir},
|
||||
telemetry::Event::new_result,
|
||||
};
|
||||
use onefuzz_telemetry::Event::new_result;
|
||||
use serde::Deserialize;
|
||||
use std::collections::HashMap;
|
||||
use std::{
|
||||
|
@ -10,10 +10,10 @@ use onefuzz::{
|
||||
process::ExitStatus,
|
||||
syncdir::{continuous_sync, SyncOperation::Pull, SyncedDir},
|
||||
system,
|
||||
telemetry::{
|
||||
Event::{new_coverage, new_result, process_stats, runtime_stats},
|
||||
EventData,
|
||||
},
|
||||
};
|
||||
use onefuzz_telemetry::{
|
||||
Event::{new_coverage, new_result, process_stats, runtime_stats},
|
||||
EventData,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use std::{collections::HashMap, path::PathBuf};
|
||||
|
@ -16,8 +16,8 @@ use onefuzz::{
|
||||
jitter::delay_with_jitter,
|
||||
process::monitor_process,
|
||||
syncdir::{SyncOperation::Pull, SyncedDir},
|
||||
telemetry::Event::{new_coverage, new_result},
|
||||
};
|
||||
use onefuzz_telemetry::Event::{new_coverage, new_result};
|
||||
use serde::Deserialize;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
|
@ -9,10 +9,10 @@ use onefuzz::{
|
||||
fs::exists,
|
||||
monitor::DirectoryMonitor,
|
||||
syncdir::SyncedDir,
|
||||
telemetry::{
|
||||
Event::{new_report, new_unable_to_reproduce, new_unique_report},
|
||||
EventData,
|
||||
},
|
||||
};
|
||||
use onefuzz_telemetry::{
|
||||
Event::{new_report, new_unable_to_reproduce, new_unique_report},
|
||||
EventData,
|
||||
};
|
||||
use reqwest::{StatusCode, Url};
|
||||
use reqwest_retry::SendRetry;
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Licensed under the MIT License.
|
||||
|
||||
use anyhow::{Context, Error, Result};
|
||||
use onefuzz::telemetry::EventData;
|
||||
use onefuzz_telemetry::EventData;
|
||||
use std::path::Path;
|
||||
use tokio::io::AsyncBufReadExt;
|
||||
|
||||
|
@ -3,10 +3,8 @@
|
||||
|
||||
use super::afl;
|
||||
use anyhow::{Error, Result};
|
||||
use onefuzz::{
|
||||
jitter::delay_with_jitter,
|
||||
telemetry::{track_event, Event::runtime_stats},
|
||||
};
|
||||
use onefuzz::jitter::delay_with_jitter;
|
||||
use onefuzz_telemetry::{track_event, Event::runtime_stats};
|
||||
use serde::Deserialize;
|
||||
pub const STATS_DELAY: std::time::Duration = std::time::Duration::from_secs(30);
|
||||
|
||||
|
Reference in New Issue
Block a user