move prometheus init to k8s.io/apiserver/pkg/endpoints/metrics/metrics.go

This commit is contained in:
hzxuzhonghu 2018-01-16 15:28:16 +08:00
parent bc361fae40
commit 631119a7d6
3 changed files with 2 additions and 28 deletions

View File

@ -60,7 +60,6 @@ go_test(
go_library(
name = "go_default_library",
srcs = [
"apiserver.go",
"doc.go",
"groupversion.go",
"installer.go",

View File

@ -1,25 +0,0 @@
/*
Copyright 2014 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package endpoints
import (
"k8s.io/apiserver/pkg/endpoints/metrics"
)
func init() {
metrics.Register()
}

View File

@ -81,8 +81,8 @@ var (
kubectlExeRegexp = regexp.MustCompile(`^.*((?i:kubectl\.exe))`)
)
// Register all metrics.
func Register() {
func init() {
// Register all metrics.
prometheus.MustRegister(requestCounter)
prometheus.MustRegister(longRunningRequestGauge)
prometheus.MustRegister(requestLatencies)