Skip to content

Commit d3a2083

Browse files
committed
feat(sqlite): Add #instrument[…] around all EventCacheStore methods.
1 parent 2d83d30 commit d3a2083

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,
@@ -1247,6 +1257,7 @@ impl EventCacheStore for SqliteEventCacheStore {
12471257
.await
12481258
}
12491259

1260+
#[instrument(skip(self, event))]
12501261
async fn save_event(&self, room_id: &RoomId, event: Event) -> Result<(), Self::Error> {
12511262
let Some(event_id) = event.event_id() else {
12521263
error!(%room_id, "Trying to save an event with no ID");
@@ -1269,6 +1280,7 @@ impl EventCacheStore for SqliteEventCacheStore {
12691280
.await
12701281
}
12711282

1283+
#[instrument(skip_all)]
12721284
async fn add_media_content(
12731285
&self,
12741286
request: &MediaRequestParameters,
@@ -1278,6 +1290,7 @@ impl EventCacheStore for SqliteEventCacheStore {
12781290
self.media_service.add_media_content(self, request, content, ignore_policy).await
12791291
}
12801292

1293+
#[instrument(skip_all)]
12811294
async fn replace_media_key(
12821295
&self,
12831296
from: &MediaRequestParameters,
@@ -1299,10 +1312,12 @@ impl EventCacheStore for SqliteEventCacheStore {
12991312
Ok(())
13001313
}
13011314

1315+
#[instrument(skip_all)]
13021316
async fn get_media_content(&self, request: &MediaRequestParameters) -> Result<Option<Vec<u8>>> {
13031317
self.media_service.get_media_content(self, request).await
13041318
}
13051319

1320+
#[instrument(skip_all)]
13061321
async fn remove_media_content(&self, request: &MediaRequestParameters) -> Result<()> {
13071322
let uri = self.encode_key(keys::MEDIA, request.source.unique_key());
13081323
let format = self.encode_key(keys::MEDIA, request.format.unique_key());
@@ -1313,13 +1328,15 @@ impl EventCacheStore for SqliteEventCacheStore {
13131328
Ok(())
13141329
}
13151330

1331+
#[instrument(skip(self))]
13161332
async fn get_media_content_for_uri(
13171333
&self,
13181334
uri: &MxcUri,
13191335
) -> Result<Option<Vec<u8>>, Self::Error> {
13201336
self.media_service.get_media_content_for_uri(self, uri).await
13211337
}
13221338

1339+
#[instrument(skip(self))]
13231340
async fn remove_media_content_for_uri(&self, uri: &MxcUri) -> Result<()> {
13241341
let uri = self.encode_key(keys::MEDIA, uri);
13251342

@@ -1329,17 +1346,20 @@ impl EventCacheStore for SqliteEventCacheStore {
13291346
Ok(())
13301347
}
13311348

1349+
#[instrument(skip_all)]
13321350
async fn set_media_retention_policy(
13331351
&self,
13341352
policy: MediaRetentionPolicy,
13351353
) -> Result<(), Self::Error> {
13361354
self.media_service.set_media_retention_policy(self, policy).await
13371355
}
13381356

1357+
#[instrument(skip_all)]
13391358
fn media_retention_policy(&self) -> MediaRetentionPolicy {
13401359
self.media_service.media_retention_policy()
13411360
}
13421361

1362+
#[instrument(skip_all)]
13431363
async fn set_ignore_media_retention_policy(
13441364
&self,
13451365
request: &MediaRequestParameters,
@@ -1348,6 +1368,7 @@ impl EventCacheStore for SqliteEventCacheStore {
13481368
self.media_service.set_ignore_media_retention_policy(self, request, ignore_policy).await
13491369
}
13501370

1371+
#[instrument(skip_all)]
13511372
async fn clean_up_media_cache(&self) -> Result<(), Self::Error> {
13521373
self.media_service.clean_up_media_cache(self).await
13531374
}

0 commit comments

Comments
 (0)