Skip to content

Commit

Permalink
tracing: remove chrome dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
bmwill committed Jan 23, 2023
1 parent bca79b7 commit 125ea77
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 66 deletions.
36 changes: 0 additions & 36 deletions Cargo.lock

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

4 changes: 1 addition & 3 deletions crates/telemetry-subscribers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@ tokio = { workspace = true, features = ["sync", "macros", "rt", "rt-multi-thread
tracing = "0.1.37"
tracing-appender = "0.2.2"
tracing-bunyan-formatter = "0.3.3"
tracing-chrome = { version = "0.6.0", optional = true }
tracing-opentelemetry = { version = "0.18.0", optional = true }
tracing-subscriber = { version = "0.3.15", features = ["std", "time", "registry", "env-filter"] }
workspace-hack = { version = "0.1", path = "../workspace-hack" }

[features]
default = ["jaeger", "chrome"]
default = ["jaeger"]
tokio-console = ["console-subscriber"]
jaeger = ["tracing-opentelemetry", "opentelemetry", "opentelemetry-jaeger"]
chrome = ["tracing-chrome"]

[dev-dependencies]
camino = "1.0.9"
28 changes: 7 additions & 21 deletions crates/telemetry-subscribers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ pub struct TelemetryConfig {
pub tokio_console: bool,
/// Output JSON logs.
pub json_log_output: bool,
/// Write chrome trace output, which can be loaded from chrome://tracing
pub chrome_trace_output: bool,
/// If defined, write output to a file starting with this name, ex app.log
pub log_file: Option<String>,
/// Log level to set, defaults to info
Expand All @@ -162,9 +160,6 @@ pub struct TelemetryConfig {
#[allow(dead_code)]
pub struct TelemetryGuards {
worker_guard: WorkerGuard,

#[cfg(feature = "chrome")]
chrome_guard: Option<tracing_chrome::FlushGuard>,
}

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -240,7 +235,6 @@ impl TelemetryConfig {
enable_jaeger: false,
tokio_console: false,
json_log_output: false,
chrome_trace_output: false,
log_file: None,
log_string: None,
span_level: None,
Expand Down Expand Up @@ -279,10 +273,6 @@ impl TelemetryConfig {
self.enable_jaeger = true
}

if env::var("TOKIO_CHROME").is_ok() {
self.chrome_trace_output = true;
}

if env::var("ENABLE_JSON_LOGS").is_ok() {
self.json_log_output = true;
}
Expand Down Expand Up @@ -334,15 +324,6 @@ impl TelemetryConfig {
layers.push(console_subscriber::spawn().boxed());
}

#[cfg(feature = "chrome")]
let chrome_guard = if config.chrome_trace_output {
let (chrome_layer, guard) = tracing_chrome::ChromeLayerBuilder::new().build();
layers.push(chrome_layer.boxed());
Some(guard)
} else {
None
};

if let Some(registry) = config.prom_registry {
let span_lat_layer = PrometheusSpanLatencyLayer::try_new(&registry, 15)
.expect("Could not initialize span latency layer");
Expand Down Expand Up @@ -372,6 +353,13 @@ impl TelemetryConfig {

let (nb_output, worker_guard) = get_output(config.log_file.clone());
if config.json_log_output {
// // Output to file or to stderr in a newline-delimited JSON format
// let json_layer = fmt::layer()
// .json()
// .with_writer(nb_output)
// .with_filter(log_filter)
// .boxed();
// layers.push(json_layer);
// See https://www.lpalmieri.com/posts/2020-09-27-zero-to-production-4-are-we-observable-yet/#5-7-tracing-bunyan-formatter
// Also Bunyan layer adds JSON logging for tracing spans with duration information
let json_layer = JsonStorageLayer
Expand Down Expand Up @@ -401,8 +389,6 @@ impl TelemetryConfig {
// gets flushed and closed. If this is dropped too early then no output will appear!
let guards = TelemetryGuards {
worker_guard,
#[cfg(feature = "chrome")]
chrome_guard,
};

(guards, filter_handle)
Expand Down
6 changes: 0 additions & 6 deletions crates/workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ crc-catalog = { version = "2", default-features = false }
crc32fast = { version = "1" }
criterion = { version = "0.4", features = ["async_tokio"] }
criterion-plot = { version = "0.5", default-features = false }
crossbeam = { version = "0.8" }
crossbeam-channel = { version = "0.5" }
crossbeam-deque = { version = "0.8" }
crossbeam-epoch = { version = "0.9", default-features = false, features = ["std"] }
Expand Down Expand Up @@ -291,7 +290,6 @@ itertools = { version = "0.10" }
itoa-9fbad63c4bcf4a8f = { package = "itoa", version = "0.4" }
itoa-dff4ba8e3ae991db = { package = "itoa", version = "1", default-features = false }
js-sys = { version = "0.3", default-features = false }
json = { version = "0.12", default-features = false }
jsonrpsee = { git = "https://github.com/patrickkuo/jsonrpsee.git", rev = "adc19a124ed7045744442ca67f084ddfba4ba177", default-features = false, features = ["full"] }
jsonrpsee-client-transport = { git = "https://github.com/patrickkuo/jsonrpsee.git", rev = "adc19a124ed7045744442ca67f084ddfba4ba177", default-features = false, features = ["tls", "web", "ws"] }
jsonrpsee-core = { git = "https://github.com/patrickkuo/jsonrpsee.git", rev = "adc19a124ed7045744442ca67f084ddfba4ba177", features = ["async-client", "async-wasm-client", "http-helpers", "server", "soketto"] }
Expand Down Expand Up @@ -608,7 +606,6 @@ tower-service = { version = "0.3", default-features = false }
tracing = { version = "0.1", features = ["log"] }
tracing-appender = { version = "0.2", default-features = false }
tracing-bunyan-formatter = { version = "0.3" }
tracing-chrome = { version = "0.6", default-features = false }
tracing-core = { version = "0.1" }
tracing-futures = { version = "0.2" }
tracing-log = { version = "0.1" }
Expand Down Expand Up @@ -809,7 +806,6 @@ crc-catalog = { version = "2", default-features = false }
crc32fast = { version = "1" }
criterion = { version = "0.4", features = ["async_tokio"] }
criterion-plot = { version = "0.5", default-features = false }
crossbeam = { version = "0.8" }
crossbeam-channel = { version = "0.5" }
crossbeam-deque = { version = "0.8" }
crossbeam-epoch = { version = "0.9", default-features = false, features = ["std"] }
Expand Down Expand Up @@ -986,7 +982,6 @@ itoa-9fbad63c4bcf4a8f = { package = "itoa", version = "0.4" }
itoa-dff4ba8e3ae991db = { package = "itoa", version = "1", default-features = false }
jobserver = { version = "0.1", default-features = false }
js-sys = { version = "0.3", default-features = false }
json = { version = "0.12", default-features = false }
jsonrpsee = { git = "https://github.com/patrickkuo/jsonrpsee.git", rev = "adc19a124ed7045744442ca67f084ddfba4ba177", default-features = false, features = ["full"] }
jsonrpsee-client-transport = { git = "https://github.com/patrickkuo/jsonrpsee.git", rev = "adc19a124ed7045744442ca67f084ddfba4ba177", default-features = false, features = ["tls", "web", "ws"] }
jsonrpsee-core = { git = "https://github.com/patrickkuo/jsonrpsee.git", rev = "adc19a124ed7045744442ca67f084ddfba4ba177", features = ["async-client", "async-wasm-client", "http-helpers", "server", "soketto"] }
Expand Down Expand Up @@ -1360,7 +1355,6 @@ tracing = { version = "0.1", features = ["log"] }
tracing-appender = { version = "0.2", default-features = false }
tracing-attributes = { version = "0.1", default-features = false }
tracing-bunyan-formatter = { version = "0.3" }
tracing-chrome = { version = "0.6", default-features = false }
tracing-core = { version = "0.1" }
tracing-futures = { version = "0.2" }
tracing-log = { version = "0.1" }
Expand Down

0 comments on commit 125ea77

Please sign in to comment.