fasttrackml
fasttrackml copied to clipboard
Prevent extremely long "select" param on search requests
There's currently a problem with the encoded version of the "select" header: It simply refuses to complete the request if the header is too long (and page doesn't load unless manually refreshing or clicking Back). This is the case when selecting too many metrics at a time.
@jescalada I think we have to change method from GET
-> POST
. we already did something similar previously so maybe this is the case.
My only concern is that when users refresh the page or "bookmark" the page (by saving or copy-pasting the link) they will not be able to see the view they had before. Will the regular AIM bookmarks be compatible with POST?
Probably original AIM won't work in that case but Im not sure that we have to take care about that, because we already have some breaking changes. @fabiovincenzi do you remember which endpoint we've changed from GET
-> POST
? As I remember in was in AIM, right?
Yes we switched searchmetrics from GET to POST
@jescalada and can you please explain, where it happened? we have no /metrics
endpoint under aim
. If you can provide me steps where I can check it myself it would be really nice.
In order to reproduce the issue, you need to select lots of metrics (maybe 50-100), then click Search, and finally refresh the page. It also happens if accessing a page directly by copy-pasting the URL.
I see now. Im not sure that selecting 50-100 metrics is a really working case. I mean do we really need to allow to select so many metrics at time? maybe we can just limit user with that? we can allow to select for example up to 30 metrics which should be pretty enough and that's it. @jgiannuzzi what do you think?
Danny mentioned that up to 50 metrics is usual, so I thought it would be good to cover that. Another solution would be to somehow simplify the encoding (on the frontend) so that the resulting encoded query is shorter and doesn't produce errors
yep, it will be really nice. I can that 20-30 metrics can easily use around 20kb. and as I can see all of this parameters are only for UI. this is pretty interesting what exactly is going on under the hood. Im going to unassign myself since there is nothing to fix right now.
Adding a maximum to the metrics SelectForm, with error message on the Nth+1 selection