mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 03:57:41 +00:00
remove metrics prober_probe_result
This commit is contained in:
parent
295d672d54
commit
6d041abba7
@ -47,24 +47,6 @@ var ProberResults = prometheus.NewCounterVec(
|
|||||||
"pod_uid"},
|
"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
|
// 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
|
// 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
|
// manager use the cached probe results to set the appropriate Ready state in the PodStatus when
|
||||||
|
@ -68,8 +68,7 @@ type worker struct {
|
|||||||
onHold bool
|
onHold bool
|
||||||
|
|
||||||
// proberResultsMetricLabels holds the labels attached to this worker
|
// proberResultsMetricLabels holds the labels attached to this worker
|
||||||
// for the ProberResults metric.
|
// for the ProberResults metric by result.
|
||||||
proberResultsMetricLabels prometheus.Labels
|
|
||||||
proberResultsSuccessfulMetricLabels prometheus.Labels
|
proberResultsSuccessfulMetricLabels prometheus.Labels
|
||||||
proberResultsFailedMetricLabels prometheus.Labels
|
proberResultsFailedMetricLabels prometheus.Labels
|
||||||
proberResultsUnknownMetricLabels prometheus.Labels
|
proberResultsUnknownMetricLabels prometheus.Labels
|
||||||
@ -109,10 +108,6 @@ func newWorker(
|
|||||||
"pod_uid": string(w.pod.UID),
|
"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 = deepCopyPrometheusLabels(basicMetricLabels)
|
||||||
w.proberResultsSuccessfulMetricLabels["result"] = probeResultSuccessful
|
w.proberResultsSuccessfulMetricLabels["result"] = probeResultSuccessful
|
||||||
|
|
||||||
@ -146,7 +141,6 @@ func (w *worker) run() {
|
|||||||
ProberResults.Delete(w.proberResultsSuccessfulMetricLabels)
|
ProberResults.Delete(w.proberResultsSuccessfulMetricLabels)
|
||||||
ProberResults.Delete(w.proberResultsFailedMetricLabels)
|
ProberResults.Delete(w.proberResultsFailedMetricLabels)
|
||||||
ProberResults.Delete(w.proberResultsUnknownMetricLabels)
|
ProberResults.Delete(w.proberResultsUnknownMetricLabels)
|
||||||
DeprecatedProberResults.Delete(w.proberResultsMetricLabels)
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
probeLoop:
|
probeLoop:
|
||||||
@ -260,7 +254,6 @@ func (w *worker) doProbe() (keepGoing bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
w.resultsManager.Set(w.containerID, result, w.pod)
|
w.resultsManager.Set(w.containerID, result, w.pod)
|
||||||
DeprecatedProberResults.With(w.proberResultsMetricLabels).Set(result.ToPrometheusType())
|
|
||||||
|
|
||||||
if w.probeType == liveness && result == results.Failure {
|
if w.probeType == liveness && result == results.Failure {
|
||||||
// The container fails a liveness check, it will need to be restarted.
|
// The container fails a liveness check, it will need to be restarted.
|
||||||
|
@ -321,7 +321,6 @@ func (s *Server) InstallDefaultHandlers() {
|
|||||||
// prober metrics are exposed under a different endpoint
|
// prober metrics are exposed under a different endpoint
|
||||||
p := prometheus.NewRegistry()
|
p := prometheus.NewRegistry()
|
||||||
p.MustRegister(prober.ProberResults)
|
p.MustRegister(prober.ProberResults)
|
||||||
p.MustRegister(prober.DeprecatedProberResults)
|
|
||||||
s.restfulCont.Handle(proberMetricsPath,
|
s.restfulCont.Handle(proberMetricsPath,
|
||||||
promhttp.HandlerFor(p, promhttp.HandlerOpts{ErrorHandling: promhttp.ContinueOnError}),
|
promhttp.HandlerFor(p, promhttp.HandlerOpts{ErrorHandling: promhttp.ContinueOnError}),
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user