Skip to content

Commit

Permalink
refactor(supervisor): use orb-telemetry (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheButlah authored Dec 11, 2024
1 parent ecea63a commit 52de34f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 100 deletions.
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions supervisor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ libc.workspace = true
listenfd = "1.0.0"
once_cell = "1.15.0"
orb-build-info.workspace = true
orb-telemetry.workspace = true
tap = "1.0.1"
thiserror.workspace = true
tokio = { workspace = true, features = ["macros", "net", "rt-multi-thread"] }
tokio-stream = "0.1.11"
tracing = { workspace = true, features = ["attributes"] }
tracing-journald.workspace = true
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
zbus = { workspace = true, default-features = false, features = ["tokio"] }
zbus_systemd = { workspace = true, features = [ "systemd1", "login1" ] }

Expand Down
1 change: 0 additions & 1 deletion supervisor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub mod proxies;
pub mod shutdown;
pub mod startup;
pub mod tasks;
pub mod telemetry;

use orb_build_info::{make_build_info, BuildInfo};

Expand Down
13 changes: 6 additions & 7 deletions supervisor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ use clap::{
Parser,
};
use color_eyre::eyre::WrapErr as _;
use orb_supervisor::{
startup::{Application, Settings},
telemetry::{self, ExecContext},
};
use orb_supervisor::startup::{Application, Settings};
use tracing::debug;
use tracing_subscriber::filter::LevelFilter;

use orb_supervisor::BUILD_INFO;

const SYSLOG_IDENTIFIER: &str = "worldcoin-supervisor";

/// Utility args
#[derive(Parser, Debug)]
#[clap(
Expand All @@ -32,8 +30,9 @@ fn clap_v3_styles() -> Styles {
#[tokio::main]
async fn main() -> color_eyre::Result<()> {
color_eyre::install()?;
telemetry::start::<ExecContext, _>(LevelFilter::INFO, std::io::stdout)
.wrap_err("failed to initialize tracing; bailing")?;
orb_telemetry::TelemetryConfig::new()
.with_journald(SYSLOG_IDENTIFIER)
.init();
debug!("initialized telemetry");

let _args = Cli::parse();
Expand Down
77 changes: 0 additions & 77 deletions supervisor/src/telemetry.rs

This file was deleted.

13 changes: 2 additions & 11 deletions supervisor/tests/it/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,16 @@ use std::io;

use dbus_launch::{BusType, Daemon};
use once_cell::sync::Lazy;
use orb_supervisor::{
startup::{Application, Settings},
telemetry::{self, TestContext},
};
use orb_supervisor::startup::{Application, Settings};
use tokio::task::JoinHandle;
use tracing_subscriber::filter::LevelFilter;
use zbus::{
fdo, interface, proxy, zvariant::OwnedObjectPath, ProxyDefault, SignalContext,
};

pub const WORLDCOIN_CORE_SERVICE_OBJECT_PATH: &str =
"/org/freedesktop/systemd1/unit/worldcoin_2dcore_2eservice";
static TRACING: Lazy<()> = Lazy::new(|| {
let filter = LevelFilter::DEBUG;
if std::env::var("TEST_LOG").is_ok() {
telemetry::start::<TestContext, _>(filter, std::io::stdout).unwrap();
} else {
telemetry::start::<TestContext, _>(filter, std::io::sink).unwrap();
}
orb_telemetry::TelemetryConfig::new().init();
});

#[derive(Debug)]
Expand Down

0 comments on commit 52de34f

Please sign in to comment.