feat(inputs.prometheus): Always apply kubernetes label and field selectors (#13624)
This commit is contained in:
parent
22100d4914
commit
42c7a2027f
|
|
@ -166,7 +166,6 @@ func (p *Prometheus) Init() error {
|
|||
p.MonitorKubernetesPodsMethod = MonitorMethodAnnotations
|
||||
}
|
||||
|
||||
if p.isNodeScrapeScope || p.MonitorKubernetesPodsMethod != MonitorMethodAnnotations {
|
||||
// Parse label and field selectors - will be used to filter pods after cAdvisor call
|
||||
var err error
|
||||
p.podLabelSelector, err = labels.Parse(p.KubernetesLabelSelector)
|
||||
|
|
@ -183,7 +182,6 @@ func (p *Prometheus) Init() error {
|
|||
}
|
||||
|
||||
p.Log.Infof("Using the label selector: %v and field selector: %v", p.podLabelSelector, p.podFieldSelector)
|
||||
}
|
||||
|
||||
for k, vs := range p.NamespaceAnnotationPass {
|
||||
tagFilter := models.TagFilter{}
|
||||
|
|
|
|||
|
|
@ -352,6 +352,7 @@ func TestPrometheusGeneratesSummaryMetricsV2(t *testing.T) {
|
|||
defer ts.Close()
|
||||
|
||||
p := &Prometheus{
|
||||
Log: &testutil.Logger{},
|
||||
URLs: []string{ts.URL},
|
||||
URLTag: "url",
|
||||
MetricVersion: 2,
|
||||
|
|
@ -385,6 +386,7 @@ go_gc_duration_seconds_count 42`
|
|||
defer ts.Close()
|
||||
|
||||
p := &Prometheus{
|
||||
Log: &testutil.Logger{},
|
||||
URLs: []string{ts.URL},
|
||||
URLTag: "",
|
||||
MetricVersion: 2,
|
||||
|
|
@ -444,6 +446,7 @@ func TestPrometheusGeneratesGaugeMetricsV2(t *testing.T) {
|
|||
defer ts.Close()
|
||||
|
||||
p := &Prometheus{
|
||||
Log: &testutil.Logger{},
|
||||
URLs: []string{ts.URL},
|
||||
URLTag: "url",
|
||||
MetricVersion: 2,
|
||||
|
|
|
|||
|
|
@ -389,6 +389,7 @@ rpc_duration_seconds_count 2693
|
|||
})
|
||||
|
||||
input := &inputs.Prometheus{
|
||||
Log: logger,
|
||||
URLs: []string{address},
|
||||
URLTag: "",
|
||||
MetricVersion: 1,
|
||||
|
|
|
|||
|
|
@ -420,6 +420,7 @@ rpc_duration_seconds_count 2693
|
|||
})
|
||||
|
||||
input := &inputs.Prometheus{
|
||||
Log: logger,
|
||||
URLs: []string{url},
|
||||
URLTag: "",
|
||||
MetricVersion: 2,
|
||||
|
|
|
|||
Loading…
Reference in New Issue