1
0
mirror of https://github.com/prometheus-community/postgres_exporter.git synced 2025-08-08 04:42:07 +03:00

Update vendored tools/.

This commit is contained in:
Will Rouesnel
2017-08-03 21:19:17 +10:00
parent 1afbd62ab1
commit a7ff84a674
22 changed files with 1452 additions and 1109 deletions

View File

@@ -18,6 +18,13 @@ type (
}
)
func maybeAggregateIssues(issues chan *Issue) chan *Issue {
if !config.Aggregate {
return issues
}
return aggregateIssues(issues)
}
func aggregateIssues(issues chan *Issue) chan *Issue {
out := make(chan *Issue, 1000000)
issueMap := make(map[issueKey]*multiIssue)
@@ -30,18 +37,18 @@ func aggregateIssues(issues chan *Issue) chan *Issue {
message: issue.Message,
}
if existing, ok := issueMap[key]; ok {
existing.linterNames = append(existing.linterNames, issue.Linter.Name)
existing.linterNames = append(existing.linterNames, issue.Linter)
} else {
issueMap[key] = &multiIssue{
Issue: issue,
linterNames: []string{issue.Linter.Name},
linterNames: []string{issue.Linter},
}
}
}
for _, multi := range issueMap {
issue := multi.Issue
sort.Strings(multi.linterNames)
issue.Linter.Name = strings.Join(multi.linterNames, ", ")
issue.Linter = strings.Join(multi.linterNames, ", ")
out <- issue
}
close(out)