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

Alerting: Add limit query parameter to Loki-based ASH api, drop default limit from 5000 to 1000, extend visible time range for new ASH UI #70769

Merged
merged 5 commits into from Jun 28, 2023

Conversation

alexweav
Copy link
Contributor

What is this feature?

Allows clients to configure the record limit when querying loki. You can now supply a limit query parameter, with a value between 0 and 5000, to control the size of the returned page. Limits are hard-capped at 5000.

The default limit, when the query parameter is not present, has been dropped from 5000 to 1000.

Which issue(s) does this PR fix?:

n/a

Special notes for your reviewer:

Please check that:

  • It works as expected from a user's perspective.
  • If this is a pre-GA feature, it is behind a feature toggle.
  • The docs are updated, and if this is a notable improvement, it's added to our What's New doc.

@grafana-delivery-bot
Copy link
Contributor

Hello @alexweav!
Backport pull requests need to be either:

  • Pull requests which address bugs,
  • Urgent fixes which need product approval, in order to get merged,
  • Docs changes.

Please, if the current pull request addresses a bug fix, label it with the type/bug label.
If it already has the product approval, please add the product-approved label. For docs changes, please add the type/docs label.
If the pull request modifies CI behaviour, please add the type/ci label.
If none of the above applies, please consider removing the backport label and target the next major/minor release.
Thanks!

@armandgrillet armandgrillet added the product-approved Pull requests that are approved by product/managers and are allowed to be backported label Jun 27, 2023
Copy link
Member

@JacobsonMT JacobsonMT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

One NIT to remove commented out code.

pkg/services/ngalert/state/historian/loki_http_test.go Outdated Show resolved Hide resolved
@konrad147 konrad147 requested a review from a team as a code owner June 28, 2023 09:45
getRuleHistory: build.query<DataFrameJSON, { ruleUid: string; from: number; to?: number }>({
query: ({ ruleUid, from, to = getUnixTime(new Date()) }) => ({
getRuleHistory: build.query<DataFrameJSON, { ruleUid: string; from?: number; to?: number; limit?: number }>({
query: ({ ruleUid, from, to, limit = 100 }) => ({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 100 and not 250?

Copy link
Member

@soniaAguilarPeiron soniaAguilarPeiron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FE code LGTM! 🚀

Copy link
Member

@JacobsonMT JacobsonMT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexweav alexweav changed the title Alerting: Add limit query parameter to Loki-based ASH api, drop default limit from 5000 to 1000 Alerting: Add limit query parameter to Loki-based ASH api, drop default limit from 5000 to 1000, extend visible time range for new ASH UI Jun 28, 2023
@alexweav alexweav merged commit f94fb76 into main Jun 28, 2023
17 checks passed
@alexweav alexweav deleted the alexweav/ash-limit-query-param branch June 28, 2023 18:32
grafana-delivery-bot bot pushed a commit that referenced this pull request Jun 28, 2023
…lt limit from 5000 to 1000, extend visible time range for new ASH UI (#70769)

* Add limit query parameter

* Drop copy paste comment

* Extend history query limit to 30 days and 250 entries

* Fix history log entries ordering

* Update no history message, add empty history test

---------

Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
(cherry picked from commit f94fb76)
alexweav added a commit that referenced this pull request Jun 28, 2023
…drop default limit from 5000 to 1000, extend visible time range for new ASH UI (#70857)

Alerting: Add limit query parameter to Loki-based ASH api, drop default limit from 5000 to 1000, extend visible time range for new ASH UI (#70769)

* Add limit query parameter

* Drop copy paste comment

* Extend history query limit to 30 days and 250 entries

* Fix history log entries ordering

* Update no history message, add empty history test

---------

Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
(cherry picked from commit f94fb76)

Co-authored-by: Alexander Weaver <weaver.alex.d@gmail.com>
harisrozajac pushed a commit that referenced this pull request Jun 29, 2023
…lt limit from 5000 to 1000, extend visible time range for new ASH UI (#70769)

* Add limit query parameter

* Drop copy paste comment

* Extend history query limit to 30 days and 250 entries

* Fix history log entries ordering

* Update no history message, add empty history test

---------

Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
@zerok zerok modified the milestones: 10.0.x, 10.0.2, 10.1.x Jun 30, 2023
harisrozajac pushed a commit that referenced this pull request Jun 30, 2023
…lt limit from 5000 to 1000, extend visible time range for new ASH UI (#70769)

* Add limit query parameter

* Drop copy paste comment

* Extend history query limit to 30 days and 250 entries

* Fix history log entries ordering

* Update no history message, add empty history test

---------

Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
@ricky-undeadcoders ricky-undeadcoders modified the milestones: 10.1.x, 10.1.0 Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add to changelog area/alerting Grafana Alerting area/backend area/frontend backport v10.0.x kata:state-history product-approved Pull requests that are approved by product/managers and are allowed to be backported
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

8 participants