Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions foreign/csharp/Iggy_SDK.Tests.Integration/SystemTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -111,8 +110,8 @@ public async Task GetClient_WithConsumerGroup_Should_Return_CorrectClient(Protoc
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();
Expand Down Expand Up @@ -167,6 +166,11 @@ await client.SendMessagesAsync(Identifier.String(streamName),
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]
Expand All @@ -184,8 +188,7 @@ public async Task GetSnapshot_Should_Return_ValidZipData(Protocol protocol)
{
var client = await Fixture.CreateAuthenticatedClient(protocol);

var snapshot = await client.GetSnapshotAsync(
SnapshotCompression.Deflated,
var snapshot = await client.GetSnapshotAsync(SnapshotCompression.Deflated,
[SystemSnapshotType.Test]);

snapshot.ShouldNotBeNull();
Expand Down
17 changes: 17 additions & 0 deletions foreign/csharp/Iggy_SDK/Contracts/StatsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
15 changes: 13 additions & 2 deletions foreign/csharp/Iggy_SDK/Mappers/BinaryMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -790,12 +790,20 @@ internal static StatsResponse MapStats(ReadOnlySpan<byte> payload)
{
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,
Expand All @@ -822,7 +830,10 @@ internal static StatsResponse MapStats(ReadOnlySpan<byte> payload)
MessagesSizeBytes = totalSizeBytes,
IggyServerVersion = iggyVersion,
IggyServerSemver = iggySemVersion,
CacheMetrics = cacheMetricsList
CacheMetrics = cacheMetricsList,
ThreadsCount = threadsCount,
FreeDiskSpace = freeDiskSpace,
TotalDiskSpace = totalDiskSpace
};
}

Expand Down
Loading