Instrument call paths

This commit is contained in:
Jazz Turner-Baggs 2026-06-13 08:57:06 -07:00
parent ef7a27e9bb
commit c727948c3f
No known key found for this signature in database
5 changed files with 10 additions and 1 deletions

View File

@ -27,6 +27,7 @@ prost = "0.14.1"
rand_core = { version = "0.6" } rand_core = { version = "0.6" }
safer-ffi = "0.1.13" safer-ffi = "0.1.13"
thiserror = "2.0.17" thiserror = "2.0.17"
tracing = "0.1.44"
x25519-dalek = { version = "2.0.1", features = ["static_secrets", "reusable_secrets", "getrandom"] } x25519-dalek = { version = "2.0.1", features = ["static_secrets", "reusable_secrets", "getrandom"] }
[dev-dependencies] [dev-dependencies]

View File

@ -34,7 +34,7 @@ pub(crate) trait Convo<S: ExternalServices> {
} }
/// Group-only operations. /// Group-only operations.
pub(crate) trait GroupConvo<S: ExternalServices>: Convo<S> { pub(crate) trait GroupConvo<S: ExternalServices>: Convo<S> + std::fmt::Debug {
fn add_member( fn add_member(
&mut self, &mut self,
cx: &mut ServiceContext<S>, cx: &mut ServiceContext<S>,

View File

@ -15,6 +15,7 @@ use openmls::group::GroupId;
use shared_traits::IdentIdRef; use shared_traits::IdentIdRef;
use std::collections::HashMap; use std::collections::HashMap;
use storage::{ChatStore, ConversationKind, ConversationStore}; use storage::{ChatStore, ConversationKind, ConversationStore};
use tracing::{info, instrument};
pub use crate::conversation::ConversationId; pub use crate::conversation::ConversationId;
pub use crate::inbox::Introduction; pub use crate::inbox::Introduction;
@ -313,6 +314,7 @@ impl<'a, S: ExternalServices + 'static> Core<S> {
} }
// Decode bytes and send to protocol for processing. // Decode bytes and send to protocol for processing.
#[instrument(name = "core.handle_frame", skip_all, fields(user_id = %self.services.mls_identity.display_name()))]
pub fn handle_payload(&mut self, payload: &[u8]) -> Result<PayloadOutcome, ChatError> { pub fn handle_payload(&mut self, payload: &[u8]) -> Result<PayloadOutcome, ChatError> {
let env = EnvelopeV1::decode(payload)?; let env = EnvelopeV1::decode(payload)?;

View File

@ -11,6 +11,8 @@ use openmls::prelude::*;
use prost::{Message, Oneof}; use prost::{Message, Oneof};
use std::cell::RefCell; use std::cell::RefCell;
use storage::{ConversationKind, ConversationMeta, ConversationStore}; use storage::{ConversationKind, ConversationMeta, ConversationStore};
use tracing::info;
use tracing::instrument;
pub use identity::MlsIdentityProvider; pub use identity::MlsIdentityProvider;
pub(crate) use mls_provider::MlsEphemeralPqProvider; pub(crate) use mls_provider::MlsEphemeralPqProvider;
@ -122,6 +124,7 @@ impl InboxV2 {
conversation_id_for(&self.ident_id) conversation_id_for(&self.ident_id)
} }
#[instrument(name = "inboxV2.handle_frame", skip_all, fields(user_id = %service_ctx.mls_identity.display_name()))]
pub fn handle_frame<S: ExternalServices>( pub fn handle_frame<S: ExternalServices>(
&self, &self,
service_ctx: &mut ServiceContext<S>, service_ctx: &mut ServiceContext<S>,

View File

@ -6,6 +6,7 @@ use std::{
}; };
use libchat::{AddressedEnvelope, DeliveryService}; use libchat::{AddressedEnvelope, DeliveryService};
use tracing::info;
#[derive(Debug)] #[derive(Debug)]
struct BroadcasterShared<T> { struct BroadcasterShared<T> {
@ -107,6 +108,7 @@ impl DeliveryService for LocalBroadcaster {
type Error = String; type Error = String;
fn publish(&mut self, envelope: AddressedEnvelope) -> Result<(), Self::Error> { fn publish(&mut self, envelope: AddressedEnvelope) -> Result<(), Self::Error> {
info!(?envelope.delivery_address, len=envelope.data.len(), "DS:Publish");
self.outbound_msgs.push(Self::msg_id(&envelope)); self.outbound_msgs.push(Self::msg_id(&envelope));
self.shared.borrow_mut().messages.push_back(envelope); self.shared.borrow_mut().messages.push_back(envelope);
@ -114,6 +116,7 @@ impl DeliveryService for LocalBroadcaster {
} }
fn subscribe(&mut self, delivery_address: &str) -> Result<(), Self::Error> { fn subscribe(&mut self, delivery_address: &str) -> Result<(), Self::Error> {
info!(delivery_address, "DS:Subscribe");
// Strict temporal ordering of subscriptions is not enforced. // Strict temporal ordering of subscriptions is not enforced.
// Subscriptions are evaluated on polling, not when the message is published // Subscriptions are evaluated on polling, not when the message is published
self.subscriptions.insert(delivery_address.to_string()); self.subscriptions.insert(delivery_address.to_string());