diff --git a/api/lib/opentelemetry/trace/tracestate.rb b/api/lib/opentelemetry/trace/tracestate.rb index c4718d4de7..d5869a8f7b 100644 --- a/api/lib/opentelemetry/trace/tracestate.rb +++ b/api/lib/opentelemetry/trace/tracestate.rb @@ -75,8 +75,8 @@ def create(hash) # @return [Tracestate] def initialize(hash) excess = hash.size - MAX_MEMBER_COUNT - hash = Hash[hash.drop(excess)] if excess.positive? - @hash = hash.freeze + @hash = excess.positive? ? Hash[hash.first(MAX_MEMBER_COUNT)] : hash + @hash.freeze end # Returns the value associated with the given key, or nil if the key