func configMapMetricFamilies()

in internal/store/configmap.go [37:123]


func configMapMetricFamilies(allowAnnotationsList, allowLabelsList []string) []generator.FamilyGenerator {
	return []generator.FamilyGenerator{
		*generator.NewFamilyGenerator(
			"kube_configmap_annotations",
			"Kubernetes annotations converted to Prometheus labels.",
			metric.Gauge,
			"",
			wrapConfigMapFunc(func(c *v1.ConfigMap) *metric.Family {
				annotationKeys, annotationValues := createPrometheusLabelKeysValues("annotation", c.Annotations, allowAnnotationsList)
				return &metric.Family{
					Metrics: []*metric.Metric{
						{
							LabelKeys:   annotationKeys,
							LabelValues: annotationValues,
							Value:       1,
						},
					},
				}
			}),
		),
		*generator.NewFamilyGenerator(
			"kube_configmap_labels",
			"Kubernetes labels converted to Prometheus labels.",
			metric.Gauge,
			"",
			wrapConfigMapFunc(func(c *v1.ConfigMap) *metric.Family {
				labelKeys, labelValues := createPrometheusLabelKeysValues("label", c.Labels, allowLabelsList)
				return &metric.Family{
					Metrics: []*metric.Metric{
						{
							LabelKeys:   labelKeys,
							LabelValues: labelValues,
							Value:       1,
						},
					},
				}
			}),
		),
		*generator.NewFamilyGenerator(
			"kube_configmap_info",
			"Information about configmap.",
			metric.Gauge,
			"",
			wrapConfigMapFunc(func(c *v1.ConfigMap) *metric.Family {
				return &metric.Family{
					Metrics: []*metric.Metric{{
						LabelKeys:   []string{},
						LabelValues: []string{},
						Value:       1,
					}},
				}
			}),
		),
		*generator.NewFamilyGenerator(
			"kube_configmap_created",
			"Unix creation timestamp",
			metric.Gauge,
			"",
			wrapConfigMapFunc(func(c *v1.ConfigMap) *metric.Family {
				ms := []*metric.Metric{}

				if !c.CreationTimestamp.IsZero() {
					ms = append(ms, &metric.Metric{
						LabelKeys:   []string{},
						LabelValues: []string{},
						Value:       float64(c.CreationTimestamp.Unix()),
					})
				}

				return &metric.Family{
					Metrics: ms,
				}
			}),
		),
		*generator.NewFamilyGenerator(
			"kube_configmap_metadata_resource_version",
			"Resource version representing a specific version of the configmap.",
			metric.Gauge,
			"",
			wrapConfigMapFunc(func(c *v1.ConfigMap) *metric.Family {
				return &metric.Family{
					Metrics: resourceVersionMetric(c.ObjectMeta.ResourceVersion),
				}
			}),
		),
	}
}