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] Logs overview queries for the observability dashboard #70413

Merged
merged 16 commits into from
Jul 3, 2020

Conversation

afgomez
Copy link
Contributor

@afgomez afgomez commented Jul 1, 2020

Summary

This PR provides log overview data for the observability dashboard.

Checklist

Delete any items that are not applicable to this PR.

@afgomez afgomez added 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 labels Jul 1, 2020
@afgomez afgomez force-pushed the 68531-logs-overview-queries branch from d985d6d to 92607df Compare July 1, 2020 09:57
@afgomez afgomez marked this pull request as ready for review July 1, 2020 14:42
@afgomez afgomez requested a review from a team as a code owner July 1, 2020 14:42
Copy link
Member

@jasonrhodes jasonrhodes left a comment

Choose a reason for hiding this comment

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

Looks like I'm getting an error that I can't quite track down. The error seems to be a vague one related to the esSearcher observable:

VM2611:1 POST http://localhost:5601/internal/search/es 400 (Bad Request)

logs_overview_fetchers.ts:44 Error: Bad Request
    at Fetch.fetchResponse (fetch.ts:162)
    at async interceptResponse (intercept.ts:58)
    at async http:/localhost:5601/9007199254740991/bundles/core/core.entry.js:50572

Is the esSearcher API documented anywhere or are you just piecing it together reading code?

I trigger this with the following patch:

diff --git a/x-pack/plugins/observability/public/application/index.tsx b/x-pack/plugins/observability/public/application/index.tsx
index 21a9fabf445..7e9e3bc6358 100644
--- a/x-pack/plugins/observability/public/application/index.tsx
+++ b/x-pack/plugins/observability/public/application/index.tsx
@@ -9,10 +9,28 @@ import { EuiThemeProvider } from '../../../../legacy/common/eui_styled_component
 import { AppMountParameters, CoreStart } from '../../../../../src/core/public';
 import { Home } from '../pages/home';
 import { PluginContext } from '../context/plugin_context';
+import { getDataHandler } from '../data_handler';
 
 export const renderApp = (core: CoreStart, { element }: AppMountParameters) => {
   const i18nCore = core.i18n;
   const isDarkMode = core.uiSettings.get('theme:darkMode');
+
+  const getData = async () => {
+    const now = new Date();
+    const params = {
+      startTime: '2020-06-29T11:38:23.747Z',
+      endTime: now.toString(),
+      bucketSize: '30s',
+    };
+    const data = await getDataHandler('infra_logs')?.fetchData(params);
+    console.log('logs data', { data });
+  };
+
+  getData().catch((e) => {
+    console.log('an error occurred while getting obs data');
+    console.log(e);
+  });
+
   ReactDOM.render(
     <PluginContext.Provider value={{ core }}>
       <EuiThemeProvider darkMode={isDarkMode}>

and then navigating to /app/observability

@cauemarcondes
Copy link
Contributor

@afgomez as we discussed today can you return the logs rate per minute in the series, and the average in the stats, please?

I've done the same on APM: https://github.com/elastic/kibana/blob/master/x-pack/plugins/apm/server/lib/observability_dashboard/get_transaction_coordinates.ts#L50

@afgomez
Copy link
Contributor Author

afgomez commented Jul 2, 2020

@jasonrhodes seems an issue with how the date is passed. The startTime is in ISO string, but the endTime is in epoch_millis. I'm not sure ES lets you mix and match (therefore the 400 error).

@jasonrhodes
Copy link
Member

@jasonrhodes seems an issue with how the date is passed. The startTime is in ISO string, but the endTime is in epoch_millis. I'm not sure ES lets you mix and match (therefore the 400 error).

Oh I did .toString() so it's not millis but that's not the right string method, I need toISOString() 🤦

Copy link
Member

@jasonrhodes jasonrhodes left a comment

Choose a reason for hiding this comment

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

Looks great, nice work.

@jasonrhodes
Copy link
Member

jasonrhodes commented Jul 2, 2020

@afgomez if you look at the tests here that Chris added for metrics, could we duplicate those for some logs tests for our fetcher methods? #70529

We could merge this and do it immediately in another PR to unblock this for Caue if you want, but I'd like to get tests in ASAP.

@afgomez
Copy link
Contributor Author

afgomez commented Jul 2, 2020

@jasonrhodes I was planning to :)

@jasonrhodes
Copy link
Member

@jasonrhodes I was planning to :)

Yes but now I get credit for being the one who suggested it. #leadering

Alejandro Fernández Gómez added 2 commits July 3, 2020 11:46
The graphs need to show the log rate per minute instead of the log
count. This commit adds two helper functions to normalize those values.
@afgomez afgomez requested a review from jasonrhodes July 3, 2020 11:07
Copy link
Contributor

@cauemarcondes cauemarcondes left a comment

Choose a reason for hiding this comment

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

Observability registration LGTM.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

@kbn/optimizer bundle module count

id value diff baseline
infra 606 +3 603

History

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

@afgomez
Copy link
Contributor Author

afgomez commented Jul 3, 2020

Merging now. There's a test missing that I will add in a separate PR.

@afgomez afgomez merged commit f3573f3 into elastic:master Jul 3, 2020
@afgomez afgomez deleted the 68531-logs-overview-queries branch July 3, 2020 14:59
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)
afgomez pushed a commit that referenced this pull request Jul 6, 2020
…#70413) (#70730)

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants