Skip to content

Commit 420d373

Browse files
committed
feat(sqlite): Add #[instrument] around all SqliteEventCacheStore methods.
1 parent a79e913 commit 420d373

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

crates/matrix-sdk-sqlite/src/event_cache_store.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ async fn run_migrations(conn: &SqliteAsyncConn, version: u8) -> Result<()> {
453453
impl EventCacheStore for SqliteEventCacheStore {
454454
type Error = Error;
455455

456+
#[instrument(skip(self))]
456457
async fn try_take_leased_lock(
457458
&self,
458459
lease_duration_ms: u32,
@@ -486,6 +487,7 @@ impl EventCacheStore for SqliteEventCacheStore {
486487
Ok(num_touched == 1)
487488
}
488489

490+
#[instrument(skip(self, updates))]
489491
async fn handle_linked_chunk_updates(
490492
&self,
491493
linked_chunk_id: LinkedChunkId<'_>,
@@ -814,6 +816,7 @@ impl EventCacheStore for SqliteEventCacheStore {
814816
Ok(())
815817
}
816818

819+
#[instrument(skip(self))]
817820
async fn load_all_chunks(
818821
&self,
819822
linked_chunk_id: LinkedChunkId<'_>,
@@ -855,6 +858,7 @@ impl EventCacheStore for SqliteEventCacheStore {
855858
Ok(result)
856859
}
857860

861+
#[instrument(skip(self))]
858862
async fn load_all_chunks_metadata(
859863
&self,
860864
linked_chunk_id: LinkedChunkId<'_>,
@@ -915,6 +919,7 @@ impl EventCacheStore for SqliteEventCacheStore {
915919
.await
916920
}
917921

922+
#[instrument(skip(self))]
918923
async fn load_last_chunk(
919924
&self,
920925
linked_chunk_id: LinkedChunkId<'_>,
@@ -1007,6 +1012,7 @@ impl EventCacheStore for SqliteEventCacheStore {
10071012
.await
10081013
}
10091014

1015+
#[instrument(skip(self))]
10101016
async fn load_previous_chunk(
10111017
&self,
10121018
linked_chunk_id: LinkedChunkId<'_>,
@@ -1058,6 +1064,7 @@ impl EventCacheStore for SqliteEventCacheStore {
10581064
.await
10591065
}
10601066

1067+
#[instrument(skip(self))]
10611068
async fn clear_all_linked_chunks(&self) -> Result<(), Self::Error> {
10621069
self.write()
10631070
.await?
@@ -1071,6 +1078,7 @@ impl EventCacheStore for SqliteEventCacheStore {
10711078
Ok(())
10721079
}
10731080

1081+
#[instrument(skip(self, events))]
10741082
async fn filter_duplicated_events(
10751083
&self,
10761084
linked_chunk_id: LinkedChunkId<'_>,
@@ -1150,6 +1158,7 @@ impl EventCacheStore for SqliteEventCacheStore {
11501158
.await
11511159
}
11521160

1161+
#[instrument(skip(self, event_id))]
11531162
async fn find_event(
11541163
&self,
11551164
room_id: &RoomId,
@@ -1179,6 +1188,7 @@ impl EventCacheStore for SqliteEventCacheStore {
11791188
.await
11801189
}
11811190

1191+
#[instrument(skip(self, event_id, filters))]
11821192
async fn find_event_relations(
11831193
&self,
11841194
room_id: &RoomId,
@@ -1209,6 +1219,7 @@ impl EventCacheStore for SqliteEventCacheStore {
12091219
.await
12101220
}
12111221

1222+
#[instrument(skip(self, event))]
12121223
async fn save_event(&self, room_id: &RoomId, event: Event) -> Result<(), Self::Error> {
12131224
let Some(event_id) = event.event_id() else {
12141225
error!(%room_id, "Trying to save an event with no ID");
@@ -1231,6 +1242,7 @@ impl EventCacheStore for SqliteEventCacheStore {
12311242
.await
12321243
}
12331244

1245+
#[instrument(skip_all)]
12341246
async fn add_media_content(
12351247
&self,
12361248
request: &MediaRequestParameters,
@@ -1240,6 +1252,7 @@ impl EventCacheStore for SqliteEventCacheStore {
12401252
self.media_service.add_media_content(self, request, content, ignore_policy).await
12411253
}
12421254

1255+
#[instrument(skip_all)]
12431256
async fn replace_media_key(
12441257
&self,
12451258
from: &MediaRequestParameters,
@@ -1261,10 +1274,12 @@ impl EventCacheStore for SqliteEventCacheStore {
12611274
Ok(())
12621275
}
12631276

1277+
#[instrument(skip_all)]
12641278
async fn get_media_content(&self, request: &MediaRequestParameters) -> Result<Option<Vec<u8>>> {
12651279
self.media_service.get_media_content(self, request).await
12661280
}
12671281

1282+
#[instrument(skip_all)]
12681283
async fn remove_media_content(&self, request: &MediaRequestParameters) -> Result<()> {
12691284
let uri = self.encode_key(keys::MEDIA, request.source.unique_key());
12701285
let format = self.encode_key(keys::MEDIA, request.format.unique_key());
@@ -1275,13 +1290,15 @@ impl EventCacheStore for SqliteEventCacheStore {
12751290
Ok(())
12761291
}
12771292

1293+
#[instrument(skip(self))]
12781294
async fn get_media_content_for_uri(
12791295
&self,
12801296
uri: &MxcUri,
12811297
) -> Result<Option<Vec<u8>>, Self::Error> {
12821298
self.media_service.get_media_content_for_uri(self, uri).await
12831299
}
12841300

1301+
#[instrument(skip(self))]
12851302
async fn remove_media_content_for_uri(&self, uri: &MxcUri) -> Result<()> {
12861303
let uri = self.encode_key(keys::MEDIA, uri);
12871304

@@ -1291,17 +1308,20 @@ impl EventCacheStore for SqliteEventCacheStore {
12911308
Ok(())
12921309
}
12931310

1311+
#[instrument(skip_all)]
12941312
async fn set_media_retention_policy(
12951313
&self,
12961314
policy: MediaRetentionPolicy,
12971315
) -> Result<(), Self::Error> {
12981316
self.media_service.set_media_retention_policy(self, policy).await
12991317
}
13001318

1319+
#[instrument(skip_all)]
13011320
fn media_retention_policy(&self) -> MediaRetentionPolicy {
13021321
self.media_service.media_retention_policy()
13031322
}
13041323

1324+
#[instrument(skip_all)]
13051325
async fn set_ignore_media_retention_policy(
13061326
&self,
13071327
request: &MediaRequestParameters,
@@ -1310,6 +1330,7 @@ impl EventCacheStore for SqliteEventCacheStore {
13101330
self.media_service.set_ignore_media_retention_policy(self, request, ignore_policy).await
13111331
}
13121332

1333+
#[instrument(skip_all)]
13131334
async fn clean_up_media_cache(&self) -> Result<(), Self::Error> {
13141335
self.media_service.clean_up_media_cache(self).await
13151336
}

0 commit comments

Comments
 (0)