-
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] Time shift metrics #98781
[Lens] Time shift metrics #98781
Conversation
I implemented the changes we discussed last time - with one twist: There is a case where a shifted metric works fine even with terms. That's the case if all metrics of the current layer are shifted. There is a good reason to do so:
So this is what I built on this PR: Single shifted metric with terms - works fine: Adding another unshifted metric leads to an error: Can be "fixed" by pinning the current top values: As discussed I removed the warning for mismatched scaling. Thinking about it a bit more I don't even think the error message on dashboard is necessary, but I'm going to add a warning for within the editor. What do you think @ghudgins @MichaelMarcialis @wylieconlon @dej611 @mbondyra ? |
@flash1293 there's only one remedy right? If we keep the error state I would think it's because we should offer a few choices (is "go back" a reasonable second option?) . @MichaelMarcialis depending on the answer to above, if there's only one sensible choice, should we just do the remedy (switch to |
A real go back would open another can of worms (undo/redo history), but we could offer these things as well that come close looking at the ways to get into this state in the first place:
Don't really like the last two because they are potentially destructive. |
If the resolution was a smaller or less impactful change to the chart configuration, I'd be inclined to agree with you and just automatically apply the fix. However, in this case, my first instinct is that taking control away from the user and making such a dramatic alteration to their chart configuration (i.e. changing the entire quick function) without their consent could be potentially confusing and annoying. Even if there is only one way to remedy the situation, I'd be more keen to inform the user and provide them with one or more actions they can take to either opt into a remedy or undo (via one or more of the options @flash1293 describes above) the current situation. It would probably behoove us to involve @KOTungseth as well to finesse the wording as well, as I see we're using words like "pinning" in reference to the filters function which I'm not sure the user would understand. Also, I think tweaking the error message a bit so that it better explains to users why they can't break down by top values across two different time shifts in lay-terms would help as well. |
Definitely treat all copy on that PR as an initial draft :) In the past we did a pass over all new copy introduced with Kaarina or Gail close to the feature freeze. |
Jenkins, test this |
When switching between operations, the dropdown keeps opening.
Console bug with two layers - reproducible on master: #100766When dragging a field currency to freshly converted
|
Yes! I'm all for making our error messages as clear as possible. How about:
|
Thanks @mbondyra
I didn't work on the custom label issue as it would require global changes (as discussed offline) I will handle this one as a follow-up in a separate PR. |
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.
Rechecked and everything works as expected. LGTM 👌🏼
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.
@flash1293 I found one bug and a few potential bugs:
-
If you type an invalid time shift, you can't delete it with backspace like a valid time shift. For example
asdf
can only be deleted by removing the entire time shift. -
Whitespace isn't trimmed from time shifts, so
-5d
is invalid. Not a big bug, just annoying due to the above -
When I have multiple Top Values aggs, only the first fix action is shown:
- Left a comment about filtered metric + time offset which looks potentially concerning.
x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx
Show resolved
Hide resolved
x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/cardinality.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/cardinality.tsx
Show resolved
Hide resolved
Thanks for the review @wylieconlon
Not handling local state correctly here, fixed that
Whitespace is ignored for parsing now
Showing all fix actions
Time shift can be used along with filtered metrics. It's omitted in the Added a comment
Added spacings if there are multiple options. |
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!
💚 Build SucceededMetrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
References to deprecated APIs
History
To update your PR or re-run it, just comment with: |
💔 Backport failed
To backport manually run: |
* master: (68 commits) Unskip advanced settings a11y test (elastic#100558) [App Search] Crawler Landing Page (elastic#100822) [DOCS] Clarify when to use kbn clean (elastic#101155) change label behavior (elastic#100991) skip flaky suite (elastic#101126) Fix cases plugin ownership (elastic#101073) [Home] Adding file upload to add data page (elastic#100863) [ML] Functional tests - reenable categorization tests (elastic#101137) [DOCS] Adds server.uuid to settings docs (elastic#101121) Fix newsfeed unread notifications always on when reloading Kibana (elastic#100357) [Lens] Time shift metrics (elastic#98781) [Deprecations service] make `correctiveActions.manualSteps` required (elastic#100997) Add "Risk Matrix" section to the PR template (elastic#100649) [Maps] spatially filter by all geo fields (elastic#100735) [Security Solution] Add Ransomware canary advanced policy option (elastic#101068) [Exploratory view] Core web vitals (elastic#100320) [Security solution][Endpoint] Add unit tests for fleet event filters/trusted apps cards (elastic#101034) [Lens] Use a setter function for the dimension panel (elastic#101123) [Index Patterns] Fix return saved index pattern object (elastic#101051) [CI] For PRs, build TS refs before public api docs check (elastic#100791) ...
hi, in which version are you planning to release this? |
@skuc-fp it has been merged in the 7.14 release |
Fixes #68458
Adds the ability to shift individual metrics in time. The shift can either be a unit of time (
1d
,6h
, ...) orprevious
, which will shift the metric by one date bucket if there's a date histogram or by the length of the current time range if there is no date histogram in the current chart.As long as all metrics in a chart are shifted by the same amount of time, there is no limitation in configuring it - however if there are different shifts (like no shift and a shift by one day), the terms function is not allowed. In this case an error message will the shown and the user can resolve it by pinning the current top values, creating a filters function:
Single shifted metric with terms - works fine:
Adding another unshifted metric leads to an error:
Can be "fixed" by pinning the current top values:
For the general approach check out the request/response examples in https://gist.github.com/flash1293/d9acacdd9c6439c1cf507f92b05ccca9
I’m going to add more cases to the functional testing, but the code can be reviewed already.
Code changes AggConfigs
getSearchSourceTimeFilter
). If there are shifted metrics, build an OR query for all time rangestransformTimeShift
- then will merge together the splitted branches into a single one recursivelymergeAggLevel
) This is the core part of the logicsplitForTimeShift
function which will return true if a filters split should be inserted above the dsl for this agg configgetShiftedKey
(to shift a bucket key, used in date histogram),orderBuckets
(to order merged buckets if some only existed in one branch of the time split),getTimeShiftInterval
(to get the underlying interval of the request for powering the "previous" time shift mode, used in date histogram)toDsl
include time filter split in the request at the right placeCode changes Lens
Testing the agg config level (without Lens)
To test the agg config level:
node scripts/functional_tests_server.js --config test/interpreter_functional/config.ts
http://localhost:5620
Testing on Lens level
For each metric dimension, theres a "Shift in time" option under "Advanced options"