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

Change histogram:maxBars default setting from 100 to 1000 #143081

Merged
merged 7 commits into from
Oct 13, 2022

Conversation

flash1293
Copy link
Contributor

This PR changes the histogram:maxBars setting from 100 to 1000. This allows the user to configure higher resolution date histogram aggregations without changing advanced settings.

Background

Date histograms are ubiquitous in Kibana. However, for every date histogram the essential question of the used interval needs to be answered. For most chart types (Lens, agg based) there are two modes:

"Auto" (default) - Divide the duration of the time range (configured in the top right) by histogram:barTarget (defaults to 50), with some wiggle room to get a "nice" interval (like 30 seconds, 5 minutes, 6 hours, ...)
"Min interval" (has to be explicitly configured) - If the duration of the time range divided by the chosen interval is smaller than histogram:maxBars (defaults to 100), use it directly. Otherwise, increase the interval until the condition is satisfied - wiggle room for making the interval "nice" still included
In practice this causes the following behavior:

By default, date histograms have ~50 data points, no matter the configured time range
If the user picks a specific interval, they might not get it if it would result in more than ~100 data points
The behavior of "Min interval" was chosen for two reasons:

Protect the cluster - trying to fetch data with too high of a resolution can cause a lot of load on Elasticsearch, the Kibana server and also the users browser (rendering many thousands of data points can cause the browser tab to freeze and make interactions very slow)
Try to show a meaningful chart - if the interval is too small with respect to the current time range, it can't be interpreted in a meaningful way. For example: Rendering one data point per minute makes sense for the last 2 hours, but applied to the last 90 days it would result in 130k data points. As the chart width on the screen won't exceed 2000 in almost all cases even on large screens, there would be 65 data points within a single pixel which can't be represented in a meaningful way. Lowering the resolution is helpful in this situation.
Having a histogram:maxBars setting definitely makes sense to prevent the mentioned issues, but a default limit of 100 is very low for time series analysis.

Impact

Within these Kibana spaces, all "agg based" and Lens visualizations using the date histogram aggregation in any visualization are affected if they have configured a "min interval" (instead of leaving it to auto) and they are attempting to render the visualization on data that would exceed 100 buckets.

For example:
A Lens doc count histogram set to minute buckets rendered over the last 30 days.

Before (3h interval)
Screenshot 2022-09-09 at 17 08 56

After (30m interval)
Screenshot 2022-09-09 at 17 09 21

Number histogram

Within these Kibana spaces, all "agg based" and Lens visualizations using the histogram aggregation in any visualization are affected even if they have an "auto" interval configured. In Lens, number histograms don't allow the specification of an interval, instead a "granularity slider" is provided which is scaled by the histogram:maxBars setting.

Before
Screenshot 2022-09-09 at 17 10 33

After
Screenshot 2022-09-09 at 17 10 13

Mitigation

If the impact described above is not a good fit for your use case, you can restore the old behavior by explicitly setting histogram:maxBars to 100 in the advanced settings menu (this needs to be done for every space).

@flash1293 flash1293 added release_note:breaking Team:Visualizations Visualization editors, elastic-charts and infrastructure Team:AppServicesSv backport:skip This commit does not require backporting labels Oct 11, 2022
@flash1293 flash1293 changed the title Change histogram:maxBars default setting Change histogram:maxBars default setting from 100 to 1000 Oct 11, 2022
@flash1293 flash1293 marked this pull request as ready for review October 12, 2022 12:58
@flash1293 flash1293 requested review from a team as code owners October 12, 2022 12:58
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors)

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServicesSv)

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

I am really in favor of this change! I tested it in Lens and agg based and looks great. The users can always change it again if it doesn't match their expectations. LGTM :)

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:breaking Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants