chore: preallocate slices where we have a good idea of requirements (#91596)

* chore: preallocate slices where we have a good idea of requirements

* pr feedback
This commit is contained in:
Kristin Laemmert
2024-08-07 08:34:52 -04:00
committed by GitHub
parent 9b652612bd
commit a117b090cf
4 changed files with 6 additions and 6 deletions

View File

@@ -540,7 +540,7 @@ func postPath(pre string, v config.AlertmanagerAPIVersion) string {
// AlertmanagerFromGroup extracts a list of alertmanagers from a target group
// and an associated AlertmanagerConfig.
func AlertmanagerFromGroup(tg *targetgroup.Group, cfg *config.AlertmanagerConfig) ([]alertmanager, []alertmanager, error) {
var res []alertmanager
res := make([]alertmanager, 0, len(tg.Targets))
var droppedAlertManagers []alertmanager
for _, tlset := range tg.Targets {