Skip to content

Commit

Permalink
Address Ryan's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Preibisch committed Jan 7, 2025
1 parent d0f104d commit 99a8c85
Show file tree
Hide file tree
Showing 15 changed files with 213 additions and 138 deletions.
15 changes: 7 additions & 8 deletions attest/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
use tracing::info;

#[tokio::main]
async fn main() -> color_eyre::Result<()> {
color_eyre::install()?;
orb_telemetry::TelemetryConfig::new()

let _telemetry_guard = orb_telemetry::TelemetryConfig::new(
orb_attest::SYSLOG_IDENTIFIER,
"1.0.0",
"orb"
)
.with_journald(orb_attest::SYSLOG_IDENTIFIER)
.with_opentelemetry(
Some(orb_attest::SYSLOG_IDENTIFIER.to_string()),
Some("1.0.0".to_string()),
Some("orb".to_string())
)
.with_opentelemetry(orb_telemetry::OpenTelemetryConfig::default())
.init();

orb_attest::main().await
Expand Down
7 changes: 5 additions & 2 deletions attest/src/remote_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,11 @@ printf dmFsaWRzaWduYXR1cmU=
// A happy path
#[tokio::test]
async fn get_token() {
orb_telemetry::TelemetryConfig::new().init();

let _telemetry_guard = orb_telemetry::TelemetryConfig::new(
"test-orb-auth", // service name for test context
"test", // version for test context
"test" // environment for test context
).init();
let mock_server = MockServer::start().await;

let orb_id = "TEST_ORB";
Expand Down
9 changes: 7 additions & 2 deletions backend-state/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ struct Cli {}
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<()> {
color_eyre::install()?;
orb_telemetry::TelemetryConfig::new()
let _telemetry_guard = orb_telemetry::TelemetryConfig::new(
SYSLOG_IDENTIFIER,
BUILD_INFO.version,
"orb"
)
.with_journald(SYSLOG_IDENTIFIER)
.with_opentelemetry(orb_telemetry::OpenTelemetryConfig::default())
.init();

let _args = Cli::parse();
Expand Down Expand Up @@ -186,7 +191,7 @@ async fn poll_backend(mut ctx: Context) -> ! {

/// Listens for changes to state, and signals that change to the dbus interface.
fn spawn_notify_state_task(
iface: zbus::InterfaceRef<crate::dbus_interface::Interface>,
iface: zbus::InterfaceRef<dbus_interface::Interface>,
mut ctx: Context,
) -> tokio::task::JoinHandle<Result<()>> {
tokio::task::spawn(async move {
Expand Down
19 changes: 16 additions & 3 deletions experiments/zenoh/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,24 @@ enum Args {

#[tokio::main]
async fn main() -> color_eyre::Result<()> {
orb_telemetry::TelemetryConfig::new().init();
tracing::debug!("debug logging is enabled");

let args = Args::parse();

// Configure telemetry with appropriate service name based on mode
let service_name = match args {
Args::Alice { .. } => "zenoh-bench-sender",
Args::Bob { .. } => "zenoh-bench-receiver",
};

let _telemetry_guard = orb_telemetry::TelemetryConfig::new(
service_name,
env!("CARGO_PKG_VERSION"),
"orb"
)
.with_opentelemetry(orb_telemetry::OpenTelemetryConfig::default())
.init();

tracing::debug!("debug logging is enabled");

match args {
Args::Alice { .. } => alice(args).await,
Args::Bob { .. } => bob(args).await,
Expand Down
9 changes: 8 additions & 1 deletion mcu-util/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,14 @@ fn clap_v3_styles() -> Styles {
#[tokio::main]
async fn main() -> Result<()> {
color_eyre::install()?;
orb_telemetry::TelemetryConfig::new().init();

let _telemetry_guard = orb_telemetry::TelemetryConfig::new(
"orb-mcu-util",
BUILD_INFO.version,
"orb"
)
.with_opentelemetry(orb_telemetry::OpenTelemetryConfig::default())
.init();

let args = Args::parse();

Expand Down
9 changes: 8 additions & 1 deletion supervisor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@ fn clap_v3_styles() -> Styles {
#[tokio::main]
async fn main() -> color_eyre::Result<()> {
color_eyre::install()?;
orb_telemetry::TelemetryConfig::new()

let _telemetry_guard = orb_telemetry::TelemetryConfig::new(
SYSLOG_IDENTIFIER,
BUILD_INFO.version,
"orb"
)
.with_journald(SYSLOG_IDENTIFIER)
.with_opentelemetry(orb_telemetry::OpenTelemetryConfig::default())
.init();

debug!("initialized telemetry");

let _args = Cli::parse();
Expand Down
12 changes: 10 additions & 2 deletions supervisor/tests/it/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ use zbus::{

pub const WORLDCOIN_CORE_SERVICE_OBJECT_PATH: &str =
"/org/freedesktop/systemd1/unit/worldcoin_2dcore_2eservice";
static TRACING: Lazy<()> = Lazy::new(|| {
orb_telemetry::TelemetryConfig::new().init();

// Store the shutdown handler in the Lazy static to keep it alive
static TRACING: Lazy<orb_telemetry::TelemetryShutdownHandler> = Lazy::new(|| {
orb_telemetry::TelemetryConfig::new(
"orb-dbus-manager",
env!("CARGO_PKG_VERSION"),
"orb"
)
.with_opentelemetry(orb_telemetry::OpenTelemetryConfig::default())
.init()
});

#[derive(Debug)]
Expand Down
Loading

0 comments on commit 99a8c85

Please sign in to comment.