From 3394d44374909d8ed6d6304b60f71d4678657f42 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Mon, 11 Nov 2024 15:26:59 -0800 Subject: [PATCH] [chore] initialize slice with enough capacity based on log records (#36155) --- extension/encoding/jsonlogencodingextension/extension.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/encoding/jsonlogencodingextension/extension.go b/extension/encoding/jsonlogencodingextension/extension.go index d272c5873d0c..266c6d91aa60 100644 --- a/extension/encoding/jsonlogencodingextension/extension.go +++ b/extension/encoding/jsonlogencodingextension/extension.go @@ -73,7 +73,7 @@ func (e *jsonLogExtension) Shutdown(_ context.Context) error { } func (e *jsonLogExtension) logProcessor(ld plog.Logs) ([]byte, error) { - logs := make([]logBody, ld.ResourceLogs().Len()-1) + logs := make([]logBody, 0, ld.LogRecordCount()) rls := ld.ResourceLogs() for i := 0; i < rls.Len(); i++ {