mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-06-30 21:20:09 +00:00
Instrument call paths
This commit is contained in:
parent
ef7a27e9bb
commit
c727948c3f
@ -27,6 +27,7 @@ prost = "0.14.1"
|
||||
rand_core = { version = "0.6" }
|
||||
safer-ffi = "0.1.13"
|
||||
thiserror = "2.0.17"
|
||||
tracing = "0.1.44"
|
||||
x25519-dalek = { version = "2.0.1", features = ["static_secrets", "reusable_secrets", "getrandom"] }
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@ -34,7 +34,7 @@ pub(crate) trait Convo<S: ExternalServices> {
|
||||
}
|
||||
|
||||
/// 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(
|
||||
&mut self,
|
||||
cx: &mut ServiceContext<S>,
|
||||
|
||||
@ -15,6 +15,7 @@ use openmls::group::GroupId;
|
||||
use shared_traits::IdentIdRef;
|
||||
use std::collections::HashMap;
|
||||
use storage::{ChatStore, ConversationKind, ConversationStore};
|
||||
use tracing::{info, instrument};
|
||||
|
||||
pub use crate::conversation::ConversationId;
|
||||
pub use crate::inbox::Introduction;
|
||||
@ -313,6 +314,7 @@ impl<'a, S: ExternalServices + 'static> Core<S> {
|
||||
}
|
||||
|
||||
// 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> {
|
||||
let env = EnvelopeV1::decode(payload)?;
|
||||
|
||||
|
||||
@ -11,6 +11,8 @@ use openmls::prelude::*;
|
||||
use prost::{Message, Oneof};
|
||||
use std::cell::RefCell;
|
||||
use storage::{ConversationKind, ConversationMeta, ConversationStore};
|
||||
use tracing::info;
|
||||
use tracing::instrument;
|
||||
|
||||
pub use identity::MlsIdentityProvider;
|
||||
pub(crate) use mls_provider::MlsEphemeralPqProvider;
|
||||
@ -122,6 +124,7 @@ impl InboxV2 {
|
||||
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>(
|
||||
&self,
|
||||
service_ctx: &mut ServiceContext<S>,
|
||||
|
||||
@ -6,6 +6,7 @@ use std::{
|
||||
};
|
||||
|
||||
use libchat::{AddressedEnvelope, DeliveryService};
|
||||
use tracing::info;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct BroadcasterShared<T> {
|
||||
@ -107,6 +108,7 @@ impl DeliveryService for LocalBroadcaster {
|
||||
type Error = String;
|
||||
|
||||
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.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> {
|
||||
info!(delivery_address, "DS:Subscribe");
|
||||
// Strict temporal ordering of subscriptions is not enforced.
|
||||
// Subscriptions are evaluated on polling, not when the message is published
|
||||
self.subscriptions.insert(delivery_address.to_string());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user