Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase the limit of users returned #46

Merged
merged 3 commits into from
Nov 3, 2019
Merged

Increase the limit of users returned #46

merged 3 commits into from
Nov 3, 2019

Conversation

tdabasinskas
Copy link
Contributor

As per documentation, /api/users returns only the first 1000 users. This means, that for Grafana instances that have more than 1000 users, this SDK function does not return all users.

One option could be introducing a parameter, for GetAllUsers(), but that would be a breaking change for all existing users. As an alternative, I suggest setting the limit to a very high number (99999, in this case). This would avoid a breaking change and would make GetAllUsers() to work as expected (since the name implies it returns ALL users).

As per documentation, `/api/users` returns only the first 1000 users. This means, that for Grafana instances that have more than 1000 users, this SDK function does not return all users.

One option could be introducing a parameter, for `GetAllUsers()`, but that would be a breaking change for all existing users. As an alternative, I suggest setting the limit to a very high number (`99999`, in this case). This would avoid a breaking change and would make `GetAllUsers()` to work as expected (since the name implies it returns ALL users).
@coveralls
Copy link

coveralls commented Oct 28, 2019

Coverage Status

Coverage decreased (-0.07%) to 21.766% when pulling dbf39ab on tdabasinskas:patch-4 into 511d76a on grafana-tools:master.

Seems there were some formatting issues
@grafov
Copy link
Member

grafov commented Nov 3, 2019

Did you test it with the value set to 99999? Well for the current case with GetAllUsers I agree it would be ok to nail it with 99999. But I think the SDK API needs some cleanup. There is SearchUsersWithPaging that accepts query, page and perpage as pointers. Now I think it was not so good idea. And both the functions could be renamed to more consistency to GetAllUsers and GetUsers.

See #47 for another proposed solution.

@tdabasinskas
Copy link
Contributor Author

Hi,

Thanks for looking into it.

I did test it out with 99999 and it works OK (by OK, I mean it didn't fail and successfully returned all ~1500 users we had in Grafana).

I agree with the proposed cleanup. Yet, if we could still merge this change (just to have current GetAllUsers()) for now and do the cleanup as a separate PR in the future, it would be great.

@grafov
Copy link
Member

grafov commented Nov 3, 2019

Sure, let move step by step.

@grafov grafov merged commit 4e34693 into grafana-tools:master Nov 3, 2019
@grafov
Copy link
Member

grafov commented Nov 3, 2019

Merged, thank you @tdabasinskas.

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

Successfully merging this pull request may close these issues.

3 participants