From 9ec2a1bb6b37142809a75630ea7a3219a207a9ef Mon Sep 17 00:00:00 2001 From: Tanna McClure Date: Thu, 18 Jan 2024 17:02:32 -0800 Subject: [PATCH] use each with object instead --- lib/new_relic/agent/custom_event_aggregator.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/new_relic/agent/custom_event_aggregator.rb b/lib/new_relic/agent/custom_event_aggregator.rb index 414665b759..8b5af14a18 100644 --- a/lib/new_relic/agent/custom_event_aggregator.rb +++ b/lib/new_relic/agent/custom_event_aggregator.rb @@ -64,7 +64,7 @@ def create_custom_event_attributes(attributes) result = result.first(MAX_ATTRIBUTE_COUNT) end - result.map do |key, val| + result.each_with_object({}) do |(key, val), new_result| # name is limited to 255 if key.is_a?(String) && key.bytesize > MAX_NAME_SIZE key = key.byteslice(0, MAX_NAME_SIZE) @@ -75,8 +75,8 @@ def create_custom_event_attributes(attributes) val = val.byteslice(0, MAX_ATTRIBUTE_SIZE) end - [key, val] - end.to_h + new_result[key] = val + end end def after_initialize