diff --git a/.changelog/20261.txt b/.changelog/20261.txt new file mode 100644 index 00000000000..6a63d747ab4 --- /dev/null +++ b/.changelog/20261.txt @@ -0,0 +1,3 @@ +```release-note:bug +api: Fixed a bug where `AllocDirStats` field was missing from Read Stats client API +``` diff --git a/api/nodes.go b/api/nodes.go index 697c7d731d3..809382bf79b 100644 --- a/api/nodes.go +++ b/api/nodes.go @@ -783,6 +783,7 @@ type HostStats struct { Memory *HostMemoryStats CPU []*HostCPUStats DiskStats []*HostDiskStats + AllocDirStats *HostDiskStats DeviceStats []*DeviceGroupStats Uptime uint64 CPUTicksConsumed float64 diff --git a/api/nodes_test.go b/api/nodes_test.go index 3ba9459df98..e9604dfed73 100644 --- a/api/nodes_test.go +++ b/api/nodes_test.go @@ -153,6 +153,27 @@ func TestNodes_Info(t *testing.T) { must.GreaterEq(t, 1, len(result.Events)) } +func TestNode_Stats(t *testing.T) { + testutil.Parallel(t) + + c, s := makeClient(t, nil, func(c *testutil.TestServerConfig) { + c.DevMode = true + }) + defer s.Stop() + nodesAPI := c.Nodes() + nodeID := oneNodeFromNodeList(t, nodesAPI).ID + + stats, err := nodesAPI.Stats(nodeID, nil) + must.NoError(t, err) + + // there isn't much we can reliably check here except that the values are + // populated + must.NotNil(t, stats.Memory) + must.NonZero(t, stats.Memory.Available) + must.NotNil(t, stats.AllocDirStats) + must.NonZero(t, stats.AllocDirStats.Size) +} + func TestNodes_NoSecretID(t *testing.T) { testutil.Parallel(t)