mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Remove prometheus references from etcd version monitor
This commit is contained in:
parent
de877ec26e
commit
04d06d2f23
@ -17,9 +17,9 @@ go_library(
|
||||
importpath = "k8s.io/kubernetes/cluster/images/etcd-version-monitor",
|
||||
deps = [
|
||||
"//staging/src/k8s.io/component-base/metrics:go_default_library",
|
||||
"//staging/src/k8s.io/component-base/metrics/testutil:go_default_library",
|
||||
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
|
||||
"//vendor/github.com/prometheus/client_model/go:go_default_library",
|
||||
"//vendor/github.com/prometheus/common/expfmt:go_default_library",
|
||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
|
@ -27,10 +27,10 @@ import (
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
dto "github.com/prometheus/client_model/go"
|
||||
"github.com/prometheus/common/expfmt"
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
"k8s.io/component-base/metrics"
|
||||
"k8s.io/component-base/metrics/testutil"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
@ -271,9 +271,7 @@ func scrapeMetrics() (map[string]*dto.MetricFamily, error) {
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
// Parse the metrics in text format to a MetricFamily struct.
|
||||
var textParser expfmt.TextParser
|
||||
return textParser.TextToMetricFamilies(resp.Body)
|
||||
return testutil.TextToMetricFamilies(resp.Body)
|
||||
}
|
||||
|
||||
func renameMetric(mf *dto.MetricFamily, name string) {
|
||||
|
@ -92,6 +92,15 @@ func ParseMetrics(data string, output *Metrics) error {
|
||||
}
|
||||
}
|
||||
|
||||
// TextToMetricFamilies reads 'in' as the simple and flat text-based exchange
|
||||
// format and creates MetricFamily proto messages. It returns the MetricFamily
|
||||
// proto messages in a map where the metric names are the keys, along with any
|
||||
// error encountered.
|
||||
func TextToMetricFamilies(in io.Reader) (map[string]*dto.MetricFamily, error) {
|
||||
var textParser expfmt.TextParser
|
||||
return textParser.TextToMetricFamilies(in)
|
||||
}
|
||||
|
||||
// ExtractMetricSamples parses the prometheus metric samples from the input string.
|
||||
func ExtractMetricSamples(metricsBlob string) ([]*model.Sample, error) {
|
||||
dec := expfmt.NewDecoder(strings.NewReader(metricsBlob), expfmt.FmtText)
|
||||
|
Loading…
Reference in New Issue
Block a user