diff --git a/crates/ruma-common/src/push.rs b/crates/ruma-common/src/push.rs index 2d899ef4..2a598534 100644 --- a/crates/ruma-common/src/push.rs +++ b/crates/ruma-common/src/push.rs @@ -21,6 +21,7 @@ use ruma_serde::{Raw, StringEnum}; use serde::{Deserialize, Serialize}; #[cfg(feature = "unstable-pre-spec")] use serde_json::Value as JsonValue; +use tracing::instrument; use crate::PrivOwnedStr; @@ -99,6 +100,7 @@ impl Ruleset { /// /// * `event` - The raw JSON of a room message event. /// * `context` - The context of the message and room at the time of the event. + #[instrument(skip_all, fields(context.room_id = %context.room_id))] pub fn get_match( &self, event: &Raw, @@ -116,6 +118,7 @@ impl Ruleset { /// /// * `event` - The raw JSON of a room message event. /// * `context` - The context of the message and room at the time of the event. + #[instrument(skip_all, fields(context.room_id = %context.room_id))] pub fn get_actions(&self, event: &Raw, context: &PushConditionRoomCtx) -> &[Action] { self.get_match(event, context).map(|rule| rule.actions()).unwrap_or(&[]) } diff --git a/crates/ruma-common/src/push/condition.rs b/crates/ruma-common/src/push/condition.rs index 860c508b..8f3dcc41 100644 --- a/crates/ruma-common/src/push/condition.rs +++ b/crates/ruma-common/src/push/condition.rs @@ -4,7 +4,7 @@ use js_int::{Int, UInt}; use ruma_serde::Raw; use serde::{Deserialize, Serialize}; use serde_json::{to_value as to_json_value, value::Value as JsonValue}; -use tracing::warn; +use tracing::{instrument, warn}; use wildmatch::WildMatch; use crate::{power_levels::NotificationPowerLevels, RoomId, UserId}; @@ -277,6 +277,7 @@ impl FlattenedJson { } /// Flatten and insert the `value` at `path`. + #[instrument(skip(self, value))] fn flatten_value(&mut self, value: JsonValue, path: String) { match value { JsonValue::Object(fields) => {