misc tracing span tweaks

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-12-08 20:31:16 +00:00
parent 5fc8e90e02
commit aba88ccead
16 changed files with 96 additions and 24 deletions

View file

@ -155,6 +155,12 @@ impl Manager {
/// should never error with a panic, and if so it should propagate, but it may
/// error with an Abort which the manager should handle along with results to
/// determine if the worker should be restarted.
#[tracing::instrument(
parent = None,
level = "trace",
skip_all,
fields(service = %service.name()),
)]
async fn worker(service: Arc<dyn Service>) -> WorkerResult {
let service_ = Arc::clone(&service);
let result = AssertUnwindSafe(service_.worker())

View file

@ -26,7 +26,7 @@ impl ActualDest {
}
impl super::Service {
#[tracing::instrument(skip_all, name = "resolve")]
#[tracing::instrument(skip_all, level = "debug", name = "resolve")]
pub(crate) async fn get_actual_dest(&self, server_name: &ServerName) -> Result<ActualDest> {
let (result, cached) = if let Some(result) = self.get_cached_destination(server_name) {
(result, true)

View file

@ -184,7 +184,7 @@ impl Service {
/// Whether a server is allowed to see an event through federation, based on
/// the room's history_visibility at that event's state.
#[tracing::instrument(skip(self, origin, room_id, event_id))]
#[tracing::instrument(skip_all, level = "trace")]
pub async fn server_can_see_event(&self, origin: &ServerName, room_id: &RoomId, event_id: &EventId) -> bool {
let Ok(shortstatehash) = self.pdu_shortstatehash(event_id).await else {
return true;
@ -242,7 +242,7 @@ impl Service {
/// Whether a user is allowed to see an event, based on
/// the room's history_visibility at that event's state.
#[tracing::instrument(skip(self, user_id, room_id, event_id))]
#[tracing::instrument(skip_all, level = "trace")]
pub async fn user_can_see_event(&self, user_id: &UserId, room_id: &RoomId, event_id: &EventId) -> bool {
let Ok(shortstatehash) = self.pdu_shortstatehash(event_id).await else {
return true;
@ -293,7 +293,7 @@ impl Service {
/// Whether a user is allowed to see an event, based on
/// the room's history_visibility at that event's state.
#[tracing::instrument(skip(self, user_id, room_id))]
#[tracing::instrument(skip_all, level = "trace")]
pub async fn user_can_see_state_events(&self, user_id: &UserId, room_id: &RoomId) -> bool {
if self.services.state_cache.is_joined(user_id, room_id).await {
return true;

View file

@ -176,7 +176,6 @@ impl Data {
}
}
#[tracing::instrument(skip(key), level = "debug")]
fn parse_servercurrentevent(key: &[u8], value: &[u8]) -> Result<(Destination, SendingEvent)> {
// Appservices start with a plus
Ok::<_, Error>(if key.starts_with(b"+") {

View file

@ -24,7 +24,7 @@ use crate::{
};
impl super::Service {
#[tracing::instrument(skip(self, client, request), name = "send")]
#[tracing::instrument(skip_all, level = "debug")]
pub async fn send<T>(&self, client: &Client, dest: &ServerName, request: T) -> Result<T::IncomingResponse>
where
T: OutgoingRequest + Send,

View file

@ -62,7 +62,7 @@ pub const PDU_LIMIT: usize = 50;
pub const EDU_LIMIT: usize = 100;
impl Service {
#[tracing::instrument(skip_all, name = "sender")]
#[tracing::instrument(skip_all, level = "debug")]
pub(super) async fn sender(&self) -> Result<()> {
let mut statuses: CurTransactionStatus = CurTransactionStatus::new();
let mut futures: SendingFutures<'_> = FuturesUnordered::new();