Skip to content

Commit

Permalink
[CONS-6599] Bug fix kubelet probe issue with containerExclude (#29321)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuminyi authored and grantseltzer committed Oct 2, 2024
1 parent 99b1ce7 commit 10cc4e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (p *Provider) proberProbeTotal(metricFam *prom.MetricFamily, sender sender.
metricSuffix = "startup_probe"
default:
log.Debugf("Unsupported probe type %s", probeType)
return
continue
}

result := metric.Metric["result"]
Expand All @@ -80,17 +80,17 @@ func (p *Provider) proberProbeTotal(metricFam *prom.MetricFamily, sender sender.
metricSuffix += ".unknown.total"
default:
log.Debugf("Unsupported probe result %s", result)
return
continue
}

cID, _ := common.GetContainerID(p.store, metric.Metric, p.filter)
if cID == "" {
return
continue
}

tags, _ := tagger.Tag(cID, types.HighCardinality)
if len(tags) == 0 {
return
continue
}
tags = utils.ConcatenateTags(tags, p.Config.Tags)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,13 @@ func TestProvider_Provide(t *testing.T) {
value: 281049,
tags: []string{"instance_tag:something", "kube_namespace:kube-system", "pod_name:fluentbit-gke-45gvm", "kube_container_name:fluentbit"},
},
/* Excluded container is not expected, see containers.Filter in the test
{
name: common.KubeletMetricsPrefix + "liveness_probe.success.total",
value: 281049,
tags: []string{"instance_tag:something", "kube_namespace:kube-system", "pod_name:fluentbit-gke-45gvm", "kube_container_name:fluentbit-gke"},
},
*/
{
name: common.KubeletMetricsPrefix + "liveness_probe.success.total",
value: 1686298,
Expand Down Expand Up @@ -304,7 +306,7 @@ func TestProvider_Provide(t *testing.T) {
p, err := NewProvider(
&containers.Filter{
Enabled: true,
NameExcludeList: []*regexp.Regexp{regexp.MustCompile("agent-excluded")},
NameExcludeList: []*regexp.Regexp{regexp.MustCompile("fluentbit-gke")},
},
config,
store,
Expand Down

0 comments on commit 10cc4e4

Please sign in to comment.