fix: make slice cap of right size (#17192)

This commit is contained in:
jiuker
2023-05-16 23:10:07 +08:00
committed by GitHub
parent fd2959fa3a
commit 9a799065b3

View File

@@ -2380,7 +2380,7 @@ func getWebhookMetrics() *MetricsGroup {
}
mg.RegisterRead(func(ctx context.Context) []Metric {
tgts := append(logger.SystemTargets(), logger.AuditTargets()...)
metrics := make([]Metric, 0, len(tgts))
metrics := make([]Metric, 0, len(tgts)*4)
for _, t := range tgts {
isOnline := 0
if t.IsOnline(ctx) {