From ed1e7dc87f9471545d8da9244ed0f9209620e671 Mon Sep 17 00:00:00 2001 From: ychung-mot Date: Thu, 29 Aug 2024 13:41:42 -0700 Subject: [PATCH] chore: metrics for the aggr listings --- .../Repositories/RentalListingRepository.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server/StrDss.Data/Repositories/RentalListingRepository.cs b/server/StrDss.Data/Repositories/RentalListingRepository.cs index dd9f643d..2d1c9116 100644 --- a/server/StrDss.Data/Repositories/RentalListingRepository.cs +++ b/server/StrDss.Data/Repositories/RentalListingRepository.cs @@ -6,6 +6,7 @@ using StrDss.Model; using StrDss.Model.DelistingDtos; using StrDss.Model.RentalReportDtos; +using System.Diagnostics; namespace StrDss.Data.Repositories { @@ -95,8 +96,16 @@ public async Task> GetGroupedRentalListings(stri var extraSort = ""; + var stopwatch = Stopwatch.StartNew(); + var groupedListings = await Page(groupedQuery, pageSize, pageNumber, orderBy, direction, extraSort); + stopwatch.Stop(); + + _logger.LogInformation($"Get Grouped Listings (group) - Page Size: {pageSize}, Page Number: {pageNumber}, Time: {stopwatch.Elapsed.TotalSeconds} seconds"); + + stopwatch.Restart(); + foreach (var group in groupedListings.SourceList) { group.Listings @@ -105,6 +114,10 @@ public async Task> GetGroupedRentalListings(stri hostName, businessLicence, prRequirement, blRequirement, lgId, statusArray, reassigned, takedownComplete, group); } + _logger.LogInformation($"Get Grouped Listings (listings) - Page Size: {pageSize}, Page Number: {pageNumber}, Time: {stopwatch.Elapsed.TotalSeconds} seconds"); + + stopwatch.Stop(); + return groupedListings; }