1 /* 2 Copyright 2015 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package metrics 18 19 import ( 20 "k8s.io/component-base/metrics/testutil" 21 ) 22 23 // APIServerMetrics is metrics for API server 24 type APIServerMetrics testutil.Metrics 25 26 // Equal returns true if all metrics are the same as the arguments. 27 func (m *APIServerMetrics) Equal(o APIServerMetrics) bool { 28 return (*testutil.Metrics)(m).Equal(testutil.Metrics(o)) 29 } 30 31 func newAPIServerMetrics() APIServerMetrics { 32 result := testutil.NewMetrics() 33 return APIServerMetrics(result) 34 } 35 36 func parseAPIServerMetrics(data string) (APIServerMetrics, error) { 37 result := newAPIServerMetrics() 38 if err := testutil.ParseMetrics(data, (*testutil.Metrics)(&result)); err != nil { 39 return APIServerMetrics{}, err 40 } 41 return result, nil 42 } 43