notesnook: add opentelemetry based metric logging

This commit is contained in:
Abdullah Atta
2024-06-07 15:41:44 +05:00
parent b304d314a0
commit 59cf7ffcde
6 changed files with 133 additions and 36 deletions
+4
View File
@@ -230,6 +230,8 @@ namespace Notesnook.API.Hubs
var userId = Context.User.FindFirstValue("sub");
if (string.IsNullOrEmpty(userId)) return 0;
SyncEventCounterSource.Log.Push();
try
{
var others = Clients.OthersInGroup(userId);
@@ -347,6 +349,8 @@ namespace Notesnook.API.Hubs
throw new HubException("Cannot fetch data while another sync is in progress. Please try again later.");
}
SyncEventCounterSource.Log.Fetch();
var userSettings = await Repositories.UsersSettings.FindOneAsync((u) => u.UserId == userId);
if (userSettings.LastSynced > 0 && lastSyncedTimestamp > userSettings.LastSynced)
{