Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Pagination on /events endpoint does not work #1071

Open
tnolet opened this issue Nov 20, 2017 · 5 comments
Open

Pagination on /events endpoint does not work #1071

tnolet opened this issue Nov 20, 2017 · 5 comments
Labels

Comments

@tnolet
Copy link
Contributor

tnolet commented Nov 20, 2017

It is impossible to get more than 30 items from the /events endpoint due to pagination not working as described in https://vamp.io/documentation/api/v0.9.5/using-the-api/#pagination.
The per_page and page parameters seem to be completely ignored.

Easy to reproduce with the following bash command or just by counting items.

http GET "localhost/service/vamp/api/v1/events?per_page=40" | jq '.[].id' | wc -l
      30

Using Vamp 0.9.5 on DC/OS but this is most probably unrelated to orchestrator.

@tnolet tnolet added the bug label Nov 20, 2017
@dragoslav
Copy link
Contributor

Can't reproduce it:

$ http GET "http://localhost:8080/api/v1/events?per_page=2&page=1" | jq '.[].id'
"41574765743355396c78326132764f514a496e73"
"41574765743355356c78326132764f514a496e72"
$ http GET "http://localhost:8080/api/v1/events?per_page=2&page=2" | jq '.[].id'
"41574765743355426c78326132764f514a496e71"
"41574765743236626c78326132764f514a496e70"
$ http GET "http://localhost:8080/api/v1/events?per_page=2&page=3" | jq '.[].id'
"41574765743257316c78326132764f514a496e6f"
"41574765743249516c78326132764f514a496e6e"
$ http GET "http://localhost:8080/api/v1/events?page=3&per_page=2" | jq '.[].id'
"41574765743257316c78326132764f514a496e6f"
"41574765743249516c78326132764f514a496e6e"
$ http GET "http://localhost:8080/api/v1/events?per_page=2" | jq '.[].id'
"41574765743355396c78326132764f514a496e73"
"41574765743355356c78326132764f514a496e72"

@dragoslav
Copy link
Contributor

Ok, what I can find is that max number of events is 30 (e.g. if you use ?per_page=40) - this is just a hard-coded limit. Still you should be able to use page parameter.

@tnolet
Copy link
Contributor Author

tnolet commented Feb 16, 2018

@dragoslav Yeah, so we should fix the per_page parameter to behave as expected

@dragoslav
Copy link
Contributor

@tnolet you mean without hard limit? Reason for this is that Vamp sends request to Elasticsearch or whatever handles the events. Let's say you want last 100000 events, you could do that by sending many requests (page=...) or single per_page=100000 if there is no limit. In this case either Vamp asks for 100000 (if that is supported by 3rd party, e.g. https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-from-size.html) or handles for you multiple requests in the background. Then you could also you could add some conditions to request (per type, date etc.). All of this complicates Vamp implementation instead to be (as it is now) just simple 1 on 1 request to 3rd party. Of course hard limit of 30 could be changed (even configurable) but there should be an upper limit.

@olafmol
Copy link
Member

olafmol commented Mar 8, 2018

@tnolet could you describe how you would expect it to behave? tnx!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants