aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Telemetry/StatisticsService.cs
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2025-09-07 18:28:17 -0500
committerJP Dillingham <jp@dillingham.me>2025-09-07 18:28:17 -0500
commit15d47430f10bb2f9f577d784767e15e50ae2846c (patch)
tree678c14e7b8f0c971874077babd69fca4abc9d531 /src/slskd/Telemetry/StatisticsService.cs
parent0c395f46df8b966d149fbcba697b026b1605b62c (diff)
downloadslskd-15d47430f10bb2f9f577d784767e15e50ae2846c.tar.gz
change names, remove duplicated endpoint
Diffstat (limited to 'src/slskd/Telemetry/StatisticsService.cs')
-rw-r--r--src/slskd/Telemetry/StatisticsService.cs20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/slskd/Telemetry/StatisticsService.cs b/src/slskd/Telemetry/StatisticsService.cs
index ae072685..24d513b9 100644
--- a/src/slskd/Telemetry/StatisticsService.cs
+++ b/src/slskd/Telemetry/StatisticsService.cs
@@ -126,7 +126,7 @@ public class StatisticsService
/// <exception cref="ArgumentException">
/// Thrown if end time is not later than start time, or limit is not greater than zero.
/// </exception>
- public List<TransferSummary> GetSuccessfulTransferSummaryByDirectionAndUsername(
+ public List<TransferSummary> GetTransferRanking(
TransferDirection direction,
DateTime? start = null,
DateTime? end = null,
@@ -193,6 +193,19 @@ public class StatisticsService
return list;
}
+ /// <summary>
+ /// Returns a summary of distinct transfer errors and the number of times they occurred.
+ /// </summary>
+ /// <param name="start">The optional start time of the summary window.</param>
+ /// <param name="end">The optional end time of the summary window.</param>
+ /// <param name="direction">The direction (Upload or Download) for the summary.</param>
+ /// <param name="username">The optional username by which to filter results.</param>
+ /// <param name="limit">The number of records to return (default: 25).</param>
+ /// <param name="offset">The record offset (if paginating).</param>
+ /// <returns></returns>
+ /// <exception cref="ArgumentException">
+ /// Thrown if end time is not later than start time, or limit is not greater than zero.
+ /// </exception>
public Dictionary<string, long> GetTransferErrorSummary(
DateTime? start = null,
DateTime? end = null,
@@ -209,6 +222,11 @@ public class StatisticsService
throw new ArgumentException("End time must be later than start time");
}
+ if (limit <= 0)
+ {
+ throw new ArgumentOutOfRangeException("Limit must be greater than zero");
+ }
+
var dict = new Dictionary<string, long>();
var sql = @$"