sensu / grafana-sensu-go-datasource

A Grafana data source plugin for querying the Sensu Go API
MIT License
22 stars 15 forks source link

Filtering happens after event LIMIT ? #12

Closed johannagnarsson closed 4 years ago

johannagnarsson commented 5 years ago

If this behavior is working as intended then feel free to close this, but I would imagine the LIMIT would apply after any filtering occurs.

In my current sensu-go setup (5.14.1) I have around ~14k events at any given moment according to the web UI.

I have the following filters in place: image

In the Sensu web UI, if I select 'Status:Incident' as the filter, I get 3 events. Screenshot from 2019-10-25 10-04-34

In Grafana If I lower the LIMIT value to below the total number of events, I will get 0 events returned. image

Bring the LIMIT to above the number of events and I get the 3 incidents listed.

Screenshot from 2019-10-25 10-10-45

This possibly has to do with the fact that the checks start with Z and would probably be at the end of that list.

Using sensugo-datasource version 1.0.2 and grafana 6.4.3

# grafana-cli plugins ls
installed plugins:
sensu-sensugo-datasource @ 1.0.2 
# grafana-cli -v
Grafana cli version 6.4.3
blufor commented 5 years ago

I can verify the same behavior with the exact versions

mariusoe commented 4 years ago

Hi,

yes, this behavior is correct. It is like this because the limit defines the number of elements which are fetched by the data source from the Sensu Go backend. The filtering is then applied by the data source itself (in the browser). This has been done because at the time of implementing this feature, it was the only way of achieve such functionallity. This means, the data source have to fetch all data to be able to correctly filter and aggregating data.

Alexc0007 commented 4 years ago

Hi, i have the same issue. any way to get around it? to fetch all data

mariusoe commented 4 years ago

The problem of missing data due to client-side filtering can be solved starting with version 1.1.0 of the data source by using server-side filtering (response filtering). See also #30

Closed by #36