Skip to content

Commit 1d72968

Browse files
committed
feat: base subscribers on tracing
Signed-off-by: Will Killian <wkillian@nvidia.com>
1 parent a550c28 commit 1d72968

39 files changed

Lines changed: 3394 additions & 103 deletions

ATTRIBUTIONS-Rust.md

Lines changed: 478 additions & 0 deletions
Large diffs are not rendered by default.

Cargo.lock

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/core/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ bitflags = { version = "2", features = ["serde"] }
5858
thiserror = "2"
5959
tokio = { version = "1", default-features = false, features = ["rt", "macros", "sync"] }
6060
tokio-stream = { version = "0.1", default-features = false }
61+
tracing = "0.1"
62+
tracing-subscriber = { version = "0.3", default-features = false, features = ["registry", "std"] }
6163
typed-builder = "0.23.2"
6264
opentelemetry = { version = "0.31", default-features = false, features = ["trace"], optional = true }
6365
opentelemetry_sdk = { version = "0.31", default-features = false, features = ["trace"], optional = true }
@@ -74,6 +76,7 @@ web-sys = { version = "0.3", features = ["Headers", "Request", "RequestInit", "R
7476
tokio = { version = "1", features = ["rt", "macros", "sync", "test-util", "rt-multi-thread"] }
7577
futures = "0.3"
7678
opentelemetry_sdk = { version = "0.31", default-features = false, features = ["trace", "testing"] }
79+
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt", "registry", "std"] }
7780
serde_json = "1"
7881

7982
[[test]]

crates/core/src/api/event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ impl Event {
424424

425425
/// Return this event as canonical JSON.
426426
pub fn to_json_string(&self) -> serde_json::Result<String> {
427-
serde_json::to_string(&self.try_to_json_value()?)
427+
serde_json::to_string(self)
428428
}
429429

430430
/// Return the lifecycle phase for scope events.

crates/core/src/api/runtime.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ pub use scope_stack::{
2121
restore_thread_scope_stack, scope_stack_active, set_thread_scope_stack,
2222
sync_thread_scope_stack, task_scope_push, task_scope_remove, task_scope_top,
2323
};
24+
pub(crate) use state::EventSubscriberSnapshot;
2425
pub use state::NemoRelayContextState;

crates/core/src/api/runtime/scope_stack.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,13 @@ impl ScopeStack {
200200
self.stack
201201
.iter()
202202
.filter_map(|handle| self.scope_registries.get(&handle.uuid))
203-
.flat_map(|registries| registries.event_subscribers.values().cloned())
203+
.flat_map(|registries| {
204+
registries
205+
.event_subscribers
206+
.values()
207+
.chain(registries.anonymous_event_subscribers.values())
208+
.cloned()
209+
})
204210
.collect()
205211
}
206212
}

0 commit comments

Comments
 (0)