Skip to content

Commit

Permalink
Remove two of todos in code: test and one obsolete one
Browse files Browse the repository at this point in the history
  • Loading branch information
kuskoman committed Dec 26, 2023
1 parent 77fb977 commit 0f3d5b0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion collectors/collector_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func NewCollectorManager(servers []*config.LogstashServer) *CollectorManager {
func getCollectors(clients []logstashclient.Client) map[string]Collector {
collectors := make(map[string]Collector)
collectors["nodeinfo"] = nodeinfo.NewNodeinfoCollector(clients)
collectors["nodestats"] = nodestats.NewNodestatsCollector(clients) // TODO: support multiple clients
collectors["nodestats"] = nodestats.NewNodestatsCollector(clients)
return collectors
}

Expand Down
14 changes: 12 additions & 2 deletions collectors/nodestats/nodestats_collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,18 @@ func TestCollectNotNil(t *testing.T) {
t.Errorf("failed to extract fqName from metric %s", foundMetricDesc)
}

// todo: check if exists
foundMetrics = append(foundMetrics, foundMetricFqName)
// todo: optimize this
found := false
for _, foundMetric := range foundMetrics {
if foundMetric == foundMetricFqName {
found = true
break
}
}

if !found {
foundMetrics = append(foundMetrics, foundMetricFqName)
}
}

for _, expectedMetric := range expectedBaseMetrics {
Expand Down

0 comments on commit 0f3d5b0

Please sign in to comment.