Skip to content

Commit

Permalink
store metric by pod-uid and container-name
Browse files Browse the repository at this point in the history
  • Loading branch information
waynepeking348 committed Aug 1, 2023
1 parent 44e4fd5 commit 29b7a4d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/metaserver/agent/metric/malachite/client/client_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (c *MalachiteClient) GetPodStats(ctx context.Context, podUID string) (map[s
general.Errorf("GetPodStats err %v", err)
continue
}
containersStats[containerID] = stats
containersStats[containerStatus.Name] = stats
}
return containersStats, nil
}
Expand Down
16 changes: 8 additions & 8 deletions pkg/metaserver/agent/metric/malachite/client/client_pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,15 @@ func TestGetPodContainerStats(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, 3, len(stats))

assert.NotNil(t, stats["p-uid1"]["p1-c-uid1"].V1)
assert.Nil(t, stats["p-uid1"]["p1-c-uid1"].V2)
assert.NotNil(t, stats["p-uid1"]["p1-c-name1"].V1)
assert.Nil(t, stats["p-uid1"]["p1-c-name1"].V2)

assert.NotNil(t, stats["p-uid1"]["p1-c-uid2"].V2)
assert.Nil(t, stats["p-uid1"]["p1-c-uid2"].V1)
assert.NotNil(t, stats["p-uid1"]["p1-c-name2"].V2)
assert.Nil(t, stats["p-uid1"]["p1-c-name2"].V1)

assert.NotNil(t, stats["p-uid2"]["p2-c-uid1"].V1)
assert.Nil(t, stats["p-uid2"]["p2-c-uid1"].V2)
assert.NotNil(t, stats["p-uid2"]["p2-c-name1"].V1)
assert.Nil(t, stats["p-uid2"]["p2-c-name1"].V2)

assert.NotNil(t, stats["p-uid3"]["p3-c-uid1"].V2)
assert.Nil(t, stats["p-uid3"]["p3-c-uid1"].V1)
assert.NotNil(t, stats["p-uid3"]["p3-c-name1"].V2)
assert.Nil(t, stats["p-uid3"]["p3-c-name1"].V1)
}

0 comments on commit 29b7a4d

Please sign in to comment.