|
40 | 40 | podStatusReasons = []string{"Evicted", "NodeAffinity", "NodeLost", "Shutdown", "UnexpectedAdmissionError"} |
41 | 41 | ) |
42 | 42 |
|
43 | | -func podMetricFamilies(allowAnnotationsList, allowLabelsList []string) []generator.FamilyGenerator { |
| 43 | +func podMetricFamilies(injectPerSeriesMetadata bool, allowAnnotationsList []string, allowLabelsList []string) []generator.FamilyGenerator { |
| 44 | + mc := &MetricConfig{ |
| 45 | + InjectPerSeriesMetadata: injectPerSeriesMetadata, |
| 46 | + AllowAnnotations: allowAnnotationsList, |
| 47 | + AllowLabels: allowLabelsList, |
| 48 | + } |
44 | 49 | return []generator.FamilyGenerator{ |
45 | 50 | createPodCompletionTimeFamilyGenerator(), |
46 | 51 | createPodContainerInfoFamilyGenerator(), |
@@ -82,7 +87,7 @@ func podMetricFamilies(allowAnnotationsList, allowLabelsList []string) []generat |
82 | 87 | createPodSpecVolumesPersistentVolumeClaimsInfoFamilyGenerator(), |
83 | 88 | createPodSpecVolumesPersistentVolumeClaimsReadonlyFamilyGenerator(), |
84 | 89 | createPodStartTimeFamilyGenerator(), |
85 | | - createPodStatusPhaseFamilyGenerator(), |
| 90 | + createPodStatusPhaseFamilyGenerator(mc), |
86 | 91 | createPodStatusQosClassFamilyGenerator(), |
87 | 92 | createPodStatusReadyFamilyGenerator(), |
88 | 93 | createPodStatusReadyTimeFamilyGenerator(), |
@@ -1333,7 +1338,7 @@ func createPodStartTimeFamilyGenerator() generator.FamilyGenerator { |
1333 | 1338 | ) |
1334 | 1339 | } |
1335 | 1340 |
|
1336 | | -func createPodStatusPhaseFamilyGenerator() generator.FamilyGenerator { |
| 1341 | +func createPodStatusPhaseFamilyGenerator(mc *MetricConfig) generator.FamilyGenerator { |
1337 | 1342 | return *generator.NewFamilyGeneratorWithStability( |
1338 | 1343 | "kube_pod_status_phase", |
1339 | 1344 | "The pods current phase.", |
@@ -1361,13 +1366,12 @@ func createPodStatusPhaseFamilyGenerator() generator.FamilyGenerator { |
1361 | 1366 |
|
1362 | 1367 | ms := make([]*metric.Metric, len(phases)) |
1363 | 1368 |
|
1364 | | - for i, p := range phases { |
1365 | | - ms[i] = &metric.Metric{ |
1366 | | - |
| 1369 | + for i, ph := range phases { |
| 1370 | + ms[i] = injectLabelsAndAnnos(&metric.Metric{ |
1367 | 1371 | LabelKeys: []string{"phase"}, |
1368 | | - LabelValues: []string{p.n}, |
1369 | | - Value: boolFloat64(p.v), |
1370 | | - } |
| 1372 | + LabelValues: []string{ph.n}, |
| 1373 | + Value: boolFloat64(ph.v), |
| 1374 | + }, mc, &p.ObjectMeta) |
1371 | 1375 | } |
1372 | 1376 |
|
1373 | 1377 | return &metric.Family{ |
|
0 commit comments