From b8864fc8e95ba9f19b5c50c9540aa5c5286c1eee Mon Sep 17 00:00:00 2001 From: fallwith Date: Thu, 10 Aug 2023 20:44:53 -0700 Subject: [PATCH] LogEventAttributes: instance var check Don't attempt to read `@custom_attribute_limit_reached` until it has been defined Addresses the following Ruby warning: ```shell /Users/jbond007/git/public/newrelic-ruby-agent/lib/new_relic/agent/log_event_attributes.rb:17: warning: instance variable @custom_attribute_limit_reached not initialized ``` --- lib/new_relic/agent/log_event_attributes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/new_relic/agent/log_event_attributes.rb b/lib/new_relic/agent/log_event_attributes.rb index d3bc33b331..a38d1f1fd3 100644 --- a/lib/new_relic/agent/log_event_attributes.rb +++ b/lib/new_relic/agent/log_event_attributes.rb @@ -10,7 +10,7 @@ class LogEventAttributes ATTRIBUTE_VALUE_CHARACTER_LIMIT = 4094 def add_custom_attributes(attributes) - return if @custom_attribute_limit_reached + return if defined?(@custom_attribute_limit_reached) && @custom_attribute_limit_reached attributes.each do |key, value| next if absent?(key) || absent?(value)