forked from lavina/lavina
xmpp: add tracing instrumentations
This commit is contained in:
parent
381b5650bc
commit
f02971d407
|
@ -16,6 +16,7 @@ use crate::proto::IqClientBody;
|
||||||
use crate::XmppConnection;
|
use crate::XmppConnection;
|
||||||
|
|
||||||
impl<'a> XmppConnection<'a> {
|
impl<'a> XmppConnection<'a> {
|
||||||
|
#[tracing::instrument(skip(self, output, iq), name = "XmppConnection::handle_iq")]
|
||||||
pub async fn handle_iq(&self, output: &mut Vec<Event<'static>>, iq: Iq<IqClientBody>) {
|
pub async fn handle_iq(&self, output: &mut Vec<Event<'static>>, iq: Iq<IqClientBody>) {
|
||||||
match iq.body {
|
match iq.body {
|
||||||
IqClientBody::Bind(req) => {
|
IqClientBody::Bind(req) => {
|
||||||
|
@ -112,6 +113,7 @@ impl<'a> XmppConnection<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip(self), name = "XmppConnection::bind")]
|
||||||
pub(crate) async fn bind(&self, req: &BindRequest) -> BindResponse {
|
pub(crate) async fn bind(&self, req: &BindRequest) -> BindResponse {
|
||||||
BindResponse(Jid {
|
BindResponse(Jid {
|
||||||
name: Some(self.user.xmpp_name.clone()),
|
name: Some(self.user.xmpp_name.clone()),
|
||||||
|
@ -120,6 +122,7 @@ impl<'a> XmppConnection<'a> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip(self), name = "XmppConnection::disco_info")]
|
||||||
async fn disco_info(&self, to: Option<&Jid>, req: &InfoQuery) -> Result<InfoQuery, IqError> {
|
async fn disco_info(&self, to: Option<&Jid>, req: &InfoQuery) -> Result<InfoQuery, IqError> {
|
||||||
let identity;
|
let identity;
|
||||||
let feature;
|
let feature;
|
||||||
|
@ -199,6 +202,7 @@ impl<'a> XmppConnection<'a> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip(self, core), name = "XmppConnection::disco_items")]
|
||||||
async fn disco_items(&self, to: Option<&Jid>, req: &ItemQuery, core: &LavinaCore) -> ItemQuery {
|
async fn disco_items(&self, to: Option<&Jid>, req: &ItemQuery, core: &LavinaCore) -> ItemQuery {
|
||||||
let item = match to {
|
let item = match to {
|
||||||
Some(Jid {
|
Some(Jid {
|
||||||
|
|
|
@ -12,6 +12,7 @@ use proto_xmpp::xml::{Ignore, ToXml};
|
||||||
use crate::XmppConnection;
|
use crate::XmppConnection;
|
||||||
|
|
||||||
impl<'a> XmppConnection<'a> {
|
impl<'a> XmppConnection<'a> {
|
||||||
|
#[tracing::instrument(skip(self, output, m), name = "XmppConnection::message")]
|
||||||
pub async fn handle_message(&mut self, output: &mut Vec<Event<'static>>, m: Message<Ignore>) -> Result<()> {
|
pub async fn handle_message(&mut self, output: &mut Vec<Event<'static>>, m: Message<Ignore>) -> Result<()> {
|
||||||
if let Some(Jid {
|
if let Some(Jid {
|
||||||
name: Some(name),
|
name: Some(name),
|
||||||
|
|
|
@ -12,6 +12,7 @@ use proto_xmpp::xml::{Ignore, ToXml};
|
||||||
use crate::XmppConnection;
|
use crate::XmppConnection;
|
||||||
|
|
||||||
impl<'a> XmppConnection<'a> {
|
impl<'a> XmppConnection<'a> {
|
||||||
|
#[tracing::instrument(skip(self, output, p), name = "XmppConnection::handle_presence")]
|
||||||
pub async fn handle_presence(&mut self, output: &mut Vec<Event<'static>>, p: Presence<Ignore>) -> Result<()> {
|
pub async fn handle_presence(&mut self, output: &mut Vec<Event<'static>>, p: Presence<Ignore>) -> Result<()> {
|
||||||
match p.to {
|
match p.to {
|
||||||
None => {
|
None => {
|
||||||
|
@ -61,6 +62,7 @@ impl<'a> XmppConnection<'a> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip(self, output, r#type), name = "XmppConnection::self_presence")]
|
||||||
async fn self_presence(&mut self, output: &mut Vec<Event<'static>>, r#type: Option<&str>) {
|
async fn self_presence(&mut self, output: &mut Vec<Event<'static>>, r#type: Option<&str>) {
|
||||||
match r#type {
|
match r#type {
|
||||||
Some("unavailable") => {
|
Some("unavailable") => {
|
||||||
|
@ -88,6 +90,7 @@ impl<'a> XmppConnection<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip(self), name = "XmppConnection::retrieve_muc_presence")]
|
||||||
async fn retrieve_muc_presence(&mut self, name: &Name) -> Result<Presence<XUser>> {
|
async fn retrieve_muc_presence(&mut self, name: &Name) -> Result<Presence<XUser>> {
|
||||||
let a = self.user_handle.join_room(RoomId::try_from(name.0.clone())?).await?;
|
let a = self.user_handle.join_room(RoomId::try_from(name.0.clone())?).await?;
|
||||||
// TODO handle bans
|
// TODO handle bans
|
||||||
|
|
Loading…
Reference in New Issue