Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(notification): stop recording notification payloads on tracing spans (#7892)

teoeb9ed4279f41
diff --git a/crates/notification/src/domain/models/queue_message.rs b/crates/notification/src/domain/models/queue_message.rs
index 57bb05f4b4..76714c78cc 100644
--- a/crates/notification/src/domain/models/queue_message.rs
+++ b/crates/notification/src/domain/models/queue_message.rs
@@ -335,6 +335,11 @@ impl<'a, T, U> QueueMessage<'a, T, U> {
}
impl<'a, T, U> QueueMessage<'a, T, U> {
+ /// The notification type this message delivers.
+ pub(crate) fn message_type(&self) -> &str {
+ &self.message_type
+ }
+
/// Consume the message and return its content.
pub(crate) fn into_inner(self) -> NotificationChannel<'a, T, U> {
self.content
diff --git a/crates/notification/src/domain/service/egress.rs b/crates/notification/src/domain/service/egress.rs
index 5bcf41410d..561ac2ec44 100644
--- a/crates/notification/src/domain/service/egress.rs
+++ b/crates/notification/src/domain/service/egress.rs
@@ -28,7 +28,6 @@ use macro_user_id::user_id::MacroUserIdStr;
use rootcause::prelude::ResultExt;
use rootcause::{Report, report};
use std::time::Duration;
-use tracing::Level;
/// Maximum time to wait for a single notification delivery before timing out.
pub(crate) const DELIVERY_TIMEOUT: Duration = Duration::from_secs(15);
@@ -155,7 +154,7 @@ where
/// on failure. Returns a list of results for each delivery attempt.
///
/// If a rate limit is configured and exceeded, returns an empty list (no delivery).
- #[tracing::instrument(ret, level = Level::INFO, skip(self))]
+ #[tracing::instrument(ret, skip_all, fields(message_type = message.message_type()))]
pub async fn deliver_notification(
&self,
message: QueueMessage<'static, serde_json::Value, serde_json::Value>,
diff --git a/services/notification_service/src/api/user_notification.rs b/services/notification_service/src/api/user_notification.rs
index 32a0de5175..5f0d49f4da 100644
--- a/services/notification_service/src/api/user_notification.rs
+++ b/services/notification_service/src/api/user_notification.rs
@@ -138,7 +138,7 @@ pub struct GetAllUserNotificationsResponse {
/// Convert a [`UserNotificationRow<serde_json::Value>`] into a
/// [`UserNotificationRow<NotifEvent>`] by tagging and deserializing the metadata.
-#[tracing::instrument(err)]
+#[tracing::instrument(err, skip(row), fields(notification_id = %row.notification_id))]
pub fn to_typed_row(
row: UserNotificationRow<serde_json::Value>,
) -> Result<UserNotificationRow<NotifEvent>, serde_json::Error> {