From 700e0cbc55d9faa3dae4df478ca673175b4521b4 Mon Sep 17 00:00:00 2001 From: Fae Charlton Date: Thu, 14 Aug 2025 13:28:23 -0400 Subject: [PATCH] Remove last remaining NewRegistry method call --- internal/beater/beater.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/beater/beater.go b/internal/beater/beater.go index 77d04e3e735..32abb0e135e 100644 --- a/internal/beater/beater.go +++ b/internal/beater/beater.go @@ -965,9 +965,12 @@ func queryClusterUUID(ctx context.Context, esClient *elasticsearch.Client, state // Running under elastic-agent, the callback linked above is not // registered until later, meaning we need to check and instantiate the // registries if they don't exist. - elasticsearchRegistry := stateRegistry.GetRegistry(outputES) + elasticsearchRegistry := stateRegistry.GetOrCreateRegistry(outputES) if elasticsearchRegistry == nil { - elasticsearchRegistry = stateRegistry.NewRegistry(outputES) + // This can only happen if "outputs.elasticsearch" was already created as + // a non-registry (scalar) value, but in that unlikely chance, let's still + // report a comprehensible error. + return fmt.Errorf("couldn't create registry: %v", outputES) } var (