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

[APM] Client new platform migration #64046

Merged
merged 12 commits into from
Apr 30, 2020
Merged

Conversation

ogupte
Copy link
Contributor

@ogupte ogupte commented Apr 21, 2020

Closes #32894.

  • migrates all files in the legacy plugin path for apm to the new plugin path at x-pack/plugins/apm.
  • replaces the legacy client setup with the new kibana platform setup.
  • implements a new API at /api/apm/index-pattern/title which was necessary since this value was no longer available as an injected meta data in legacy. I was unable to expose it from the plugin config, since it's really a config value from a dependency apm_oss, so it made sense to just pass it to the client via API response.
  • adds missing plugin dependencies features and triggers_actions_ui.
  • moves all scripts and cypress io code in apm/scripts and apm/e2e.
  • migrates to the new saved objects mappings API and conventions in apm/server/saved_objects

This PR does NOT:

  • change file/dir names to snake_case, instead it excludes it from the case checking task.
  • change the routing history scheme. At the top level, it will route into and out of APM using the platform's history object, and then under that, it still uses the hash history object for APM-specific routes. This should be address to take advantage of the global, platform history object in another PR.

For the reviewer's convenience, all substantive changes were limited to this commit: 9e72500

@botelastic botelastic bot added the Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability label Apr 22, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

@ogupte ogupte marked this pull request as ready for review April 28, 2020 06:25
@ogupte ogupte requested review from a team as code owners April 28, 2020 06:25
@ogupte ogupte added release_note:skip Skip the PR/issue when compiling release notes v7.8 labels Apr 28, 2020
@ogupte
Copy link
Contributor Author

ogupte commented Apr 28, 2020

retest

"data",
"home",
"licensing",
"triggers_actions_ui"
Copy link
Member

Choose a reason for hiding this comment

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

this should probably be in optional, with the other plugins necessary for alerting (alerting and actions).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actionTypeRegistry and alertTypeRegistry are required for <AlertsContextProvider>, so it will have to be required unless we do some kind of conditional rendering of context, but i don't think that will be good for downstream consumers of that context.

Copy link
Member

@dgieselaar dgieselaar left a comment

Choose a reason for hiding this comment

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

No specific concerns from me, just a few qs and suggestions - great work @ogupte!

};

/**
* This module will be loaded asynchronously to reduce the bundle size of your plugin's main bundle.
Copy link
Member

Choose a reason for hiding this comment

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

should we reword this comment?

@@ -20,7 +20,8 @@ import {
ESSearchResponse
} from '../../../typings/elasticsearch';
import { OBSERVER_VERSION_MAJOR } from '../../../common/elasticsearch_fieldnames';
import { pickKeys } from '../../../../../legacy/plugins/apm/public/utils/pickKeys';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { pickKeys } from '../../../public/utils/pickKeys';
Copy link
Member

Choose a reason for hiding this comment

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

should we move this to common?

@@ -9,7 +9,7 @@ import { getErrorGroups } from './get_error_groups';
import {
SearchParamsMock,
inspectSearchParams
} from '../../../../../legacy/plugins/apm/public/utils/testHelpers';
} from '../../../public/utils/testHelpers';
Copy link
Member

Choose a reason for hiding this comment

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

not related to this PR, but feels like this file should not be in public anyway. there's a bunch of node imports there that will break when it's used in storybook for instance.

Copy link
Contributor

Choose a reason for hiding this comment

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

Pretty sure it does, in fact, break in storybook.

@@ -9,7 +9,8 @@ import { EuiButtonEmpty, EuiContextMenuItem, EuiContextMenuPanel, EuiPopover } f
import { FormattedMessage } from '@kbn/i18n/react';
import React, { useMemo } from 'react';
import { useVisibilityState } from '../../../utils/use_visibility_state';
import { getTraceUrl } from '../../../../../../legacy/plugins/apm/public/components/shared/Links/apm/ExternalLinks';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getTraceUrl } from '../../../../../apm/public/components/shared/Links/apm/ExternalLinks';
Copy link
Member

Choose a reason for hiding this comment

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

this should be exported from /apm/public to prevent the warning no?

// .svg
import '../../../legacy/plugins/canvas/types/webpack';
// import '../../../legacy/plugins/canvas/types/webpack';
Copy link
Member

Choose a reason for hiding this comment

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

can we remove this then?

*/
import { APMRequestHandlerContext } from '../../routes/typings';

