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

[Logs UI] Reorganise log rate anomaly table #69516

Merged
merged 39 commits into from
Jul 3, 2020

Conversation

Kerry350
Copy link
Contributor

@Kerry350 Kerry350 commented Jun 18, 2020

Summary

This PR implements #63671, and lays a lot of the foundations for #64755.

From a high-level the following changes have been made:

  • A new API endpoint has been created to retrieve log entry rate log examples. This endpoint is very similar to the log category example endpoint. I didn't want to try and merge / DRY up these two endpoints too early. They do have a lot of similarities, especially at the route handler level, but the actual queries and types differ. When [Logs UI] Show category anomalies in anomaly table #64755 is implemented it may make sense to to have these converge (in places).

  • The loading / no results / has failed to load results portion of the log examples display has been refactored into a reusable component - this is now being used for the log entry rate examples, and the category examples on the categories page.

  • The severity indicator is also reusable now.

  • The API for results currently remains log entry rate "graph centric" and not anomaly centric, and the client side just formats the data in a way that makes sense for displaying the new anomaly table format. For [Logs UI] Show category anomalies in anomaly table #64755 the API will be altered to be anomaly centric, and will return log entry rate and category anomalies in one. (This is to say that this doesn't need to be commented on for this round of work).

  • There are some things "left behind" here, like the log rate graph. [Logs UI] anomaly view cleanup #65046 will handle cleaning these parts up.

  • Table is now paginated as we're displaying a row per anomaly and not per dataset.

Testing

For variety it can be helpful to have data from several datasets.

Remove top level anomalies chart
… log rate table can use it"

This reverts commit f80db59.
@Kerry350 Kerry350 self-assigned this Jun 29, 2020
@Kerry350 Kerry350 added Feature:Logs UI Logs UI feature Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services v7.9.0 v8.0.0 labels Jun 29, 2020
@Kerry350
Copy link
Contributor Author

Kerry350 commented Jul 2, 2020

@weltenwort

When using the page to inspect the anomalies I found that the table is not as useful, because it potentially contains many identically-looking rows which the can't easily associate to the point in time when the anomaly occurred:

Yeah, that's a fair point.

Implementing Show the start and/or end time of the bucket in the row. would be simple and I can't see any drawbacks to adding it.

Link the contents of the table and the chart via some interaction such as highlighting the bucket and associated table rows on click or hover. could then be done in a followup.

Kerry350 and others added 3 commits July 2, 2020 10:23
…/anomalies/expanded_row.tsx

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
- Pass href to context menu items
- Fix start and end times used for example logs
- Use "fewer" rather than "less"
…/kibana into 63671-reorganise-log-rate-table
@Kerry350
Copy link
Contributor Author

Kerry350 commented Jul 2, 2020

@weltenwort I just wanted to circle back to this:

Show the start and/or end time of the bucket in the row.

As I had some questions once I got to implementation.

In this work we alter the table that shows log rate anomalies. In #64755 we'll add category anomalies to the table. But the chart remains linked to log rate anomalies only.

If the start and / or end times of the bucket are used, that makes sense for now with log rate anomalies. But there won't be associated buckets for the category anomalies. A few questions:

  • Should we just add the start and / or end time of the bucket for log rate anomalies.
  • Should we show the time the anomaly occurred for category anomalies?
  • Should we instead show the time the anomaly occurred for both? And forego the bucket time display in the rows?

I'm thinking across the two sets of work at this point. Also, the new anomaly API just returns all the anomalies, within the time range (future, this would have dataset filtering too). And whilst the time of the anomaly occurence would be there, it would need to be linked client side back into the bucketed data that deals with the chart-centric data (doable, of course, just wanted to highlight it).

@weltenwort
Copy link
Member

Good point. Showing the anomaly start time (which corresponds to the ML-controlled bucketing) for the anomaly rows seems more sensible as opposed to using the chart bucketing.

@weltenwort
Copy link
Member

But the chart remains linked to log rate anomalies only.

