Skip to content

Commit

Permalink
Now references closure scoped family generator
Browse files Browse the repository at this point in the history
Signed-off-by: Joel Whittaker-Smith <jdws.dev@gmail.com>
  • Loading branch information
jw-s committed Sep 28, 2020
1 parent a18b988 commit a112553
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@ func TestFullScrapeCycle(t *testing.T) {
t.Fatal(err)
}
builder.WithAllowDenyList(l)
builder.WithAllowLabels(map[string][]string{})
builder.WithAllowLabels(map[string][]string{
"kube_pod_labels": {
"namespace",
"pod",
},
})

handler := metricshandler.New(&options.Options{}, kubeClient, builder, false)
handler.ConfigureSharding(ctx, 0, 1)
Expand Down
2 changes: 1 addition & 1 deletion pkg/metric_generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func FilterMetricFamiliesLabels(allowLabels allowLabels, families []FamilyGenera
metricFamily := familyGenerator.GenerateFunc(obj)

for _, m := range metricFamily.Metrics {
m.LabelKeys, m.LabelValues = allowLabels.Allowed(f.Name, m.LabelKeys, m.LabelValues)
m.LabelKeys, m.LabelValues = allowLabels.Allowed(familyGenerator.Name, m.LabelKeys, m.LabelValues)
}
return metricFamily
}
Expand Down

0 comments on commit a112553

Please sign in to comment.