export async function getApmIndexPatternTitle(
Copy link
Member

Choose a reason for hiding this comment

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

why is this async?

PluginStartContract as AlertingPluginPublicStart
} from '../../alerting/public';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server';
Copy link
Member

Choose a reason for hiding this comment

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

are we importing the right file here? we don't need the one from features/public?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're right, i was importing the wrong type. Also we don't even use the features plugin in the client app, so we could just omit it

} from '../../../../src/core/public';
import { ApmPlugin, ApmPluginSetup, ApmPluginStart } from './plugin';

export interface ConfigSchema {
Copy link
Member

Choose a reason for hiding this comment

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

It's not entirely clear to me when reading this what this type is based on. It looks like they are the properties we want to expose from the server config to the browser, but I'm not seeing the connection to runtime code. Can we tie them together in some way?

Copy link
Contributor

@rylnd rylnd left a comment

Choose a reason for hiding this comment

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

Did not exercise the APM migration itself, but SIEM changes look good. Thank you for keeping those references up to date 👍

@andrewvc andrewvc added Team:APM All issues that need APM UI Team support and removed Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability labels Apr 28, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:apm)

Copy link
Contributor

@smith smith left a comment

Choose a reason for hiding this comment

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

Great work! 👍 from me once tests pass and conflicts fixed.

Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

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

Operations: path updates in config LGTM

- exposes getTraceUrl as a plugin static export of apm/public and updates import in infra
- fixes FeaturesPluginSetup import in apm/public app
- renames get_apm_index_pattern_titles -> get_apm_index_pattern_title
- getApmIndexPatternTitle is now a synchronous getter function
- removes unused comments and xpack.apm.apmForESDescription i18n translations
@ogupte ogupte added v7.8.0 and removed v7.8 labels Apr 29, 2020
@ogupte
Copy link
Contributor Author

ogupte commented Apr 29, 2020

retest

@ogupte ogupte requested a review from a team as a code owner April 30, 2020 00:10
Copy link
Contributor

@FrankHassanabad FrankHassanabad left a comment

Choose a reason for hiding this comment

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

For SIEM changes this is 👍

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.

Nice! Congrats 👏

Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

I don't think you need these files anymore. You might also want to look into the css files you moved over. A few of them reference selectors that no longer exist like kuiLocalNav. I've only done a code scan of these changes.

x-pack/plugins/apm/public/application/index.tsx Outdated Show resolved Hide resolved
x-pack/plugins/apm/public/style/index.scss Outdated Show resolved Hide resolved
Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the changes

// TODO fix file names in APM to remove these
'x-pack/plugins/apm/public/**/*',
'x-pack/plugins/apm/scripts/**/*',
'x-pack/plugins/apm/e2e/**/*',
Copy link
Member

Choose a reason for hiding this comment

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

Is there any automated way (eslint --fix) to update the filenames?

Copy link
Contributor Author

@ogupte ogupte Apr 30, 2020

Choose a reason for hiding this comment

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

not for scripts or e2e. for public, i started working on a code mod to update all the imports with the new paths, but then it was suggested by the platform team to ignore them for now and address it in another PR

return await callApmApi({
pathname: '/api/apm/index_pattern/title'
});
};
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we want an endpoint for each config value the UI needs. Could we make this more generic so it returns all APM config values (supposing there is nothing confidential in them).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's some opportunity for that since we also get the various apm_oss indices for index settings default values. But Let's address it in another tech debt issue. I'd like to keep this PR as minimal as possible.

Copy link
Member

@sorenlouv sorenlouv Apr 30, 2020

Choose a reason for hiding this comment

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

