Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion aspnetcore/src/api/Services/CooperationChoicesService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using api.Models.Common;
using api.Models.ProfileEditor;
using api.Models.Ttv;
using Microsoft.EntityFrameworkCore;
Expand Down Expand Up @@ -39,7 +40,10 @@ public async Task<List<ProfileEditorCooperationItem>> GetCooperationChoices(int
}).AsNoTracking().ToListAsync();

stopwatch.Stop();
_logger.LogInformation($"GetCooperationChoices. {cooperationItems.Count} items in {stopwatch.ElapsedMilliseconds}ms.");
if (stopwatch.ElapsedMilliseconds > Constants.LoggingParameters.SLOW_OPERATION_MS_THRESHOLD)
{
_logger.LogWarning($"GetCooperationChoices is slow. userprofileId={userprofileId}, forElasticsearch={forElasticsearch} in {stopwatch.ElapsedMilliseconds}ms.");
}

return cooperationItems;
}
Expand Down
17 changes: 10 additions & 7 deletions aspnetcore/src/api/Services/Profiledata/NameService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public NameService(
*/
public async Task<List<ProfileEditorName>> GetProfileEditorNames(int userprofileId, bool forElasticsearch = false)
{
var stopwatch = Stopwatch.StartNew();
var namesStopwatch = Stopwatch.StartNew();
List<ProfileEditorName> names = await _ttvContext.FactFieldValues.Where(ffv => ffv.DimUserProfileId == userprofileId
&& ffv.DimNameId > 0
&& ffv.DimFieldDisplaySettings.FieldIdentifier == Constants.FieldIdentifiers.PERSON_NAME
Expand Down Expand Up @@ -78,8 +78,11 @@ public async Task<List<ProfileEditorName>> GetProfileEditorNames(int userprofile
}
}

stopwatch.Stop();
_logger.LogInformation($"GetProfileEditorNames. {names.Count} items in {stopwatch.ElapsedMilliseconds}ms.");
namesStopwatch.Stop();
if (namesStopwatch.ElapsedMilliseconds > Constants.LoggingParameters.SLOW_OPERATION_MS_THRESHOLD)
{
_logger.LogWarning($"GetProfileEditorNames is slow. userprofileId={userprofileId}, forElasticsearch={forElasticsearch}, {names.Count} items in {namesStopwatch.ElapsedMilliseconds}ms.");
}

return names;
}
Expand All @@ -89,7 +92,7 @@ public async Task<List<ProfileEditorName>> GetProfileEditorNames(int userprofile
*/
public async Task<List<ProfileEditorName>> GetProfileEditorOtherNames(int userprofileId, bool forElasticsearch = false)
{
var stopwatch = Stopwatch.StartNew();
var otherNamesStopwatch = Stopwatch.StartNew();
List<ProfileEditorName> otherNames = await _ttvContext.FactFieldValues.Where(ffv => ffv.DimUserProfileId == userprofileId
&& ffv.DimNameId > 0
&& ffv.DimFieldDisplaySettings.FieldIdentifier == Constants.FieldIdentifiers.PERSON_OTHER_NAMES
Expand Down Expand Up @@ -135,10 +138,10 @@ public async Task<List<ProfileEditorName>> GetProfileEditorOtherNames(int userpr
}
}

stopwatch.Stop();
if (stopwatch.ElapsedMilliseconds > Constants.LoggingParameters.SLOW_OPERATION_MS_THRESHOLD)
otherNamesStopwatch.Stop();
if (otherNamesStopwatch.ElapsedMilliseconds > Constants.LoggingParameters.SLOW_OPERATION_MS_THRESHOLD)
{
_logger.LogWarning($"GetProfileEditorOtherNames is slow. userprofileId={userprofileId}, forElasticsearch={forElasticsearch}, {otherNames.Count} items in {stopwatch.ElapsedMilliseconds}ms.");
_logger.LogWarning($"GetProfileEditorOtherNames is slow. userprofileId={userprofileId}, forElasticsearch={forElasticsearch}, {otherNames.Count} items in {otherNamesStopwatch.ElapsedMilliseconds}ms.");
}

return otherNames;
Expand Down
6 changes: 5 additions & 1 deletion aspnetcore/src/api/Services/SettingsService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

using System.Diagnostics;
using System.Threading.Tasks;
using api.Models.Common;
using api.Models.ProfileEditor;
using api.Models.Ttv;
using Microsoft.EntityFrameworkCore;
Expand Down Expand Up @@ -36,7 +37,10 @@ public async Task<ProfileSettings> GetProfileSettings(int userprofileId, bool fo
};

stopwatch.Stop();
_logger.LogInformation($"GetProfileSettings retrieved in {stopwatch.ElapsedMilliseconds} ms");
if (stopwatch.ElapsedMilliseconds > Constants.LoggingParameters.SLOW_OPERATION_MS_THRESHOLD)
{
_logger.LogWarning($"GetProfileSettings is slow. userprofileId={userprofileId}, forElasticsearch={forElasticsearch} in {stopwatch.ElapsedMilliseconds}ms.");
}

return profileSettings;
}
Expand Down
Loading