Improve apiserver storage size metric to allow it's graduation
Change name to make it compliant with prometheus guidelines. Calculate it on demand instead of periodic to comply with prometheus standards. Replace "endpoint" with "server" label to make it semantically consistent with storage factory
This commit is contained in:
@@ -76,6 +76,28 @@ func TestAPIServerProcessMetrics(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestAPIServerStorageMetrics(t *testing.T) {
|
||||
s := kubeapiservertesting.StartTestServerOrDie(t, nil, nil, framework.SharedEtcd())
|
||||
defer s.TearDownFn()
|
||||
|
||||
metrics, err := scrapeMetrics(s)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
samples, ok := metrics["apiserver_storage_size_bytes"]
|
||||
if !ok {
|
||||
t.Fatalf("apiserver_storage_size_bytes metric not exposed")
|
||||
}
|
||||
if len(samples) != 1 {
|
||||
t.Fatalf("Unexpected number of samples in apiserver_storage_size_bytes")
|
||||
}
|
||||
|
||||
if samples[0].Value == -1 {
|
||||
t.Errorf("Unexpected non-zero apiserver_storage_size_bytes, got: %s", samples[0].Value)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAPIServerMetrics(t *testing.T) {
|
||||
s := kubeapiservertesting.StartTestServerOrDie(t, nil, nil, framework.SharedEtcd())
|
||||
defer s.TearDownFn()
|
||||
|
Reference in New Issue
Block a user