aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Telemetry/API/TelemetryController.cs
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2025-09-07 18:51:36 -0500
committerJP Dillingham <jp@dillingham.me>2025-09-07 18:51:36 -0500
commite8b3252564040b6b555434f4fcc6d0bd528d2f84 (patch)
treee004afafdd4d74c32ec66498f5678e19524cf97d /src/slskd/Telemetry/API/TelemetryController.cs
parent15d47430f10bb2f9f577d784767e15e50ae2846c (diff)
downloadslskd-e8b3252564040b6b555434f4fcc6d0bd528d2f84.tar.gz
wip
Diffstat (limited to 'src/slskd/Telemetry/API/TelemetryController.cs')
-rw-r--r--src/slskd/Telemetry/API/TelemetryController.cs20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/slskd/Telemetry/API/TelemetryController.cs b/src/slskd/Telemetry/API/TelemetryController.cs
index c725575c..6098f432 100644
--- a/src/slskd/Telemetry/API/TelemetryController.cs
+++ b/src/slskd/Telemetry/API/TelemetryController.cs
@@ -112,7 +112,7 @@ public class TelemetryController : ControllerBase
/// <param name="start">The start time.</param>
/// <param name="end">The end time.</param>
/// <returns>A dictionary keyed by direction and state and containing summary information.</returns>
- [HttpGet("statistics/transfers")]
+ [HttpGet("statistics/transfers/summary")]
[Authorize(Policy = AuthPolicy.Any)]
[ProducesResponseType(typeof(Dictionary<TransferDirection, Dictionary<TransferStates, TransferSummary>>), 200)]
public IActionResult GetTransferSummary(
@@ -130,6 +130,24 @@ public class TelemetryController : ControllerBase
return Ok(Telemetry.Statistics.GetTransferSummary(start.Value, end));
}
+ [HttpGet("statistics/transfers/histogram")]
+ [Authorize(Policy = AuthPolicy.Any)]
+ [ProducesResponseType(typeof(Dictionary<TransferDirection, Dictionary<TransferStates, TransferSummary>>), 200)]
+ public IActionResult GetTransferSummaryHistogram(
+ [FromQuery] DateTime? start = null,
+ [FromQuery] DateTime? end = null)
+ {
+ start ??= DateTime.MinValue;
+ end ??= DateTime.MaxValue;
+
+ if (start >= end)
+ {
+ return BadRequest("End time must be later than start time");
+ }
+
+ return Ok(Telemetry.Statistics.GetTransferSummaryHistogram(start.Value, end.Value, TimeSpan.FromSeconds(60)));
+ }
+
/// <summary>
/// Returns the top N user summaries by total count and direction.
/// </summary>