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

[Lens][TSVB][Agg based] TSDB warning handling support for Lens, Agg based and TSVB #136833

Merged
merged 166 commits into from
Sep 8, 2022

Conversation

flash1293
Copy link
Contributor

@flash1293 flash1293 commented Jul 21, 2022

Fixes #132045

Bonus (because it's very easy to do with the new warning handling): Do not show warnings anymore for suggestions. In almost all cases they are just repeating the warnings from the main chart, rendering the config panel unusable and not adding any meaningful information.

How to test

Behavior

In the Lens editor, rollup errors are shown as warnings in the existing warning menu. Lens warnings get a nice message explaining what's going on.
Screenshot 2022-09-01 at 12 44 22

On dashboard, a warning indicator is rendered in the bottom right of the vis
Screenshot 2022-09-01 at 12 44 28

For TSVB and agg based, the warning indicator is rendered both in the editor and on the dashboard. The error message coming from Elasticsearch is not rewritten in the context of the chart.
Screenshot 2022-09-01 at 12 45 10
Screenshot 2022-09-01 at 12 45 00

If there are other shard failures than rollup related ones, the existing warning toast is still shown (in this case the shard failures modal is also including the failures originating from rollup if both are happening at the same time)
Screenshot 2022-09-01 at 12 48 45
Screenshot 2022-09-01 at 12 48 38

To cause the other shard failures, extend the data view to include another index name besides sample-01 and sample-01-rollup, then index a document which auto-sets a used number field to text, e.g. like this:

POST other-trickery-1/_doc
{
  "kubernetes.container.memory.available.bytes": "abc",
  "@timestamp": "2022-06-18"
}

This will cause a generic illegal argument exception which should not be handled locally.

Implementation details

Previously the warning toasts would be shown by the esaggs function implementation automatically. This PR changes this in the following way:

  • Disable the automatic handling by passing disableShardWarnings to the search context
  • In the embeddable (visualize and Lens), call showWarnings with the adapters and pass a callback which filters out rollup-related warnings

Due to this, the way shard failure warnings can be suppressed for TSVB needs to be changed:

  • Do not call handleWarnings from within the TSVB request handler anymore - the visualize embeddable does that already
  • Add a suppressWarnings function to the vis type definition which is checked in the embeddable whether the warning should be shown or not

@flash1293 flash1293 added Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens labels Jul 21, 2022
@flash1293 flash1293 changed the title [Lens] TSDB support for Lens [Lens][TSVB][Agg based] TSDB warning handling support for Lens, Agg based and TSVB Sep 1, 2022
@flash1293 flash1293 marked this pull request as ready for review September 1, 2022 11:17
@flash1293 flash1293 requested review from a team as code owners September 1, 2022 11:17
@elasticmachine
Copy link
Contributor

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

@stratoula
Copy link
Contributor

stratoula commented Sep 5, 2022

@flash1293 thanx a ton for the guidelines!
This works great in Lens and TSVB. I just noticed that the warning is wrong in agg based
Check here
image

I have selected median but the warning displays percentiles

Update: If I select percentile_ranks though the warning is correct 🤔

@flash1293
Copy link
Contributor Author

flash1293 commented Sep 5, 2022

@stratoula that's expected - if you check the request then you'll see that Elasticsearch doesn't have a special "median" agg - it was a percentiles agg with a single percentage 50 the whole time:
Screenshot 2022-09-05 at 14 50 05

@stratoula
Copy link
Contributor

Hahaha got it! Thanx Joe! Finishing some more tests and approving (I love the image btw :D )

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.

Code LGTM! This works great! I have tested all the editors following the steps. Love the bonus too ;)

Copy link
Contributor

@MichaelMarcialis MichaelMarcialis left a comment

Choose a reason for hiding this comment

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

@flash1293: I've left you some comments below for your review.

Additionally, I was curious about that shard failure modal you showed. Is this modal something that we created/control? If so, why the decision to put this content in an EuiModal versus an EuiFlyout? I imagine that a flyout is far more scalable for this sort of content content, which has the potential to get fairly lengthy (since flyouts natively support scrolling).

Also, I found the contents of that modal to be a bit confusing. It almost looks as though "Reason" is being listed multiple times for each entry (table column, bold text in open accordion, row in open accordion), with the last being a different message than the first two. Are they supposed to all be the same? If so, why are we showing it three times?

image

@flash1293
Copy link
Contributor Author

Thanks for the review @MichaelMarcialis .

Shard failure modal

This component existed before and wasn't changed on this PR. I see your point about turning it into a flyout, but I would like to split this out. The component is owned by the app services team.

Inline warning

The notification badge was just some random idea - I like your suggestion. This is how it looks:
Screenshot 2022-09-07 at 09 57 17

Could you review again?

Copy link
Contributor

@MichaelMarcialis MichaelMarcialis left a comment

Choose a reason for hiding this comment

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

