-
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
[Expressions] Introduce createTable expression function, and use in Lens #103788
Conversation
Pinging @elastic/kibana-app-services (Team:AppServices) |
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.
Code review for now. Just minor nitpick.
@@ -55,8 +55,8 @@ export const formulaOperation: OperationDefinition< | |||
|
|||
const visibleOperationsMap = filterByVisibleOperation(operationDefinitionMap); | |||
const { root, error } = tryToParse(column.params.formula, visibleOperationsMap); | |||
if (error || !root) { | |||
return [error!.message]; | |||
if (error || typeof root === 'undefined' || root == null) { |
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.
nitpick: root == null
is sufficient for both undefined
and null
@@ -35,7 +35,7 @@ function parseAndExtract( | |||
label?: string | |||
) { | |||
const { root, error } = tryToParse(text, operationDefinitionMap); | |||
if (error || !root) { | |||
if (error || typeof root === 'undefined' || root == null) { |
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.
Same as above.
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.
LGTM
One slight concern I have is that this strategy won't work as I would have expected if there is a bucket dimension involved, because there will be a table without any rows.
Why are there no results? Should be a constant line
Why is the constant line stopping with the data?
I don't think we should attempt to make these cases behave like thresholds (we will implement "real" thresholds for this very case after all), just wanted to mention it.
@flash1293 I agree that this case is confusing. It's happening because I think the best option is to have a special validator that checks that the metrics are agg-based metrics, so that we can give a warning if there is a bucket agg but no metric agg. |
@wylieconlon Right, we could do a warning but I'm not too worried because we don't want people to use this for thresholds anyway so it might be even good to make sure they stick with the right tool for the job. |
@flash1293 After looking into this a bit more, I have decided to leave the behavior of this PR as-is in the case where you have a bucket + single number. All the current visualizations are rendering this as an empty state, which is accurate because they are missing data. I did look into adding a warning message but it would have to touch a large number of files and seems like a riskier change. |
Not sure what's up with this failure - maybe it needs a bit more time to refresh the visualization? |
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.
code LGTM
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
…ens (elastic#103788) * [Expressions] Introduce createTable expression function, and use in Lens * Fix test * Fix code style * Fix typo Co-authored-by: Kibana Machine <[email protected]>
…ens (elastic#103788) * [Expressions] Introduce createTable expression function, and use in Lens * Fix test * Fix code style * Fix typo Co-authored-by: Kibana Machine <[email protected]>
…ens (#103788) (#104878) * [Expressions] Introduce createTable expression function, and use in Lens * Fix test * Fix code style * Fix typo Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Wylie Conlon <[email protected]>
…ens (#103788) (#104879) * [Expressions] Introduce createTable expression function, and use in Lens * Fix test * Fix code style * Fix typo Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Wylie Conlon <[email protected]>
This allows a Lens formula to contain only a static number:
Checklist