I guess we're still aiming for a swimlane-like chart at some point, which could then contain all kinds of anomalies.

Copy link
Member

@weltenwort weltenwort left a comment

Choose a reason for hiding this comment

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

I couldn't provoke the problem with the missing log entries anymore 👍

I left a few questions and nits below. Do you plan on adding the time column we discussed earlier in this PR or a follow-up?

dataset: string,
exampleCount: number,
sourceConfiguration: InfraSource,
callWithRequest: KibanaFramework['callWithRequest']
Copy link
Member

Choose a reason for hiding this comment

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

Would there be a downside to using context.core.elasticsearch.legacy.client.callAsCurrentUser instead of this?

Copy link
Contributor Author

@Kerry350 Kerry350 Jul 2, 2020

Choose a reason for hiding this comment

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

If I'm honest I'm not sure - I noticed that with the Kibana framework callWithRequest we do a little bit of preprocessing to the ES params, before calling callAsCurrentUser, things like:

 const includeFrozen = await uiSettings.client.get(UI_SETTINGS.SEARCH_INCLUDE_FROZEN);
    if (endpoint === 'msearch') {
      const maxConcurrentShardRequests = await uiSettings.client.get(
        UI_SETTINGS.COURIER_MAX_CONCURRENT_SHARD_REQUESTS
      );
      if (maxConcurrentShardRequests > 0) {
        params = { ...params, max_concurrent_shard_requests: maxConcurrentShardRequests };
      }
    }

this seemed important, so I opted to use that version. Is it safe to bypass the shard settings and so on?

Copy link
Member

Choose a reason for hiding this comment

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

That's true... so I'm not respecting that when fetching the category examples 😬 I guess we should make a search function available via the context at some point that does something similar to our framework function.

So this is technically more correct right now 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess we should make a search function available via the context at some point that does something similar to our framework function.

Yep, sounds good.

@Kerry350
Copy link
Contributor Author

Kerry350 commented Jul 2, 2020

@weltenwort

I left a few questions and nits below. Do you plan on adding the time column we discussed earlier in this PR or a follow-up?

