-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] Supports percentile_ranks aggregation #132430
Conversation
@@ -87,7 +87,7 @@ describe('triggerTSVBtoLensConfiguration', () => { | |||
...model.series[0], | |||
metrics: [ | |||
{ | |||
type: 'percentile_rank', | |||
type: 'std_deviation', |
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 test is testing the scenario that a metric agg is not supported in Lens. As we support now the percentile_rank
I changed it to std_deviation
that is not supported
undefined, | ||
timeShift | ||
); | ||
} |
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 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.
Looks good to me!
); | ||
} | ||
|
||
const DEFAULT_PERCENTILE_RANKS_VALUE = 0; |
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 am defaulting this to 0 as done in TSVB and Agg based.
Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors) |
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.
Added some comments
data-test-subj="lns-indexPattern-percentile_ranks-input" | ||
compressed | ||
value={inputValue ?? ''} | ||
onChange={handleInputChange} |
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 has the same issue as percentiles in that it's not possible to order terms by a decimal point percentile value: elastic/elasticsearch#66677
The query fails if you try to do it on this PR. We can either limit it in the same way (enforce integers) or we can drop out of the terms sorting and fall back to alphabetical. What do you think @stratoula @ghudgins ? I'm not sure tbh - integers make more sense for percentile because the value range is strictly 0-100 which is not the case for percentile rank (it can have any data range so you wouldn't be able to use it for fields which have a domain of 0-1
which would be really annoying).
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.
Awww nice catch. I was always using integer values and never caught it. Hmmm, I don't know either but I feel that as a user I would prefer adding whatever value I want and not be limited only to integers
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.
Yeah, we probably should fall back to alphabetical sorting (which is weird too, no easy win 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.
Check this comment #132430 (comment)
x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile_ranks.tsx
Outdated
Show resolved
Hide resolved
undefined, | ||
timeShift | ||
); | ||
} |
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.
Looks good to me!
@flash1293 about the sorting problem I did the following, tell me what you think about it:
I thought that with this implementation, only the users with the non-integer values will have this limitation. Wdyt? Otherwise I can disable the column order for all the percentile ranks. |
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.
LGMT, one minor nit. Great work!
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.
Changes look good to me! Also tested locally. Great work @stratoula ! I left a couple of nits.
src/plugins/data/common/search/aggs/metrics/single_percentile_rank.test.ts
Outdated
Show resolved
Hide resolved
export const aggSinglePercentileRank = (): FunctionDefinition => ({ | ||
name: aggSinglePercentileRankFnName, | ||
help: i18n.translate('data.search.aggs.function.metrics.singlePercentileRank.help', { | ||
defaultMessage: 'Generates a serialized agg config for a single percentile rank agg', |
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.
nit casing consistency with other agg fns:
defaultMessage: 'Generates a serialized agg config for a single percentile rank agg', | |
defaultMessage: 'Generates a serialized agg config for a Single Percentile Rank agg', |
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 am happy to do this change @jloleysens but the single percentile follows this format https://github.com/elastic/kibana/blob/main/src/plugins/data/common/search/aggs/metrics/single_percentile_fn.ts#L28 so I think that the single percentile rank should also follow the same format. Also I think that we follow our text guildelines with this format.
💚 Build SucceededMetrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
Summary
Closes #93938
Closes #45919
Adds support for percentile ranks aggregation in Lens and enables the TSVB to Lens navigation.
Formula usage
Formula documentation
I took some pieces from the ES documentation as I find it quite explanatory and easy to understand. I am open to feedback!
Checklist
Delete any items that are not applicable to this PR.