This is an automated email from the ASF dual-hosted git repository.
hubcio pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iggy.git
The following commit(s) were added to refs/heads/master by this push:
new 86bf41914 feat(csharp): add mising metrics to StatsResponse (#3221)
86bf41914 is described below
commit 86bf419146be1f187898983504af706fc33a60f5
Author: Ćukasz Zborek <[email protected]>
AuthorDate: Sat May 9 13:37:32 2026 +0200
feat(csharp): add mising metrics to StatsResponse (#3221)
---
.../csharp/Iggy_SDK.Tests.Integration/SystemTests.cs | 13 ++++++++-----
foreign/csharp/Iggy_SDK/Contracts/StatsResponse.cs | 17 +++++++++++++++++
foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs | 15 +++++++++++++--
3 files changed, 38 insertions(+), 7 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..890b66802 100644
--- a/foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs
+++ b/foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs
@@ -790,12 +790,20 @@ internal static class BinaryMapper
{
Hits =
BinaryPrimitives.ReadUInt64LittleEndian(payload[(position + 12)..(position +
20)]),
Misses =
BinaryPrimitives.ReadUInt64LittleEndian(payload[(position + 20)..(position +
28)]),
- HitRatio =
BinaryPrimitives.ReadSingleLittleEndian(payload[(position + 28)..(position +
36)])
+ HitRatio =
BinaryPrimitives.ReadSingleLittleEndian(payload[(position + 28)..(position +
32)])
};
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
};
}