Skip to content

Commit

Permalink
chore(notifications): add tracing for circles notification
Browse files Browse the repository at this point in the history
  • Loading branch information
thevaibhav-dixit committed Feb 8, 2024
1 parent 17bf38a commit 7a96b9b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions core/notifications/src/executor/fcm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use google_fcm1::{
oauth2::{self, ServiceAccountKey},
FirebaseCloudMessaging,
};
use tracing::instrument;

use std::collections::{HashMap, HashSet};

Expand Down Expand Up @@ -60,6 +61,7 @@ impl FcmClient {
})
}

#[instrument(name = "fcm_client.send", skip(self, deep_link, device_tokens), err)]
pub async fn send(
&self,
device_tokens: HashSet<PushDeviceToken>,
Expand Down
4 changes: 3 additions & 1 deletion core/notifications/src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ mod config;
pub mod error;
mod fcm;

use fcm::FcmClient;
use tracing::instrument;

use crate::{notification_event::*, primitives::*, user_notification_settings::*};

pub use config::*;
use error::*;
use fcm::FcmClient;

#[derive(Clone)]
pub struct Executor {
Expand All @@ -28,6 +29,7 @@ impl Executor {
})
}

#[instrument(name = "executor.notify", skip(self, event), err)]
pub async fn notify<T: NotificationEventNew>(&self, event: T) -> Result<(), ExecutorError> {
let settings = self.settings.find_for_user_id(event.user_id()).await?;
if !settings.should_send_notification(
Expand Down
1 change: 1 addition & 0 deletions core/notifications/src/messages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use rust_i18n::t;

use crate::{notification_event::*, primitives::*};

#[derive(Debug)]
pub struct LocalizedMessage {
pub title: String,
pub body: String,
Expand Down

0 comments on commit 7a96b9b

Please sign in to comment.