Skip to content

Commit

Permalink
fix: use env filter properly (#132)
Browse files Browse the repository at this point in the history
* fix: use env filter properly

Apparently if we pass env filter in an array with the other layers
it won't be executed first (to act as a filter). This change fixes
that by explicitly adding it before.

* chore: bump version
  • Loading branch information
ali-bahjati authored Jul 24, 2024
1 parent 38c45bb commit 756495f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyth-agent"
version = "2.10.0"
version = "2.10.1"
edition = "2021"

[[bin]]
Expand Down
6 changes: 4 additions & 2 deletions src/bin/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ async fn main() -> Result<()> {
.with_ansi(std::io::stderr().is_terminal());

let mut layers = Vec::new();
layers.push(env_filter.boxed());

// Set up OpenTelemetry only if it's configured
if let Some(opentelemetry_config) = &config.opentelemetry {
Expand Down Expand Up @@ -91,7 +90,10 @@ async fn main() -> Result<()> {
layers.push(fmt_layer.json().boxed());
}

tracing_subscriber::registry().with(layers).init();
tracing_subscriber::registry()
.with(env_filter)
.with(layers)
.init();

// Launch the application. If it fails, print the full backtrace and exit. RUST_BACKTRACE
// should be set to 1 for this otherwise it will only print the top-level error.
Expand Down

0 comments on commit 756495f

Please sign in to comment.