Skip to content

Commit

Permalink
Add Total Searches to Daily Stats (#95)
Browse files Browse the repository at this point in the history
Add overall total number of searches. Also add percentage of total searches for 5s/15 measurements
  • Loading branch information
pieterhelsen authored May 9, 2021
1 parent 7f43c86 commit 8188e63
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,17 @@ def consume(self, obj: HarvesterActivityMessage):
self._over_15_seconds += 1

def get_summary(self) -> str:

pct_over_5seconds: float = 0
pct_over_15seconds: float = 0

if self._num_measurements > 0:
pct_over_5seconds = self._over_5_seconds / self._num_measurements * 100
pct_over_15seconds = self._over_15_seconds / self._num_measurements * 100

return (
f"Search 🔍: \n"
f"\t - average: {self._avg_time_seconds:0.2f}s average\n"
f"\t - over 5s: {self._over_5_seconds} occasions\n"
f"\t - over 15s: {self._over_15_seconds} occasions"
f"\t - average: {self._avg_time_seconds:0.2f}s over {self._num_measurements} searches\n"
f"\t - over 5s: {self._over_5_seconds} occasions ({pct_over_5seconds:0.1f}%)\n"
f"\t - over 15s: {self._over_15_seconds} occasions ({pct_over_15seconds:0.1f}%)"
)

0 comments on commit 8188e63

Please sign in to comment.