Skip to content

Commit 2aa766e

Browse files
committed
serviceaccounts: Expose empty labels
1 parent 9f15cc1 commit 2aa766e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

internal/store/serviceaccount.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,16 @@ func createServiceAccountInfoFamilyGenerator() generator.FamilyGenerator {
5656
basemetrics.ALPHA,
5757
"",
5858
wrapServiceAccountFunc(func(sa *v1.ServiceAccount) *metric.Family {
59-
var labelKeys []string
60-
var labelValues []string
59+
var automountToken string
6160

6261
if sa.AutomountServiceAccountToken != nil {
63-
labelKeys = append(labelKeys, "automount_token")
64-
labelValues = append(labelValues, strconv.FormatBool(*sa.AutomountServiceAccountToken))
62+
automountToken = strconv.FormatBool(*sa.AutomountServiceAccountToken)
6563
}
6664

6765
return &metric.Family{
6866
Metrics: []*metric.Metric{{
69-
LabelKeys: labelKeys,
70-
LabelValues: labelValues,
67+
LabelKeys: []string{"automount_token"},
68+
LabelValues: []string{automountToken},
7169
Value: 1,
7270
}},
7371
}

0 commit comments

Comments
 (0)