Merge pull request #58320 from hzxuzhonghu/cleanup

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

move prometheus register to pkg/endpoints/metrics/metrics.go

**What this PR does / why we need it**:
delete  k8s.io/apiserver/pkg/endpoints/apiserver.go
move prometheus init from k8s.io/apiserver/pkg/endpoints/apiserver.go to k8s.io/apiserver/pkg/endpoints/metrics/metrics.go

Since  k8s.io/apiserver/pkg/endpoints/apiserver.go only has a metrics init func, which should be in metrics pkg.

**Release note**:

```release-note
NONE
```

/assign @sttts @liggitt
This commit is contained in:
Kubernetes Submit Queue 2018-01-16 02:18:31 -08:00 committed by GitHub
commit a6710f3b87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)