-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Lens] Remove Over time suggestions for numeric intervals #78442
[Lens] Remove Over time suggestions for numeric intervals #78442
Conversation
@dej611 I'm interested in coming up with a solution that doesn't involve the XY chart at all. Could you take a look at the logic in |
…rvals-suggestions
…rvals-suggestions
Reworked the logic to tune the data table at |
@elasticmachine merge upstream |
@dej611 This is looking closer, but it seems like this is still generating suggestions to insert the time field in cases where inserting the time field is not helpful. What do you think about my previous comment:
|
…rvals-suggestions
Talked offline, not sure to find a consensus on what it should show in this scenario. |
…1/kibana into feature/lens/intervals-suggestions
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this out locally and it did what I expected, but also seems to do other unrelated things. Can you clarify the parts that are directly related here?
@@ -455,6 +455,10 @@ export function getDatasourceSuggestionsFromCurrentState( | |||
({ name }) => name === indexPattern.timeFieldName | |||
); | |||
|
|||
const hasNumericDimension = | |||
buckets.length === 1 && | |||
buckets.some((columnId) => layer.columns[columnId].dataType === 'number'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of looking for numeric operations, which can include the number range aggregation too, could you filter for any existing column.scale === 'interval'
? This should allow the timestamp to be added when it's a "Custom ranges" option, which is currently not added.
@@ -1381,6 +1381,51 @@ describe('IndexPattern Data Source suggestions', () => { | |||
); | |||
}); | |||
|
|||
it('does not create an over time suggestion if tables with numeric buckets with time dimension', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a test when the aggregation is the "Custom ranges" mode?
@@ -665,7 +677,7 @@ function createSuggestionWithDefaultDateHistogram( | |||
label: i18n.translate('xpack.lens.indexpattern.suggestions.overTimeLabel', { | |||
defaultMessage: 'Over time', | |||
}), | |||
changeType: 'extended', | |||
changeType: shouldSwitchTimeWithBuckets ? 'reorder' : 'extended', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This suggestion should always be extended because it should always add a new column. Calling it a reorder will affect how the XY charts use the suggestion, which I don't think is intentional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. All the code in this function needs to be removed as it was shaped to make it work the initial way.
@@ -117,8 +117,6 @@ function flipSeriesType(seriesType: SeriesType) { | |||
return 'bar_stacked'; | |||
case 'bar': | |||
return 'bar_horizontal'; | |||
case 'bar_horizontal_stacked': | |||
return 'bar_stacked'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look right to me, why was this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a duplicate. At line 116 there's exactly the same case.
columnOrder: shouldSwitchTimeWithBuckets | ||
? // in this case the order is very important to assign the split accessor! | ||
[newId, ...buckets, ...metrics] | ||
: [...buckets, newId, ...metrics], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary? If so, can you please write a test for it?
…1/kibana into feature/lens/intervals-suggestions
@elasticmachine merge upstream |
Pinging @elastic/kibana-app (Team:KibanaApp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and LGTM!
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]async chunks size
History
To update your PR or re-run it, just comment with: |
) (#81118) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…) (#81117) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Summary
Current state
After some discussion there wasn't a clear consensus on the value of having a
Over time
suggestion for numeric histograms type of charts.Therefore the current state is to detect this scenario and avoid to push a
Over time
suggestion for it.Previous state
The aim of this PR is to improve the suggestion system for histograms not date-based, providing better
Over time
suggestions.This is the continuation of #76121 .
The current state of suggestions for the
Over time
option is to add a newinterval
date dimension to the break down section of the panel, keeping other dimensions on their place.This PR makes a distinction between
interval
type operations, making the suggestion system aware of the data type, pushing for a swap of thex
andsplitBy
dimensions to propose adate histogram
based chart:This is a first attempt with it: so far I couldn't find another route than the
dataType
to detect the different type ofinterval
s.Checklist