File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
waku/waku_archive/driver/postgres_driver Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 55 stew/ [byteutils, arrayops],
66 results,
77 chronos,
8+ metrics,
89 db_connector/ [postgres, db_common],
910 chronicles
1011import
1617 ./ postgres_healthcheck,
1718 ./ partitions_manager
1819
20+ declarePublicGauge postgres_payload_size_bytes,
21+ " Payload size in bytes of correctly stored messages"
22+
1923type PostgresDriver * = ref object of ArchiveDriver
2024 # # Establish a separate pools for read/write operations
2125 writeConnPool: PgAsyncPool
@@ -333,14 +337,18 @@ method put*(
333337 return err (" could not put msg in messages table: " & $ error)
334338
335339 # # Now add the row to messages_lookup
336- return await s.writeConnPool.runStmt (
340+ let ret = await s.writeConnPool.runStmt (
337341 InsertRowInMessagesLookupStmtName ,
338342 InsertRowInMessagesLookupStmtDefinition ,
339343 @ [messageHash, timestamp],
340344 @ [int32 (messageHash.len), int32 (timestamp.len)],
341345 @ [int32 (0 ), int32 (0 )],
342346 )
343347
348+ if ret.isOk ():
349+ postgres_payload_size_bytes.set (message.payload.len)
350+ return ret
351+
344352method getAllMessages * (
345353 s: PostgresDriver
346354): Future [ArchiveDriverResult [seq [ArchiveRow ]]] {.async .} =
You can’t perform that action at this time.
0 commit comments