remove metrics prober_probe_result

k3s-v1.15.3
danielqsj 2019-04-04 17:03:11 +08:00
parent 295d672d54
commit 6d041abba7
3 changed files with 1 additions and 27 deletions

View File

@ -47,24 +47,6 @@ var ProberResults = prometheus.NewCounterVec(
"pod_uid"},
)
// DeprecatedProberResults stores the results of a probe as prometheus metrics.
// This metrics is deprecated, will be removed in a future release.
// Please convert to the metrics of counter type above.
var DeprecatedProberResults = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Subsystem: "prober",
Name: "probe_result",
Help: "(Deprecated) The result of a liveness or readiness probe for a container.",
},
[]string{"probe_type",
"container_name",
"container",
"pod_name",
"pod",
"namespace",
"pod_uid"},
)
// Manager manages pod probing. It creates a probe "worker" for every container that specifies a
// probe (AddPod). The worker periodically probes its assigned container and caches the results. The
// manager use the cached probe results to set the appropriate Ready state in the PodStatus when

View File

@ -68,8 +68,7 @@ type worker struct {
onHold bool
// proberResultsMetricLabels holds the labels attached to this worker
// for the ProberResults metric.
proberResultsMetricLabels prometheus.Labels
// for the ProberResults metric by result.
proberResultsSuccessfulMetricLabels prometheus.Labels
proberResultsFailedMetricLabels prometheus.Labels
proberResultsUnknownMetricLabels prometheus.Labels
@ -109,10 +108,6 @@ func newWorker(
"pod_uid": string(w.pod.UID),
}
w.proberResultsMetricLabels = deepCopyPrometheusLabels(basicMetricLabels)
w.proberResultsMetricLabels["container_name"] = w.container.Name
w.proberResultsMetricLabels["pod_name"] = w.pod.Name
w.proberResultsSuccessfulMetricLabels = deepCopyPrometheusLabels(basicMetricLabels)
w.proberResultsSuccessfulMetricLabels["result"] = probeResultSuccessful
@ -146,7 +141,6 @@ func (w *worker) run() {
ProberResults.Delete(w.proberResultsSuccessfulMetricLabels)
ProberResults.Delete(w.proberResultsFailedMetricLabels)
ProberResults.Delete(w.proberResultsUnknownMetricLabels)
DeprecatedProberResults.Delete(w.proberResultsMetricLabels)
}()
probeLoop:
@ -260,7 +254,6 @@ func (w *worker) doProbe() (keepGoing bool) {
}
w.resultsManager.Set(w.containerID, result, w.pod)
DeprecatedProberResults.With(w.proberResultsMetricLabels).Set(result.ToPrometheusType())
if w.probeType == liveness && result == results.Failure {
// The container fails a liveness check, it will need to be restarted.

View File

@ -321,7 +321,6 @@ func (s *Server) InstallDefaultHandlers() {
// prober metrics are exposed under a different endpoint
p := prometheus.NewRegistry()
p.MustRegister(prober.ProberResults)
p.MustRegister(prober.DeprecatedProberResults)
s.restfulCont.Handle(proberMetricsPath,
promhttp.HandlerFor(p, promhttp.HandlerOpts{ErrorHandling: promhttp.ContinueOnError}),
)