Agree, I should have made it clear that this was for follow-up. We don't have to do it until the need arises (eg. we need to pass another config value to the UI)

Copy link
Contributor

@paul-tavares paul-tavares left a comment

Choose a reason for hiding this comment

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

LGTM

Does not seem to have touched any Endpoint files.

- moving readOnly badge, and help extension setup to occure only
  when apm app is mounted
- registering saved object types
- also moved createStaticIndexPattern from a react useEffect on the
  APM home screen to when the app is mounted
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@ogupte ogupte merged commit 16ba937 into elastic:master Apr 30, 2020
ogupte added a commit to ogupte/kibana that referenced this pull request Apr 30, 2020
* migrate files from legacy path to new plugin path

* update file paths to reflect migrated files

* move minimal legacy client files back to legacy path in order to run kibana

* Completes the full cutover to the new kibana platform removing all shims and legacy adapters.

* Adds APM to ignored list for casing check.

* - moves public/utils/pickKeys.ts to common/utils/pick_keys.ts
- exposes getTraceUrl as a plugin static export of apm/public and updates import in infra
- fixes FeaturesPluginSetup import in apm/public app
- renames get_apm_index_pattern_titles -> get_apm_index_pattern_title
- getApmIndexPatternTitle is now a synchronous getter function
- removes unused comments and xpack.apm.apmForESDescription i18n translations

* Moves automatic index pattern saved object creation from
plugin start to when the Home screen first renders

* removed unnecessary legacy css imports

* fixed ci issues by:
- moving readOnly badge, and help extension setup to occure only
  when apm app is mounted
- registering saved object types
- also moved createStaticIndexPattern from a react useEffect on the
  APM home screen to when the app is mounted
