-
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] Rename operations to map exposed names for Formula #94710
Conversation
Pinging @elastic/kibana-app (Team:KibanaApp) |
@elasticmachine merge upstream |
Tested ML related changes and LGTM 👍 |
@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.
@@ -76,7 +76,6 @@ function buildMetricOperation<T extends MetricColumn<string>>({ | |||
}, |
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.
There is a problem in this line: https://github.com/elastic/kibana/pull/94710/files#diff-e3c30f7e1cc23b9be6b4b2d689290e96925f48369dfcaa44d641014dfdc7bc80R68
The aggregation restriction mapping logic in
id: indexPattern.id!, // id exists for sure because we got index patterns by id |
avg
vs average
). Aggregation restrictions for the average operation won't be loaded correctly anymore. We have to check aggregation restrictions for avg
instead of average
.
@@ -219,7 +219,7 @@ export const createMockedRestrictedIndexPattern = () => { | |||
interval: 1000, | |||
}, | |||
}, | |||
avg: { | |||
average: { |
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 won't happen - typeMeta
is not controlled by Lens and will return avg
}; | ||
|
||
export const derivativeOperation: OperationDefinition< | ||
DerivativeIndexPatternColumn, | ||
'fullReference' | ||
> = { | ||
type: 'derivative', | ||
type: 'differences', |
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.
If you create a constant for the name, why not use it here as well?
@elasticmachine merge upstream |
merge conflict between base and head |
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 works fine. I built a visualization using differences, unique count and average in 7.12 and imported it - still works fine.
Just left one small nit that should be addressed
export const renameOperationsMapping: Record<string, GenericOperationDefinition['type']> = { | ||
avg: 'average', | ||
cardinality: 'unique_count', | ||
derivative: 'differences', |
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.
Our derivative/differences implementation is not based on the Elasticsearch aggregation, it shouldn't show up here.
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 thought about it, but wanted to create a generic function for the renaming. Do you think this may lead to issues?
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'm more concerned about this being confusing - Elasticsearch derivative and Lens differences do not share anything, so it doesn't make sense to map one to the other.
I checked it as well and it worked for me. Might be just a bad cache on my side when I made the comment. |
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
) Co-authored-by: Kibana Machine <[email protected]>
…95500) Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Marco Liberati <[email protected]>
Summary
This PR renames the
avg
,cardinality
andderivatives
operation internally to respectively:average
,unique_count
,differences
.This change will help the user in the upcoming Formula PR to quickly reference functions based on the similarity of new names with the ones shown in the panel.
Changes:
Checklist