chronograf icon indicating copy to clipboard operation
chronograf copied to clipboard

UI only shows 100 alert rules even though there are more

Open druchoo opened this issue 9 years ago • 8 comments

  • Full details of your operating system (or distribution): CentOS Linux release 7.2.1511 (Core)
  • The version of Chronograf you are running: chronograf-1.3.3.4-1.x86_64
  • Whether you installed it using a pre-built package, or built it from source: package
  • A small test case, if applicable, that demonstrates the issues: Create more than 100 tasks in Kapacitor
  • A screenshot, when appropriate, to demonstrate any issues that are related to the UI:
$ kapacitor stats general
ClusterID:                    ***
ServerID:                     ***
Host:                         ***
Tasks:                        162
Enabled Tasks:                162
Subscriptions:                13
Version:                      1.3.1
screenshot at jul 04 15-30-42

druchoo avatar Jul 04 '17 19:07 druchoo

This should function similar to the alerts table on status.

nhaugo avatar Jul 10 '17 23:07 nhaugo

@nhaugo there is currently no limit placed on the GET to rules from the frontend. Perhaps the limit in on the server?

121watts avatar Jul 27 '17 21:07 121watts

@121watts, Just a guess, but it looks like kapacitor's default limit of 100 is used when one is not specified. This is assuming Chronograf is using the same API call..

$ kapacitor stats general
ClusterID:                    ***
ServerID:                     ***
Host:                         ***
Tasks:                        328
Enabled Tasks:                328
Subscriptions:                16
Version:                      1.3.1

$ curl http://localhost:9092/kapacitor/v1/tasks -s | grep -c created
100

$ curl http://localhost:9092/kapacitor/v1/tasks?limit=101 -s | grep -c created
101

$ curl http://localhost:9092/kapacitor/v1/tasks?limit=500 -s | grep -c created
328

druchoo avatar Jul 27 '17 22:07 druchoo

I did some research into this one...

This will need some Chronograf backend work. At first I was hoping to just modify the backend to send 0 as the limit, but this code prevents that trick:

https://github.com/influxdata/kapacitor/blob/a31abae7f2cd4bf056ae7ccccfb81daab93e513b/client/v1/client.go#L884

We could probably just implement pagination somewhere. It could paginate on the backend and return a full response so the frontend does not need to be modified. I am not aware of anywhere in the application that implements a real pagination flow, so that might prove to be more difficult, in that we don't have any frontend components or patterns of that sort to run with currently.

I am also wondering if pagination of any sort is required to satisfy this story. 100 is a little low, but perhaps 1000 or 10000 rules could be enough?

cryptoquick avatar Aug 02 '17 11:08 cryptoquick

@cryptoquick, Would it make sense to do something like getting the total amount of ticks on page load to use as your limit? You would of course be able to use that number to correctly display the amount of "Alert Rules" as well. What do you think?

druchoo avatar Aug 02 '17 12:08 druchoo

@goller thoughts? I don't think the chronograf server exposes a limit option for rules

121watts avatar Aug 02 '17 23:08 121watts

@121watts @druchoo you are absolutely correct. We'll need to expose the limit/offset through the rules api

goller avatar Aug 02 '17 23:08 goller

Loop through next until you reach the end of kapacitor tasks and put them all in the list

nhaugo avatar Aug 08 '17 17:08 nhaugo