The time column in the row, and additional empty log example header to account for the context menu are coming in here (just weren't ready with the other commits earlier).

Thanks for the new feedback 👍

Kerry350 and others added 9 commits July 2, 2020 16:32
…/anomalies/table.tsx

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
…/anomalies/log_entry_example.tsx

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
…/anomalies/log_entry_example.tsx

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
…/anomalies/table.tsx

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
…try_rate_examples.ts

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
…try_rate_examples.ts

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
…try_rate_examples.ts

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
…try_rate_examples.ts

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
- Fix typechecking
- Add an empty log example column header to account for the context menu
- Add anomaly start time to rows
@Kerry350
Copy link
Contributor Author

Kerry350 commented Jul 2, 2020

@weltenwort I've responded to everything (so far) now. Other than the outstanding ML link question, and the callWithRequest question.

The dataset alignment is fixed:

Screenshot 2020-07-02 17 27 30

And I've added a sortable Start time to the rows. I've used the Kibana dateFormat setting to format this, and the default is very verbose 😬 But it's best to go with the user's settings I guess.

Screenshot 2020-07-02 17 38 09

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

@kbn/optimizer bundle module count

id value diff baseline
infra 604 +1 603

History

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

Copy link
Member

@weltenwort weltenwort left a comment

Choose a reason for hiding this comment

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

The page looks good and seems to work well. This is a good basis for the inclusion of category anomalies IMHO.

Yet another piece of great work! 👏 :shipit:

@Kerry350 Kerry350 merged commit 7ec48fd into elastic:master Jul 3, 2020
Kerry350 added a commit to Kerry350/kibana that referenced this pull request Jul 3, 2020
* Remove top level chart

Remove top level anomalies chart

* Refactor table columns to accomodate new formatting

* Tyical vs actual stats in expanded row

* Format message based on actual vs typical

* Start fleshing out log rate examples endpoint and lib methods

* Use the real document ID for expanded rows so React doesn't re-render content

* Add all data fetching resources for log entry rate examples

* Move log entry example and severity indicator components to a shared location

* Render examples for log rate

* Add severity indicator

* Styling tweaks

* Move horizontal button popover menu to a shared components so log rate table can use it

* Revert "Move horizontal button popover menu to a shared components so log rate table can use it"

This reverts commit f80db59.

* Add "view in stream" and "view in anomaly explorer" links

* Hook links into the new context menu component

* Add log column headers and add styling tweaks etc

* Fix translations

* Tweak comments

* Chart tweaks

* Update x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/expanded_row.tsx

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>

* PR amendments

- Pass href to context menu items
- Fix start and end times used for example logs
- Use "fewer" rather than "less"

* Update x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/table.tsx

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>

* Update x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/log_entry_example.tsx

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>

* Update x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/log_entry_example.tsx

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>

* Update x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/table.tsx

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>

* Update x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_rate_examples.ts

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>

* Update x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_rate_examples.ts

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>

* Update x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_rate_examples.ts

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>

* Update x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_rate_examples.ts

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>

* PR amendments

- Fix typechecking
- Add an empty log example column header to account for the context menu
- Add anomaly start time to rows

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jul 6, 2020
* master:
  [APM-UI] e2e speed up build (elastic#70704)
  skip flaky suite (elastic#70764)
  skip flaky suite (elastic#70762)
  [Security Solution][Endpoint] Update to new manifest format (without compression) (elastic#70752)
  [functional tests] test url field formatter on dashboard and discover (elastic#70736)
  logout from transform_poweruser user in after method of transform tests (elastic#70644)
  [SECURITY] Bug fix for topN on draggables (elastic#70450)
  [Logs UI] Reorganise log rate anomaly table (elastic#69516)
  Update dependency @elastic/charts to v19.7.0 (elastic#69791)
  Add googlecloud metricbeat module to Kibana Home (elastic#70652)
  [Logs UI] Logs overview queries for the observability dashboard (elastic#70413)
  [Lens] Fitting functions (elastic#69820)
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jul 6, 2020
* master:
  [APM-UI] e2e speed up build (elastic#70704)
  skip flaky suite (elastic#70764)
  skip flaky suite (elastic#70762)
  [Security Solution][Endpoint] Update to new manifest format (without compression) (elastic#70752)
  [functional tests] test url field formatter on dashboard and discover (elastic#70736)
  logout from transform_poweruser user in after method of transform tests (elastic#70644)
  [SECURITY] Bug fix for topN on draggables (elastic#70450)
  [Logs UI] Reorganise log rate anomaly table (elastic#69516)
  Update dependency @elastic/charts to v19.7.0 (elastic#69791)
  Add googlecloud metricbeat module to Kibana Home (elastic#70652)
  [Logs UI] Logs overview queries for the observability dashboard (elastic#70413)
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jul 6, 2020
* actions/feature:
  fixed type errors
  [APM-UI] e2e speed up build (elastic#70704)
  skip flaky suite (elastic#70764)
  skip flaky suite (elastic#70762)
  [Security Solution][Endpoint] Update to new manifest format (without compression) (elastic#70752)
  [functional tests] test url field formatter on dashboard and discover (elastic#70736)
  logout from transform_poweruser user in after method of transform tests (elastic#70644)
  [SECURITY] Bug fix for topN on draggables (elastic#70450)
  [Logs UI] Reorganise log rate anomaly table (elastic#69516)
  Update dependency @elastic/charts to v19.7.0 (elastic#69791)
  Add googlecloud metricbeat module to Kibana Home (elastic#70652)
  [Logs UI] Logs overview queries for the observability dashboard (elastic#70413)
Kerry350 added a commit that referenced this pull request Jul 6, 2020
Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Logs UI Logs UI feature release_note:skip Skip the PR/issue when compiling release notes Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services v7.9.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants