fasttrackml icon indicating copy to clipboard operation
fasttrackml copied to clipboard

Prevent extremely long "select" param on search requests

Open jescalada opened this issue 10 months ago • 10 comments

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.

Image

jescalada avatar Apr 24 '24 17:04 jescalada

@jescalada I think we have to change method from GET -> POST. we already did something similar previously so maybe this is the case.

dsuhinin avatar Apr 30 '24 15:04 dsuhinin

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?

jescalada avatar Apr 30 '24 15:04 jescalada

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?

dsuhinin avatar Apr 30 '24 15:04 dsuhinin

Yes we switched searchmetrics from GET to POST

fabiovincenzi avatar Apr 30 '24 15:04 fabiovincenzi

@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.

dsuhinin avatar Apr 30 '24 15:04 dsuhinin

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.

jescalada avatar Apr 30 '24 15:04 jescalada

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?

dsuhinin avatar Apr 30 '24 16:04 dsuhinin

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

jescalada avatar Apr 30 '24 16:04 jescalada

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.

dsuhinin avatar Apr 30 '24 18:04 dsuhinin

Adding a maximum to the metrics SelectForm, with error message on the Nth+1 selection

suprjinx avatar May 08 '24 15:05 suprjinx