|
|
@@ -24,21 +24,21 @@ var kubeMetricInit sync.Once
|
|
|
|
|
|
// KubeMetricsOpts represents our Kubernetes metrics emission options.
|
|
|
type KubeMetricsOpts struct {
|
|
|
- EmitKubecostControllerMetrics bool
|
|
|
- EmitNamespaceAnnotations bool
|
|
|
- EmitPodAnnotations bool
|
|
|
- EmitKubeStateMetrics bool
|
|
|
- EmitNodeKubeStateMetrisOnly bool
|
|
|
+ EmitKubecostControllerMetrics bool
|
|
|
+ EmitNamespaceAnnotations bool
|
|
|
+ EmitPodAnnotations bool
|
|
|
+ EmitKubeStateMetrics bool
|
|
|
+ EmitV1NodeKubeStateMetricsOnly bool
|
|
|
}
|
|
|
|
|
|
// DefaultKubeMetricsOpts returns KubeMetricsOpts with default values set
|
|
|
func DefaultKubeMetricsOpts() *KubeMetricsOpts {
|
|
|
return &KubeMetricsOpts{
|
|
|
- EmitKubecostControllerMetrics: true,
|
|
|
- EmitNamespaceAnnotations: false,
|
|
|
- EmitPodAnnotations: false,
|
|
|
- EmitKubeStateMetrics: true,
|
|
|
- EmitNodeKubeStateMetrisOnly: false,
|
|
|
+ EmitKubecostControllerMetrics: true,
|
|
|
+ EmitNamespaceAnnotations: false,
|
|
|
+ EmitPodAnnotations: false,
|
|
|
+ EmitKubeStateMetrics: true,
|
|
|
+ EmitV1NodeKubeStateMetricsOnly: false,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -95,10 +95,16 @@ func InitKubeMetrics(clusterCache clustercache.ClusterCache, opts *KubeMetricsOp
|
|
|
prometheus.MustRegister(KubeJobCollector{
|
|
|
KubeClusterCache: clusterCache,
|
|
|
})
|
|
|
- } else if opts.EmitNodeKubeStateMetrisOnly {
|
|
|
+ } else if opts.EmitV1NodeKubeStateMetricsOnly {
|
|
|
prometheus.MustRegister(KubeNodeCollector{
|
|
|
KubeClusterCache: clusterCache,
|
|
|
})
|
|
|
+ prometheus.MustRegister(KubeNamespaceCollector{
|
|
|
+ KubeClusterCache: clusterCache,
|
|
|
+ })
|
|
|
+ prometheus.MustRegister(KubePodLabelsCollector{
|
|
|
+ KubeClusterCache: clusterCache,
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
}
|