Thanks for making those changes, @flash1293. Left one additional question/comment for you, but nothing earth-shattering. Approving now so I don't hold you up further.

Comment on lines 33 to 40
<div style={{ maxWidth: 512 }}>
{warnings.map((w, i) => (
<React.Fragment key={i}>
{w}
<br />
</React.Fragment>
))}
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these warnings just being nested in a div in the warning popover, and using a br to space them out? If so, would it be better to house each warning item in something like an EuiText and use some CSS padding and borders to separate each warning in the list? That way it looks similar to how warnings were intended to look in the Lens warning menu.

Old warning popover mockup:

image

@flash1293
Copy link
Contributor Author

Styled it a bit, but happy to improve in a follow-up:
Screenshot 2022-09-08 at 16 55 48

@flash1293 flash1293 enabled auto-merge (squash) September 8, 2022 14:56
@flash1293 flash1293 merged commit e7a8c87 into elastic:main Sep 8, 2022
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
charts 90 91 +1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
charts 246 249 +3
visualizations 389 390 +1
total +4

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
lens 1.2MB 1.2MB +2.3KB
visualizations 197.5KB 198.4KB +881.0B
total +3.1KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
charts 44.4KB 45.2KB +812.0B
visTypeTimeseries 18.9KB 18.8KB -34.0B
visualizations 47.3KB 47.5KB +213.0B
total +991.0B
Unknown metric groups

API count

id before after diff
charts 261 264 +3
visualizations 417 419 +2
total +5

History

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

@kibanamachine kibanamachine added v8.5.0 backport:skip This commit does not require backporting labels Sep 8, 2022
guskovaue pushed a commit to guskovaue/kibana that referenced this pull request Sep 12, 2022
…ased and TSVB (elastic#136833)

* start integrating TSDB into Lens

* current state

* make new type filter work

* fix translations

* handle warnings

* clean up and make warnings better

* split function list for referenced fields too and extend list of unsupported functions

* improve warnings

* fix a bug

* add todo for utc timezone

* adding TSDB support to DataViews

* adding test

* date_histogram: force fixed interval for tsdb rollups

* fixing types

* fixing types

* fixing types

* fixing types

* handling edge cases

* removing undefined entries from FieldSpec

* renaming .meta property

* enforce UTC timezone

* isRolledUpField helper

* updating snapshot

* adjust fixed interval and utc timezone for timelion and tsvb

* fixed interval mapping

* fixing test

* add showWarning to search service

* add comments

* add unit tests

* test foo

* cleanup

* add s to property name in test

* comments for api items

* fixing test

* use the warnings when calling showWarnings

* change showWarning to just show a single warning

* put handleWarnings on the request adapter

* comment

* simplify 1

* fix lens unit test

* fix PR

* remove duplicate identifier

* remove underscoring for unused variables

* revert inspector changes, extract the response warnings in the search service

* fix bug

* remove console.log

* re-apply typescript fixes to app test code

* declutter

* add test, improve comments

* fix some unexported public api items

* include rawResponse in the warning structure

* fix lint

* tweak clean up example app

* SearchResponseWarnings and SearchResponseWarningNotification

* fix export bug

* not include shardStats if there are no warnings

* Update src/plugins/data/common/search/types.ts

* fix duplicated entries

* remove empty line

* simplify SearchResponseWarnings interface

* remove array copying

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* comments for api_docs

* simplify per feedback

* Pass callback to handleResponse in showWarnings

* export more public types

* update example to make possible to show shard failure

* pr cleanup

* eslint fix

* allow example app to not show default warnings

* move extractWarning and related types to inspector plugin

* wip functional test of example app

* fix test references

* finish functional test

* relocate extractWarnings back to search/fetch

* fix test

* remove need for isTimeout, isShardFailure

* ts fix

* improve test

* Change showWarnings to accept the RequestAdapter

* use showWarnings in vis_types/timeseries

* more tests

* use handle_warning name

* fix ts

* add reason field to SearchResponseWarning

* fix component snapshot

* update comments

* test cleanup

* fix test

* ensure notification appears only once

* fix and cleanup

* fix ts

* fix response.json bug

* use top-level type, and lower-level reason.type

* cleanup

* change warning structure

* change warning infrastructure

* fix

* allows to disable automatic handling of shard warnings on expressions

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* fix tests

* fix tsconfig json

* allows to disable automatic handling of shard warnings on expressions

* fix tests

* allows to disable automatic handling of shard warnings on expressions

* disable warnings the right way

* fix stuff and clean up

* random cleanup

* fix test

* remove unused function

* review comments

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* style warnings and switch to real error message

Co-authored-by: ppisljar <[email protected]>
Co-authored-by: Timothy Sullivan <[email protected]>
Co-authored-by: Tim Sullivan <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
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 Feature:Lens release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Render TSDB rollup related shard failure warnings as part of the visulization instead of toast messages
8 participants