You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by lz...@apache.org on 2026/05/06 20:13:40 UTC

(iggy) branch feat/missing-stats created (now b25a50d0d)

This is an automated email from the ASF dual-hosted git repository.

lukaszzborek pushed a change to branch feat/missing-stats
in repository https://gitbox.apache.org/repos/asf/iggy.git


      at b25a50d0d feat(csharp): add server thread count and disk space metrics to StatsResponse

This branch includes the following new commits:

     new b25a50d0d feat(csharp): add server thread count and disk space metrics to StatsResponse

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(iggy) 01/01: feat(csharp): add server thread count and disk space metrics to StatsResponse

Posted by lz...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lukaszzborek pushed a commit to branch feat/missing-stats
in repository https://gitbox.apache.org/repos/asf/iggy.git

commit b25a50d0d2ff909c63c6e082e336446135bf2989
Author: Ɓukasz Zborek <lu...@gmail.com>
AuthorDate: Wed May 6 21:54:39 2026 +0200

    feat(csharp): add server thread count and disk space metrics to StatsResponse
---
 .../csharp/Iggy_SDK.Tests.Integration/SystemTests.cs    | 13 ++++++++-----
 foreign/csharp/Iggy_SDK/Contracts/StatsResponse.cs      | 17 +++++++++++++++++
 foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs         | 13 ++++++++++++-
 3 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/foreign/csharp/Iggy_SDK.Tests.Integration/SystemTests.cs b/foreign/csharp/Iggy_SDK.Tests.Integration/SystemTests.cs
index 40f1392b5..2f3cf278c 100644
--- a/foreign/csharp/Iggy_SDK.Tests.Integration/SystemTests.cs
+++ b/foreign/csharp/Iggy_SDK.Tests.Integration/SystemTests.cs
@@ -18,7 +18,6 @@
 using Apache.Iggy.Contracts;
 using Apache.Iggy.Enums;
 using Apache.Iggy.Exceptions;
-using Apache.Iggy.Kinds;
 using Apache.Iggy.Messages;
 using Apache.Iggy.Tests.Integrations.Attributes;
 using Apache.Iggy.Tests.Integrations.Fixtures;
@@ -111,8 +110,8 @@ public class SystemTests
         await tcpClient.CreateTopicAsync(Identifier.String(streamName), "first_topic", 2);
         var secondTopic = await tcpClient.CreateTopicAsync(Identifier.String(streamName), "second_topic", 2);
 
-        var consumerGroup = await tcpClient.CreateConsumerGroupAsync(
-            Identifier.String(streamName), Identifier.String("second_topic"), "test_consumer_group");
+        var consumerGroup = await tcpClient.CreateConsumerGroupAsync(Identifier.String(streamName),
+            Identifier.String("second_topic"), "test_consumer_group");
         await tcpClient.JoinConsumerGroupAsync(Identifier.String(streamName),
             Identifier.String("second_topic"), Identifier.String("test_consumer_group"));
         var me = await tcpClient.GetMeAsync();
@@ -167,6 +166,11 @@ public class SystemTests
         response.KernelVersion.ShouldNotBeNullOrEmpty();
         response.IggyServerVersion.ShouldNotBeNullOrEmpty();
         response.IggyServerSemver.ShouldNotBe(0u);
+        response.ThreadsCount.ShouldBeGreaterThanOrEqualTo(1u);
+        response.TotalDiskSpace.ShouldBeGreaterThan(0u);
+        response.FreeDiskSpace.ShouldBeGreaterThan(0u);
+        response.FreeDiskSpace.ShouldBeGreaterThan(0u);
+        response.FreeDiskSpace.ShouldBeLessThanOrEqualTo(response.TotalDiskSpace);
     }
 
     [Test]
@@ -184,8 +188,7 @@ public class SystemTests
     {
         var client = await Fixture.CreateAuthenticatedClient(protocol);
 
-        var snapshot = await client.GetSnapshotAsync(
-            SnapshotCompression.Deflated,
+        var snapshot = await client.GetSnapshotAsync(SnapshotCompression.Deflated,
             [SystemSnapshotType.Test]);
 
         snapshot.ShouldNotBeNull();
diff --git a/foreign/csharp/Iggy_SDK/Contracts/StatsResponse.cs b/foreign/csharp/Iggy_SDK/Contracts/StatsResponse.cs
index 0bf3f3fcf..6eb128aa5 100644
--- a/foreign/csharp/Iggy_SDK/Contracts/StatsResponse.cs
+++ b/foreign/csharp/Iggy_SDK/Contracts/StatsResponse.cs
@@ -158,4 +158,21 @@ public sealed class StatsResponse
     ///     Cache metrics per partition
     /// </summary>
     public Dictionary<CacheMetricsKey, CacheMetrics> CacheMetrics { get; init; } = [];
+
+    /// <summary>
+    ///     Number of threads in the server process.
+    /// </summary>
+    public uint ThreadsCount { get; init; }
+
+    /// <summary>
+    ///     Available (free) disk space for the data directory.
+    /// </summary>
+    [JsonConverter(typeof(SizeConverter))]
+    public ulong FreeDiskSpace { get; init; }
+
+    /// <summary>
+    ///     Total disk space for the data directory.
+    /// </summary>
+    [JsonConverter(typeof(SizeConverter))]
+    public ulong TotalDiskSpace { get; init; }
 }
diff --git a/foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs b/foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs
index 7ec286d8e..eb45de2c8 100644
--- a/foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs
+++ b/foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs
@@ -794,8 +794,16 @@ internal static class BinaryMapper
             };
 
             cacheMetricsList.Add(cacheMetricsKey, cacheMetrics);
+            position += 32;
         }
 
+        var threadsCount = BinaryPrimitives.ReadUInt32LittleEndian(payload[position..(position + 4)]);
+        position += 4;
+        var freeDiskSpace = BinaryPrimitives.ReadUInt64LittleEndian(payload[position..(position + 8)]);
+        position += 8;
+        var totalDiskSpace = BinaryPrimitives.ReadUInt64LittleEndian(payload[position..(position + 8)]);
+        position += 8;
+
         return new StatsResponse
         {
             ProcessId = processId,
@@ -822,7 +830,10 @@ internal static class BinaryMapper
             MessagesSizeBytes = totalSizeBytes,
             IggyServerVersion = iggyVersion,
             IggyServerSemver = iggySemVersion,
-            CacheMetrics = cacheMetricsList
+            CacheMetrics = cacheMetricsList,
+            ThreadsCount = threadsCount,
+            FreeDiskSpace = freeDiskSpace,
+            TotalDiskSpace = totalDiskSpace
         };
     }