Add spans for parse_incoming/gen_event_id for alloc instruments
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -7,6 +7,14 @@ use crate::{Result, debug_error, err, matrix::room_version};
|
|||||||
///
|
///
|
||||||
/// Returns a tuple of the new `EventId` and the PDU as a `BTreeMap<String,
|
/// Returns a tuple of the new `EventId` and the PDU as a `BTreeMap<String,
|
||||||
/// CanonicalJsonValue>`.
|
/// CanonicalJsonValue>`.
|
||||||
|
#[tracing::instrument(
|
||||||
|
name = "gen_event_id",
|
||||||
|
level = "debug",
|
||||||
|
skip_all,
|
||||||
|
fields(
|
||||||
|
len = pdu.get().len(),
|
||||||
|
)
|
||||||
|
)]
|
||||||
pub fn gen_event_id_canonical_json(
|
pub fn gen_event_id_canonical_json(
|
||||||
pdu: &RawJsonValue,
|
pdu: &RawJsonValue,
|
||||||
room_version_id: &RoomVersionId,
|
room_version_id: &RoomVersionId,
|
||||||
@@ -23,6 +31,14 @@ pub fn gen_event_id_canonical_json(
|
|||||||
/// Generates a correct eventId for the PDU. For v1/v2 incoming PDU's the
|
/// Generates a correct eventId for the PDU. For v1/v2 incoming PDU's the
|
||||||
/// value's event_id is passed through. For all outgoing PDU's and for v3+
|
/// value's event_id is passed through. For all outgoing PDU's and for v3+
|
||||||
/// incoming PDU's it is generated.
|
/// incoming PDU's it is generated.
|
||||||
|
#[tracing::instrument(
|
||||||
|
level = "debug",
|
||||||
|
skip_all,
|
||||||
|
fields(
|
||||||
|
members = value.len(),
|
||||||
|
room_version = ?room_version_id,
|
||||||
|
)
|
||||||
|
)]
|
||||||
pub fn gen_event_id(
|
pub fn gen_event_id(
|
||||||
value: &CanonicalJsonObject,
|
value: &CanonicalJsonObject,
|
||||||
room_version_id: &RoomVersionId,
|
room_version_id: &RoomVersionId,
|
||||||
|
|||||||
@@ -5,6 +5,14 @@ use tuwunel_core::{Result, err, implement, matrix::event::gen_event_id, result::
|
|||||||
type Parsed = (OwnedRoomId, OwnedEventId, CanonicalJsonObject);
|
type Parsed = (OwnedRoomId, OwnedEventId, CanonicalJsonObject);
|
||||||
|
|
||||||
#[implement(super::Service)]
|
#[implement(super::Service)]
|
||||||
|
#[tracing::instrument(
|
||||||
|
name = "parse_incoming",
|
||||||
|
level = "trace",
|
||||||
|
skip_all,
|
||||||
|
fields(
|
||||||
|
len = pdu.get().len(),
|
||||||
|
)
|
||||||
|
)]
|
||||||
pub async fn parse_incoming_pdu(&self, pdu: &RawJsonValue) -> Result<Parsed> {
|
pub async fn parse_incoming_pdu(&self, pdu: &RawJsonValue) -> Result<Parsed> {
|
||||||
let value: CanonicalJsonObject = serde_json::from_str(pdu.get()).map_err(|e| {
|
let value: CanonicalJsonObject = serde_json::from_str(pdu.get()).map_err(|e| {
|
||||||
err!(BadServerResponse(debug_error!("Error parsing incoming event: {e} {pdu:#?}")))
|
err!(BadServerResponse(debug_error!("Error parsing incoming event: {e} {pdu:#?}")))
|
||||||
|
|||||||
Reference in New Issue
Block a user