Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix namespace in kubernetes #29

Merged
merged 1 commit into from
Jul 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ func (exporter *NebulaExporter) CollectMetrics(
}
}

func (exporter *NebulaExporter) collect(wg *sync.WaitGroup, clusterName string, instance Instance, ch chan<- prometheus.Metric) {
func (exporter *NebulaExporter) collect(wg *sync.WaitGroup, namespace, clusterName string, instance Instance, ch chan<- prometheus.Metric) {
podIpAddress := instance.EndpointIP
podHttpPort := instance.EndpointPort

Expand All @@ -404,7 +404,7 @@ func (exporter *NebulaExporter) collect(wg *sync.WaitGroup, clusterName string,
klog.Infof("metrics from %s:%d was empty", podIpAddress, podHttpPort)
return
}
exporter.CollectMetrics(instance.Name, instance.ComponentType, DefaultStaticNamespace, clusterName, metrics, ch)
exporter.CollectMetrics(instance.Name, instance.ComponentType, namespace, clusterName, metrics, ch)
}()

wg.Add(1)
Expand All @@ -419,7 +419,7 @@ func (exporter *NebulaExporter) collect(wg *sync.WaitGroup, clusterName string,
klog.Errorf("could not get status metrics from %s:%d", podIpAddress, podHttpPort)
return
}
exporter.CollectMetrics(instance.Name, instance.ComponentType, DefaultStaticNamespace, clusterName, statusMetrics, ch)
exporter.CollectMetrics(instance.Name, instance.ComponentType, namespace, clusterName, statusMetrics, ch)
}()
}

Expand All @@ -429,7 +429,7 @@ func (exporter *NebulaExporter) CollectFromStaticConfig(ch chan<- prometheus.Met
cluster := cluster
for _, instance := range cluster.Instances {
instance := instance
exporter.collect(&wg, cluster.Name, instance, ch)
exporter.collect(&wg, DefaultStaticNamespace, cluster.Name, instance, ch)
}
}

Expand Down Expand Up @@ -473,7 +473,7 @@ func (exporter *NebulaExporter) CollectFromKubernetes(ch chan<- prometheus.Metri
continue
}

exporter.collect(&wg, clusterName, Instance{
exporter.collect(&wg, pod.Namespace, clusterName, Instance{
Name: pod.Name,
EndpointIP: podIpAddress,
EndpointPort: podHttpPort,
Expand Down