aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Telemetry/Types
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2025-12-07 17:06:26 -0600
committerGitHub <noreply@github.com>2025-12-07 17:06:26 -0600
commit5e5126028ae7cf9a9d4ad87bc24033af69ec8e8e (patch)
tree76e4d1e91f8b1de41729c475f8a1f47231a4a183 /src/slskd/Telemetry/Types
parent869c5535218a8fc7bff2c10ae73d59847b19b55f (diff)
parent49bf81959177a2c3139d83fe3498c574bf325acd (diff)
downloadslskd-5e5126028ae7cf9a9d4ad87bc24033af69ec8e8e.tar.gz
Merge pull request #1547 from slskd/statistics
Add statistics
Diffstat (limited to 'src/slskd/Telemetry/Types')
-rw-r--r--src/slskd/Telemetry/Types/DirectoryDetail.cs23
-rw-r--r--src/slskd/Telemetry/Types/LeaderboardSorting.cs25
-rw-r--r--src/slskd/Telemetry/Types/PrometheusMetric.cs2
-rw-r--r--src/slskd/Telemetry/Types/SortOrder.cs24
-rw-r--r--src/slskd/Telemetry/Types/TransferExceptionDetail.cs39
-rw-r--r--src/slskd/Telemetry/Types/TransferExceptionSummary.cs25
-rw-r--r--src/slskd/Telemetry/Types/TransferSummary.cs29
-rw-r--r--src/slskd/Telemetry/Types/UserDirectionTransferSummary.cs36
8 files changed, 202 insertions, 1 deletions
diff --git a/src/slskd/Telemetry/Types/DirectoryDetail.cs b/src/slskd/Telemetry/Types/DirectoryDetail.cs
new file mode 100644
index 00000000..54901507
--- /dev/null
+++ b/src/slskd/Telemetry/Types/DirectoryDetail.cs
@@ -0,0 +1,23 @@
+// <copyright file="DirectoryDetail.cs" company="slskd Team">
+// Copyright (c) slskd Team. All rights reserved.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published
+// by the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see https://www.gnu.org/licenses/.
+// </copyright>
+
+public record TransferDirectorySummary
+{
+ public string Directory { get; init; }
+ public long Count { get; init; }
+ public long DistinctUsers { get; init; }
+} \ No newline at end of file
diff --git a/src/slskd/Telemetry/Types/LeaderboardSorting.cs b/src/slskd/Telemetry/Types/LeaderboardSorting.cs
new file mode 100644
index 00000000..e90a8c3d
--- /dev/null
+++ b/src/slskd/Telemetry/Types/LeaderboardSorting.cs
@@ -0,0 +1,25 @@
+// <copyright file="LeaderboardSorting.cs" company="slskd Team">
+// Copyright (c) slskd Team. All rights reserved.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published
+// by the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see https://www.gnu.org/licenses/.
+// </copyright>
+
+namespace slskd.Telemetry;
+
+public enum LeaderboardSortBy
+{
+ Count,
+ TotalBytes,
+ AverageSpeed,
+} \ No newline at end of file
diff --git a/src/slskd/Telemetry/Types/PrometheusMetric.cs b/src/slskd/Telemetry/Types/PrometheusMetric.cs
index 93ca6422..05e2446d 100644
--- a/src/slskd/Telemetry/Types/PrometheusMetric.cs
+++ b/src/slskd/Telemetry/Types/PrometheusMetric.cs
@@ -15,7 +15,7 @@
// along with this program. If not, see https://www.gnu.org/licenses/.
// </copyright>
-namespace slskd;
+namespace slskd.Telemetry;
using System.Collections.Generic;
diff --git a/src/slskd/Telemetry/Types/SortOrder.cs b/src/slskd/Telemetry/Types/SortOrder.cs
new file mode 100644
index 00000000..7f70fd21
--- /dev/null
+++ b/src/slskd/Telemetry/Types/SortOrder.cs
@@ -0,0 +1,24 @@
+// <copyright file="SortOrder.cs" company="slskd Team">
+// Copyright (c) slskd Team. All rights reserved.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published
+// by the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see https://www.gnu.org/licenses/.
+// </copyright>
+
+namespace slskd.Telemetry;
+
+public enum SortOrder
+{
+ ASC,
+ DESC,
+} \ No newline at end of file
diff --git a/src/slskd/Telemetry/Types/TransferExceptionDetail.cs b/src/slskd/Telemetry/Types/TransferExceptionDetail.cs
new file mode 100644
index 00000000..a749c6a5
--- /dev/null
+++ b/src/slskd/Telemetry/Types/TransferExceptionDetail.cs
@@ -0,0 +1,39 @@
+// <copyright file="TransferExceptionDetail.cs" company="slskd Team">
+// Copyright (c) slskd Team. All rights reserved.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published
+// by the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see https://www.gnu.org/licenses/.
+// </copyright>
+
+namespace slskd.Telemetry;
+
+using System;
+using Soulseek;
+
+public record TransferExceptionDetail
+{
+ public string Id { get; init; }
+ public string Username { get; init; }
+ public TransferDirection Direction { get; init; }
+ public string Filename { get; init; }
+ public long Size { get; set; }
+ public long StartOffset { get; init; }
+ public TransferStates State { get; set; } = TransferStates.None;
+ public DateTime RequestedAt { get; set; }
+ public DateTime? EnqueuedAt { get; set; }
+ public DateTime? StartedAt { get; set; }
+ public DateTime? EndedAt { get; set; }
+ public long BytesTransferred { get; set; }
+ public double AverageSpeed { get; set; }
+ public string Exception { get; set; }
+} \ No newline at end of file
diff --git a/src/slskd/Telemetry/Types/TransferExceptionSummary.cs b/src/slskd/Telemetry/Types/TransferExceptionSummary.cs
new file mode 100644
index 00000000..03b64df5
--- /dev/null
+++ b/src/slskd/Telemetry/Types/TransferExceptionSummary.cs
@@ -0,0 +1,25 @@
+// <copyright file="TransferExceptionSummary.cs" company="slskd Team">
+// Copyright (c) slskd Team. All rights reserved.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published
+// by the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see https://www.gnu.org/licenses/.
+// </copyright>
+
+namespace slskd.Telemetry;
+
+public record TransferExceptionSummary
+{
+ public string Exception { get; init; }
+ public long Count { get; init; }
+ public long DistinctUsers { get; init; }
+} \ No newline at end of file
diff --git a/src/slskd/Telemetry/Types/TransferSummary.cs b/src/slskd/Telemetry/Types/TransferSummary.cs
new file mode 100644
index 00000000..c25f81fc
--- /dev/null
+++ b/src/slskd/Telemetry/Types/TransferSummary.cs
@@ -0,0 +1,29 @@
+// <copyright file="TransferSummary.cs" company="slskd Team">
+// Copyright (c) slskd Team. All rights reserved.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published
+// by the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see https://www.gnu.org/licenses/.
+// </copyright>
+
+namespace slskd.Telemetry;
+
+public record TransferSummary
+{
+ public string Username { get; init; }
+ public long TotalBytes { get; init; }
+ public long Count { get; init; }
+ public long DistinctUsers { get; init; }
+ public double AverageSpeed { get; init; }
+ public double AverageWait { get; init; }
+ public double AverageDuration { get; init; }
+} \ No newline at end of file
diff --git a/src/slskd/Telemetry/Types/UserDirectionTransferSummary.cs b/src/slskd/Telemetry/Types/UserDirectionTransferSummary.cs
new file mode 100644
index 00000000..c6d30a04
--- /dev/null
+++ b/src/slskd/Telemetry/Types/UserDirectionTransferSummary.cs
@@ -0,0 +1,36 @@
+// <copyright file="UserDirectionTransferSummary.cs" company="slskd Team">
+// Copyright (c) slskd Team. All rights reserved.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published
+// by the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see https://www.gnu.org/licenses/.
+// </copyright>
+
+namespace slskd.Telemetry;
+
+using System.Collections.Generic;
+using Soulseek;
+
+public record UserDirectionTransferSummary
+{
+ public Dictionary<TransferStates, TransferSummary> Summary { get; init; }
+ public UserDirectionTransferStatistics Statistics { get; init; }
+ public List<TransferExceptionSummary> Exceptions { get; init; }
+}
+
+public record UserDirectionTransferStatistics
+{
+ public long Total { get; init; }
+ public long Successful { get; init; }
+ public long Errored { get; init; }
+ public long Cancelled { get; init; }
+} \ No newline at end of file