ogupte added a commit that referenced this pull request May 1, 2020
* [APM] Client new platform migration (#64046)

* migrate files from legacy path to new plugin path

* update file paths to reflect migrated files

* move minimal legacy client files back to legacy path in order to run kibana

* Completes the full cutover to the new kibana platform removing all shims and legacy adapters.

* Adds APM to ignored list for casing check.

* - moves public/utils/pickKeys.ts to common/utils/pick_keys.ts
- exposes getTraceUrl as a plugin static export of apm/public and updates import in infra
- fixes FeaturesPluginSetup import in apm/public app
- renames get_apm_index_pattern_titles -> get_apm_index_pattern_title
- getApmIndexPatternTitle is now a synchronous getter function
- removes unused comments and xpack.apm.apmForESDescription i18n translations

* Moves automatic index pattern saved object creation from
plugin start to when the Home screen first renders

* removed unnecessary legacy css imports

* fixed ci issues by:
- moving readOnly badge, and help extension setup to occure only
  when apm app is mounted
- registering saved object types
- also moved createStaticIndexPattern from a react useEffect on the
  APM home screen to when the app is mounted

* [APM] fixes type declaration for ApmRoute
v1v added a commit to v1v/kibana that referenced this pull request May 4, 2020
* upstream/master: (315 commits)
  [APM] Fix failing `ApmIndices` test (elastic#64965)
  [APM] Fix paths for ts optimization script (elastic#65012)
  Use HDR for percentiles (elastic#64758)
  [EPM] fix updates available filter (elastic#64957)
  [Uptime] Certificates page (elastic#64059)
  load lens app lazily (elastic#64769)
  [legacy/server/config] remove unnecessary deps for simple helper (elastic#64954)
  Fixed alert Edit flyout shows the error message when one of this actions has a preconfigured action type (elastic#64742)
  [data.search.aggs] Remove legacy aggs APIs. (elastic#64719)
  Fixed `AddAlert` flyout does not immediately update state to reflect new props (elastic#64927)
  [Discover] Show doc viewer action buttons on focus (elastic#64912)
  [EPM] restrict package install endpoint from installing/updating to old packages (elastic#64932)
  [Metrics UI] Add inventory metric threshold alerts (elastic#64292)
  [Canvas] Adds edit menu (elastic#64738)
  [Canvas] Adds refresh and autoplay options to view menu (elastic#64375)
  [Lens] Trigger a filter action on click in datatable visualization (elastic#63840)
  [SIEM][CASE] Refactor Connectors - Jira Connector (elastic#63450)
  [APM] Client new platform migration (elastic#64046)
  [Monitoring] NP Migration complete client cutover (elastic#62908)
  Ingest Node Pipelines UI (elastic#62321)
  ...
jloleysens added a commit to jloleysens/kibana that referenced this pull request May 4, 2020
…or-part-mvp-2

* 'master' of github.com:elastic/kibana: (51 commits)
  [APM] Fix failing `ApmIndices` test (elastic#64965)
  [APM] Fix paths for ts optimization script (elastic#65012)
  Use HDR for percentiles (elastic#64758)
  [EPM] fix updates available filter (elastic#64957)
  [Uptime] Certificates page (elastic#64059)
  load lens app lazily (elastic#64769)
  [legacy/server/config] remove unnecessary deps for simple helper (elastic#64954)
  Fixed alert Edit flyout shows the error message when one of this actions has a preconfigured action type (elastic#64742)
  [data.search.aggs] Remove legacy aggs APIs. (elastic#64719)
  Fixed `AddAlert` flyout does not immediately update state to reflect new props (elastic#64927)
  [Discover] Show doc viewer action buttons on focus (elastic#64912)
  [EPM] restrict package install endpoint from installing/updating to old packages (elastic#64932)
  [Metrics UI] Add inventory metric threshold alerts (elastic#64292)
  [Canvas] Adds edit menu (elastic#64738)
  [Canvas] Adds refresh and autoplay options to view menu (elastic#64375)
  [Lens] Trigger a filter action on click in datatable visualization (elastic#63840)
  [SIEM][CASE] Refactor Connectors - Jira Connector (elastic#63450)
  [APM] Client new platform migration (elastic#64046)
  [Monitoring] NP Migration complete client cutover (elastic#62908)
  Ingest Node Pipelines UI (elastic#62321)
  ...

# Conflicts:
#	x-pack/plugins/ingest_pipelines/common/types.ts
#	x-pack/plugins/ingest_pipelines/public/application/components/pipeline_form/pipeline_form.tsx
#	x-pack/plugins/ingest_pipelines/public/application/components/pipeline_form/pipeline_form_fields.tsx
#	x-pack/plugins/ingest_pipelines/public/shared_imports.ts
gmmorris added a commit to gmmorris/kibana that referenced this pull request May 4, 2020
* master: (44 commits)
  onEvent prop for expression component (elastic#64995)
  [APM] Fix failing `ApmIndices` test (elastic#64965)
  [APM] Fix paths for ts optimization script (elastic#65012)
  Use HDR for percentiles (elastic#64758)
  [EPM] fix updates available filter (elastic#64957)
  [Uptime] Certificates page (elastic#64059)
  load lens app lazily (elastic#64769)
  [legacy/server/config] remove unnecessary deps for simple helper (elastic#64954)
  Fixed alert Edit flyout shows the error message when one of this actions has a preconfigured action type (elastic#64742)
  [data.search.aggs] Remove legacy aggs APIs. (elastic#64719)
  Fixed `AddAlert` flyout does not immediately update state to reflect new props (elastic#64927)
  [Discover] Show doc viewer action buttons on focus (elastic#64912)
  [EPM] restrict package install endpoint from installing/updating to old packages (elastic#64932)
  [Metrics UI] Add inventory metric threshold alerts (elastic#64292)
  [Canvas] Adds edit menu (elastic#64738)
  [Canvas] Adds refresh and autoplay options to view menu (elastic#64375)
  [Lens] Trigger a filter action on click in datatable visualization (elastic#63840)
  [SIEM][CASE] Refactor Connectors - Jira Connector (elastic#63450)
  [APM] Client new platform migration (elastic#64046)
  [Monitoring] NP Migration complete client cutover (elastic#62908)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:APM All issues that need APM UI Team support v7.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[APM] New Kibana platform migration plan