mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Cleanup useless metrics.go for garbagecollector
The metrics of garbagecollector are already published with the workqueue metrics, so metrics.go is useless, let's cleanup it. See https://github.com/kubernetes/client-go/blob/master/util/workqueue/metrics.go.
This commit is contained in:
parent
d816555e44
commit
154ab548f9
@ -15,7 +15,6 @@ go_library(
|
|||||||
"garbagecollector.go",
|
"garbagecollector.go",
|
||||||
"graph.go",
|
"graph.go",
|
||||||
"graph_builder.go",
|
"graph_builder.go",
|
||||||
"metrics.go",
|
|
||||||
"operations.go",
|
"operations.go",
|
||||||
"patch.go",
|
"patch.go",
|
||||||
"rate_limiter_helper.go",
|
"rate_limiter_helper.go",
|
||||||
@ -31,7 +30,6 @@ go_library(
|
|||||||
"//pkg/util/workqueue/prometheus:go_default_library",
|
"//pkg/util/workqueue/prometheus:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
"//vendor/github.com/golang/glog:go_default_library",
|
||||||
"//vendor/github.com/golang/groupcache/lru:go_default_library",
|
"//vendor/github.com/golang/groupcache/lru:go_default_library",
|
||||||
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
|
||||||
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||||
"//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library",
|
"//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library",
|
||||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
@ -39,7 +37,6 @@ go_library(
|
|||||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
|
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||||
"//vendor/k8s.io/apimachinery/pkg/util/clock:go_default_library",
|
|
||||||
"//vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library",
|
"//vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library",
|
||||||
"//vendor/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
|
"//vendor/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
|
||||||
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||||
|
@ -137,8 +137,6 @@ func (gc *GarbageCollector) Run(workers int, stopCh <-chan struct{}) {
|
|||||||
go wait.Until(gc.runAttemptToOrphanWorker, 1*time.Second, stopCh)
|
go wait.Until(gc.runAttemptToOrphanWorker, 1*time.Second, stopCh)
|
||||||
}
|
}
|
||||||
|
|
||||||
Register()
|
|
||||||
|
|
||||||
<-stopCh
|
<-stopCh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,73 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 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 garbagecollector
|
|
||||||
|
|
||||||
import (
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/util/clock"
|
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
GarbageCollectSubsystem = "garbage_collector"
|
|
||||||
EventProcessingLatencyKey = "event_processing_latency_microseconds"
|
|
||||||
DirtyProcessingLatencyKey = "dirty_processing_latency_microseconds"
|
|
||||||
OrphanProcessingLatencyKey = "orphan_processing_latency_microseconds"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
EventProcessingLatency = prometheus.NewSummary(
|
|
||||||
prometheus.SummaryOpts{
|
|
||||||
Subsystem: GarbageCollectSubsystem,
|
|
||||||
Name: EventProcessingLatencyKey,
|
|
||||||
Help: "Time in microseconds of an event spend in the eventQueue",
|
|
||||||
},
|
|
||||||
)
|
|
||||||
DirtyProcessingLatency = prometheus.NewSummary(
|
|
||||||
prometheus.SummaryOpts{
|
|
||||||
Subsystem: GarbageCollectSubsystem,
|
|
||||||
Name: DirtyProcessingLatencyKey,
|
|
||||||
Help: "Time in microseconds of an item spend in the dirtyQueue",
|
|
||||||
},
|
|
||||||
)
|
|
||||||
OrphanProcessingLatency = prometheus.NewSummary(
|
|
||||||
prometheus.SummaryOpts{
|
|
||||||
Subsystem: GarbageCollectSubsystem,
|
|
||||||
Name: OrphanProcessingLatencyKey,
|
|
||||||
Help: "Time in microseconds of an item spend in the orphanQueue",
|
|
||||||
},
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
var registerMetrics sync.Once
|
|
||||||
|
|
||||||
// Register all metrics.
|
|
||||||
func Register() {
|
|
||||||
// Register the metrics.
|
|
||||||
registerMetrics.Do(func() {
|
|
||||||
prometheus.MustRegister(EventProcessingLatency)
|
|
||||||
prometheus.MustRegister(DirtyProcessingLatency)
|
|
||||||
prometheus.MustRegister(OrphanProcessingLatency)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func sinceInMicroseconds(clock clock.Clock, start time.Time) float64 {
|
|
||||||
return float64(clock.Since(start).Nanoseconds() / time.Microsecond.Nanoseconds())
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user