diff --git a/x-pack/legacy/plugins/apm/public/components/shared/KueryBar/Typeahead/Suggestion.js b/x-pack/plugins/apm/public/components/shared/KueryBar/Typeahead/Suggestion.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/KueryBar/Typeahead/Suggestion.js
rename to x-pack/plugins/apm/public/components/shared/KueryBar/Typeahead/Suggestion.js
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/KueryBar/Typeahead/Suggestions.js b/x-pack/plugins/apm/public/components/shared/KueryBar/Typeahead/Suggestions.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/KueryBar/Typeahead/Suggestions.js
rename to x-pack/plugins/apm/public/components/shared/KueryBar/Typeahead/Suggestions.js
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/KueryBar/Typeahead/index.js b/x-pack/plugins/apm/public/components/shared/KueryBar/Typeahead/index.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/KueryBar/Typeahead/index.js
rename to x-pack/plugins/apm/public/components/shared/KueryBar/Typeahead/index.js
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/KueryBar/get_bool_filter.ts b/x-pack/plugins/apm/public/components/shared/KueryBar/get_bool_filter.ts
similarity index 92%
rename from x-pack/legacy/plugins/apm/public/components/shared/KueryBar/get_bool_filter.ts
rename to x-pack/plugins/apm/public/components/shared/KueryBar/get_bool_filter.ts
index 19a9ae9538ad6..f4628524cced5 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/KueryBar/get_bool_filter.ts
+++ b/x-pack/plugins/apm/public/components/shared/KueryBar/get_bool_filter.ts
@@ -4,14 +4,14 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { ESFilter } from '../../../../../../../plugins/apm/typings/elasticsearch';
+import { ESFilter } from '../../../../typings/elasticsearch';
import {
TRANSACTION_TYPE,
ERROR_GROUP_ID,
PROCESSOR_EVENT,
TRANSACTION_NAME,
SERVICE_NAME
-} from '../../../../../../../plugins/apm/common/elasticsearch_fieldnames';
+} from '../../../../common/elasticsearch_fieldnames';
import { IUrlParams } from '../../../context/UrlParamsContext/types';
export function getBoolFilter(urlParams: IUrlParams) {
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/KueryBar/index.tsx b/x-pack/plugins/apm/public/components/shared/KueryBar/index.tsx
similarity index 98%
rename from x-pack/legacy/plugins/apm/public/components/shared/KueryBar/index.tsx
rename to x-pack/plugins/apm/public/components/shared/KueryBar/index.tsx
index dba31822dd23e..2622d08d4779d 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/KueryBar/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/KueryBar/index.tsx
@@ -21,7 +21,7 @@ import {
QuerySuggestion,
esKuery,
IIndexPattern
-} from '../../../../../../../../src/plugins/data/public';
+} from '../../../../../../../src/plugins/data/public';
const Container = styled.div`
margin-bottom: 10px;
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/LicensePrompt/LicensePrompt.stories.tsx b/x-pack/plugins/apm/public/components/shared/LicensePrompt/LicensePrompt.stories.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/LicensePrompt/LicensePrompt.stories.tsx
rename to x-pack/plugins/apm/public/components/shared/LicensePrompt/LicensePrompt.stories.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/LicensePrompt/index.tsx b/x-pack/plugins/apm/public/components/shared/LicensePrompt/index.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/LicensePrompt/index.tsx
rename to x-pack/plugins/apm/public/components/shared/LicensePrompt/index.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverErrorLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverErrorLink.tsx
similarity index 85%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverErrorLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverErrorLink.tsx
index 806d9f73369c3..05e4080d5d0b7 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverErrorLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverErrorLink.tsx
@@ -8,8 +8,8 @@ import React from 'react';
import {
ERROR_GROUP_ID,
SERVICE_NAME
-} from '../../../../../../../../plugins/apm/common/elasticsearch_fieldnames';
-import { APMError } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error';
+} from '../../../../../common/elasticsearch_fieldnames';
+import { APMError } from '../../../../../typings/es_schemas/ui/apm_error';
import { DiscoverLink } from './DiscoverLink';
function getDiscoverQuery(error: APMError, kuery?: string) {
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverLink.tsx
similarity index 93%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverLink.tsx
index 6dc93292956fa..b58a450d26644 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverLink.tsx
@@ -11,7 +11,7 @@ import url from 'url';
import rison, { RisonValue } from 'rison-node';
import { useLocation } from '../../../../hooks/useLocation';
import { getTimepickerRisonData } from '../rison_helpers';
-import { APM_STATIC_INDEX_PATTERN_ID } from '../../../../../../../../plugins/apm/common/index_pattern_constants';
+import { APM_STATIC_INDEX_PATTERN_ID } from '../../../../../common/index_pattern_constants';
import { useApmPluginContext } from '../../../../hooks/useApmPluginContext';
import { AppMountContextBasePath } from '../../../../context/ApmPluginContext';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverSpanLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverSpanLink.tsx
similarity index 79%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverSpanLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverSpanLink.tsx
index 8fe5be28def22..ac9e33b3acd69 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverSpanLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverSpanLink.tsx
@@ -5,8 +5,8 @@
*/
import React from 'react';
-import { SPAN_ID } from '../../../../../../../../plugins/apm/common/elasticsearch_fieldnames';
-import { Span } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/span';
+import { SPAN_ID } from '../../../../../common/elasticsearch_fieldnames';
+import { Span } from '../../../../../typings/es_schemas/ui/span';
import { DiscoverLink } from './DiscoverLink';
function getDiscoverQuery(span: Span) {
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverTransactionLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverTransactionLink.tsx
similarity index 85%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverTransactionLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverTransactionLink.tsx
index b0af33fd7d7f7..a5f4df7dbac1b 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverTransactionLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverTransactionLink.tsx
@@ -9,8 +9,8 @@ import {
PROCESSOR_EVENT,
TRACE_ID,
TRANSACTION_ID
-} from '../../../../../../../../plugins/apm/common/elasticsearch_fieldnames';
-import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
+} from '../../../../../common/elasticsearch_fieldnames';
+import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
import { DiscoverLink } from './DiscoverLink';
export function getDiscoverQuery(transaction: Transaction) {
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorButton.test.tsx b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorButton.test.tsx
similarity index 94%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorButton.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorButton.test.tsx
index eeb9fd20a4bcb..acf8d89432b23 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorButton.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorButton.test.tsx
@@ -6,7 +6,7 @@
import { shallow, ShallowWrapper } from 'enzyme';
import React from 'react';
-import { APMError } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error';
+import { APMError } from '../../../../../../typings/es_schemas/ui/apm_error';
import { DiscoverErrorLink } from '../DiscoverErrorLink';
describe('DiscoverErrorLink without kuery', () => {
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorLink.test.tsx b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorLink.test.tsx
similarity index 94%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorLink.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorLink.test.tsx
index eeb9fd20a4bcb..acf8d89432b23 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorLink.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorLink.test.tsx
@@ -6,7 +6,7 @@
import { shallow, ShallowWrapper } from 'enzyme';
import React from 'react';
-import { APMError } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error';
+import { APMError } from '../../../../../../typings/es_schemas/ui/apm_error';
import { DiscoverErrorLink } from '../DiscoverErrorLink';
describe('DiscoverErrorLink without kuery', () => {
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverLinks.integration.test.tsx b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverLinks.integration.test.tsx
similarity index 92%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverLinks.integration.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverLinks.integration.test.tsx
index 759caa785c1af..ea79fe12ff0bd 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverLinks.integration.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverLinks.integration.test.tsx
@@ -6,9 +6,9 @@
import { Location } from 'history';
import React from 'react';
-import { APMError } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error';
-import { Span } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/span';
-import { Transaction } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
+import { APMError } from '../../../../../../typings/es_schemas/ui/apm_error';
+import { Span } from '../../../../../../typings/es_schemas/ui/span';
+import { Transaction } from '../../../../../../typings/es_schemas/ui/transaction';
import { getRenderedHref } from '../../../../../utils/testHelpers';
import { DiscoverErrorLink } from '../DiscoverErrorLink';
import { DiscoverSpanLink } from '../DiscoverSpanLink';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionButton.test.tsx b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionButton.test.tsx
similarity index 90%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionButton.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionButton.test.tsx
index d72925c1956a4..5769ca34a9a87 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionButton.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionButton.test.tsx
@@ -6,7 +6,7 @@
import { shallow } from 'enzyme';
import React from 'react';
-import { Transaction } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
+import { Transaction } from '../../../../../../typings/es_schemas/ui/transaction';
import {
DiscoverTransactionLink,
getDiscoverQuery
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionLink.test.tsx b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionLink.test.tsx
similarity index 88%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionLink.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionLink.test.tsx
index 15a92474fcc6d..2f65cf7734631 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionLink.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionLink.test.tsx
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { Transaction } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
+import { Transaction } from '../../../../../../typings/es_schemas/ui/transaction';
// @ts-ignore
import configureStore from '../../../../../store/config/configureStore';
import { getDiscoverQuery } from '../DiscoverTransactionLink';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/__snapshots__/DiscoverErrorButton.test.tsx.snap b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/__snapshots__/DiscoverErrorButton.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/__snapshots__/DiscoverErrorButton.test.tsx.snap
rename to x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/__snapshots__/DiscoverErrorButton.test.tsx.snap
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/__snapshots__/DiscoverErrorLink.test.tsx.snap b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/__snapshots__/DiscoverErrorLink.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/__snapshots__/DiscoverErrorLink.test.tsx.snap
rename to x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/__snapshots__/DiscoverErrorLink.test.tsx.snap
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/__snapshots__/DiscoverTransactionButton.test.tsx.snap b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/__snapshots__/DiscoverTransactionButton.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/__snapshots__/DiscoverTransactionButton.test.tsx.snap
rename to x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/__snapshots__/DiscoverTransactionButton.test.tsx.snap
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/__snapshots__/DiscoverTransactionLink.test.tsx.snap b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/__snapshots__/DiscoverTransactionLink.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/__snapshots__/DiscoverTransactionLink.test.tsx.snap
rename to x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/__snapshots__/DiscoverTransactionLink.test.tsx.snap
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/mockTransaction.json b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/mockTransaction.json
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/mockTransaction.json
rename to x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/mockTransaction.json
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/ElasticDocsLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/ElasticDocsLink.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/ElasticDocsLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/ElasticDocsLink.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/InfraLink.test.tsx b/x-pack/plugins/apm/public/components/shared/Links/InfraLink.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/InfraLink.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/InfraLink.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/InfraLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/InfraLink.tsx
similarity index 94%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/InfraLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/InfraLink.tsx
index 7efe5cb96cfbd..0ae9f64dc24ef 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/InfraLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/InfraLink.tsx
@@ -10,7 +10,7 @@ import url from 'url';
import { fromQuery } from './url_helpers';
import { useApmPluginContext } from '../../../hooks/useApmPluginContext';
import { AppMountContextBasePath } from '../../../context/ApmPluginContext';
-import { InfraAppId } from '../../../../../../../plugins/infra/public';
+import { InfraAppId } from '../../../../../infra/public';
interface InfraQueryParams {
time?: number;
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/KibanaLink.test.tsx b/x-pack/plugins/apm/public/components/shared/Links/KibanaLink.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/KibanaLink.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/KibanaLink.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/KibanaLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/KibanaLink.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/KibanaLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/KibanaLink.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLJobLink.test.tsx b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLJobLink.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLJobLink.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLJobLink.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLJobLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLJobLink.tsx
similarity index 88%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLJobLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLJobLink.tsx
index ecf788ddd2e69..81c5d17d491c0 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLJobLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLJobLink.tsx
@@ -5,7 +5,7 @@
*/
import React from 'react';
-import { getMlJobId } from '../../../../../../../../plugins/apm/common/ml_job_constants';
+import { getMlJobId } from '../../../../../common/ml_job_constants';
import { MLLink } from './MLLink';
interface Props {
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLLink.test.tsx b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLLink.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLLink.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLLink.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLLink.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLLink.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/SetupInstructionsLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/SetupInstructionsLink.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/SetupInstructionsLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/SetupInstructionsLink.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/APMLink.test.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/APMLink.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/apm/APMLink.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/apm/APMLink.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/APMLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/APMLink.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/apm/APMLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/apm/APMLink.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ErrorDetailLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/ErrorDetailLink.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ErrorDetailLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/apm/ErrorDetailLink.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ErrorOverviewLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/ErrorOverviewLink.tsx
similarity index 93%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ErrorOverviewLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/apm/ErrorOverviewLink.tsx
index fcc0dc7d26695..ebcf220994cda 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ErrorOverviewLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/apm/ErrorOverviewLink.tsx
@@ -6,7 +6,7 @@
import React from 'react';
import { APMLink, APMLinkExtendProps } from './APMLink';
import { useUrlParams } from '../../../../hooks/useUrlParams';
-import { pickKeys } from '../../../../utils/pickKeys';
+import { pickKeys } from '../../../../../common/utils/pick_keys';
import { APMQueryParams } from '../url_helpers';
interface Props extends APMLinkExtendProps {
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ExternalLinks.test.ts b/x-pack/plugins/apm/public/components/shared/Links/apm/ExternalLinks.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ExternalLinks.test.ts
rename to x-pack/plugins/apm/public/components/shared/Links/apm/ExternalLinks.test.ts
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ExternalLinks.ts b/x-pack/plugins/apm/public/components/shared/Links/apm/ExternalLinks.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ExternalLinks.ts
rename to x-pack/plugins/apm/public/components/shared/Links/apm/ExternalLinks.ts
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/HomeLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/HomeLink.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/apm/HomeLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/apm/HomeLink.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/MetricOverviewLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/MetricOverviewLink.tsx
similarity index 92%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/apm/MetricOverviewLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/apm/MetricOverviewLink.tsx
index 7d21e1efa44f2..bd3e3b36a8601 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/MetricOverviewLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/apm/MetricOverviewLink.tsx
@@ -6,7 +6,7 @@
import React from 'react';
import { APMLink, APMLinkExtendProps } from './APMLink';
import { useUrlParams } from '../../../../hooks/useUrlParams';
-import { pickKeys } from '../../../../utils/pickKeys';
+import { pickKeys } from '../../../../../common/utils/pick_keys';
interface Props extends APMLinkExtendProps {
serviceName: string;
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ServiceMapLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/ServiceMapLink.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ServiceMapLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/apm/ServiceMapLink.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ServiceNodeMetricOverviewLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/ServiceNodeMetricOverviewLink.tsx
similarity index 93%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ServiceNodeMetricOverviewLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/apm/ServiceNodeMetricOverviewLink.tsx
index 527c3da9e7e1c..1473221cca2be 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ServiceNodeMetricOverviewLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/apm/ServiceNodeMetricOverviewLink.tsx
@@ -6,7 +6,7 @@
import React from 'react';
import { APMLink, APMLinkExtendProps } from './APMLink';
import { useUrlParams } from '../../../../hooks/useUrlParams';
-import { pickKeys } from '../../../../utils/pickKeys';
+import { pickKeys } from '../../../../../common/utils/pick_keys';
interface Props extends APMLinkExtendProps {
serviceName: string;
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ServiceNodeOverviewLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/ServiceNodeOverviewLink.tsx
similarity index 92%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ServiceNodeOverviewLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/apm/ServiceNodeOverviewLink.tsx
index db1b6ec117bf4..b479ab77e1127 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ServiceNodeOverviewLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/apm/ServiceNodeOverviewLink.tsx
@@ -6,7 +6,7 @@
import React from 'react';
import { APMLink, APMLinkExtendProps } from './APMLink';
import { useUrlParams } from '../../../../hooks/useUrlParams';
-import { pickKeys } from '../../../../utils/pickKeys';
+import { pickKeys } from '../../../../../common/utils/pick_keys';
interface Props extends APMLinkExtendProps {
serviceName: string;
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ServiceOverviewLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/ServiceOverviewLink.tsx
similarity index 93%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ServiceOverviewLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/apm/ServiceOverviewLink.tsx
index 101f1602506aa..577209a26e46b 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/ServiceOverviewLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/apm/ServiceOverviewLink.tsx
@@ -12,7 +12,7 @@
import React from 'react';
import { APMLink, APMLinkExtendProps } from './APMLink';
import { useUrlParams } from '../../../../hooks/useUrlParams';
-import { pickKeys } from '../../../../utils/pickKeys';
+import { pickKeys } from '../../../../../common/utils/pick_keys';
const ServiceOverviewLink = (props: APMLinkExtendProps) => {
const { urlParams } = useUrlParams();
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/SettingsLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/SettingsLink.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/apm/SettingsLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/apm/SettingsLink.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/TraceOverviewLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/TraceOverviewLink.tsx
similarity index 93%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/apm/TraceOverviewLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/apm/TraceOverviewLink.tsx
index 371544c142a2d..dc4519365cbc2 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/TraceOverviewLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/apm/TraceOverviewLink.tsx
@@ -12,7 +12,7 @@
import React from 'react';
import { APMLink, APMLinkExtendProps } from './APMLink';
import { useUrlParams } from '../../../../hooks/useUrlParams';
-import { pickKeys } from '../../../../utils/pickKeys';
+import { pickKeys } from '../../../../../common/utils/pick_keys';
const TraceOverviewLink = (props: APMLinkExtendProps) => {
const { urlParams } = useUrlParams();
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/TransactionDetailLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/TransactionDetailLink.tsx
similarity index 94%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/apm/TransactionDetailLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/apm/TransactionDetailLink.tsx
index 784f9b36ff621..6278336751851 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/TransactionDetailLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/apm/TransactionDetailLink.tsx
@@ -7,7 +7,7 @@
import React from 'react';
import { APMLink, APMLinkExtendProps } from './APMLink';
import { useUrlParams } from '../../../../hooks/useUrlParams';
-import { pickKeys } from '../../../../utils/pickKeys';
+import { pickKeys } from '../../../../../common/utils/pick_keys';
interface Props extends APMLinkExtendProps {
serviceName: string;
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/TransactionOverviewLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/TransactionOverviewLink.tsx
similarity index 93%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/apm/TransactionOverviewLink.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/apm/TransactionOverviewLink.tsx
index af60a0a748445..ccef83ee73fb8 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/TransactionOverviewLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/apm/TransactionOverviewLink.tsx
@@ -6,7 +6,7 @@
import React from 'react';
import { APMLink, APMLinkExtendProps } from './APMLink';
import { useUrlParams } from '../../../../hooks/useUrlParams';
-import { pickKeys } from '../../../../utils/pickKeys';
+import { pickKeys } from '../../../../../common/utils/pick_keys';
interface Props extends APMLinkExtendProps {
serviceName: string;
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/agentConfigurationLinks.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/agentConfigurationLinks.tsx
similarity index 87%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/apm/agentConfigurationLinks.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/apm/agentConfigurationLinks.tsx
index 0c747e0773a69..6885e44f1ad1f 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/apm/agentConfigurationLinks.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/apm/agentConfigurationLinks.tsx
@@ -5,7 +5,7 @@
*/
import { getAPMHref } from './APMLink';
-import { AgentConfigurationIntake } from '../../../../../../../../plugins/apm/common/agent_configuration/configuration_types';
+import { AgentConfigurationIntake } from '../../../../../common/agent_configuration/configuration_types';
import { history } from '../../../../utils/history';
export function editAgentConfigurationHref(
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/rison_helpers.ts b/x-pack/plugins/apm/public/components/shared/Links/rison_helpers.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/rison_helpers.ts
rename to x-pack/plugins/apm/public/components/shared/Links/rison_helpers.ts
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/url_helpers.test.tsx b/x-pack/plugins/apm/public/components/shared/Links/url_helpers.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/url_helpers.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Links/url_helpers.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/url_helpers.ts b/x-pack/plugins/apm/public/components/shared/Links/url_helpers.ts
similarity index 87%
rename from x-pack/legacy/plugins/apm/public/components/shared/Links/url_helpers.ts
rename to x-pack/plugins/apm/public/components/shared/Links/url_helpers.ts
index c7d71d0b6dac5..b296302c47edf 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Links/url_helpers.ts
+++ b/x-pack/plugins/apm/public/components/shared/Links/url_helpers.ts
@@ -6,8 +6,8 @@
import { parse, stringify } from 'query-string';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { LocalUIFilterName } from '../../../../../../../plugins/apm/server/lib/ui_filters/local_ui_filters/config';
-import { url } from '../../../../../../../../src/plugins/kibana_utils/public';
+import { LocalUIFilterName } from '../../../../server/lib/ui_filters/local_ui_filters/config';
+import { url } from '../../../../../../../src/plugins/kibana_utils/public';
export function toQuery(search?: string): APMQueryParamsRaw {
return search ? parse(search.slice(1), { sort: false }) : {};
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/LoadingStatePrompt.tsx b/x-pack/plugins/apm/public/components/shared/LoadingStatePrompt.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/LoadingStatePrompt.tsx
rename to x-pack/plugins/apm/public/components/shared/LoadingStatePrompt.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/LocalUIFilters/Filter/FilterBadgeList.tsx b/x-pack/plugins/apm/public/components/shared/LocalUIFilters/Filter/FilterBadgeList.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/LocalUIFilters/Filter/FilterBadgeList.tsx
rename to x-pack/plugins/apm/public/components/shared/LocalUIFilters/Filter/FilterBadgeList.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/LocalUIFilters/Filter/FilterTitleButton.tsx b/x-pack/plugins/apm/public/components/shared/LocalUIFilters/Filter/FilterTitleButton.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/LocalUIFilters/Filter/FilterTitleButton.tsx
rename to x-pack/plugins/apm/public/components/shared/LocalUIFilters/Filter/FilterTitleButton.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/LocalUIFilters/Filter/index.tsx b/x-pack/plugins/apm/public/components/shared/LocalUIFilters/Filter/index.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/LocalUIFilters/Filter/index.tsx
rename to x-pack/plugins/apm/public/components/shared/LocalUIFilters/Filter/index.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/LocalUIFilters/TransactionTypeFilter/index.tsx b/x-pack/plugins/apm/public/components/shared/LocalUIFilters/TransactionTypeFilter/index.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/LocalUIFilters/TransactionTypeFilter/index.tsx
rename to x-pack/plugins/apm/public/components/shared/LocalUIFilters/TransactionTypeFilter/index.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/LocalUIFilters/index.tsx b/x-pack/plugins/apm/public/components/shared/LocalUIFilters/index.tsx
similarity index 91%
rename from x-pack/legacy/plugins/apm/public/components/shared/LocalUIFilters/index.tsx
rename to x-pack/plugins/apm/public/components/shared/LocalUIFilters/index.tsx
index cede3e394cfab..2c755009ed13a 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/LocalUIFilters/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/LocalUIFilters/index.tsx
@@ -14,10 +14,10 @@ import {
import { i18n } from '@kbn/i18n';
import styled from 'styled-components';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { LocalUIFilterName } from '../../../../../../../plugins/apm/server/lib/ui_filters/local_ui_filters/config';
+import { LocalUIFilterName } from '../../../../server/lib/ui_filters/local_ui_filters/config';
import { Filter } from './Filter';
import { useLocalUIFilters } from '../../../hooks/useLocalUIFilters';
-import { PROJECTION } from '../../../../../../../plugins/apm/common/projections/typings';
+import { PROJECTION } from '../../../../common/projections/typings';
interface Props {
projection: PROJECTION;
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/ManagedTable/__test__/ManagedTable.test.js b/x-pack/plugins/apm/public/components/shared/ManagedTable/__test__/ManagedTable.test.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/ManagedTable/__test__/ManagedTable.test.js
rename to x-pack/plugins/apm/public/components/shared/ManagedTable/__test__/ManagedTable.test.js
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/ManagedTable/__test__/__snapshots__/ManagedTable.test.js.snap b/x-pack/plugins/apm/public/components/shared/ManagedTable/__test__/__snapshots__/ManagedTable.test.js.snap
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/ManagedTable/__test__/__snapshots__/ManagedTable.test.js.snap
rename to x-pack/plugins/apm/public/components/shared/ManagedTable/__test__/__snapshots__/ManagedTable.test.js.snap
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/ManagedTable/index.tsx b/x-pack/plugins/apm/public/components/shared/ManagedTable/index.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/ManagedTable/index.tsx
rename to x-pack/plugins/apm/public/components/shared/ManagedTable/index.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/__test__/ErrorMetadata.test.tsx b/x-pack/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/__test__/ErrorMetadata.test.tsx
similarity index 97%
rename from x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/__test__/ErrorMetadata.test.tsx
rename to x-pack/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/__test__/ErrorMetadata.test.tsx
index 258788252379a..1913cf79c7935 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/__test__/ErrorMetadata.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/__test__/ErrorMetadata.test.tsx
@@ -7,7 +7,7 @@
import React from 'react';
import { ErrorMetadata } from '..';
import { render } from '@testing-library/react';
-import { APMError } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error';
+import { APMError } from '../../../../../../typings/es_schemas/ui/apm_error';
import {
expectTextsInDocument,
expectTextsNotInDocument
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/index.tsx b/x-pack/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/index.tsx
similarity index 87%
rename from x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/index.tsx
rename to x-pack/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/index.tsx
index ce991d8b0dc00..7cae42a94322b 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/index.tsx
@@ -6,7 +6,7 @@
import React, { useMemo } from 'react';
import { ERROR_METADATA_SECTIONS } from './sections';
-import { APMError } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error';
+import { APMError } from '../../../../../typings/es_schemas/ui/apm_error';
import { getSectionsWithRows } from '../helper';
import { MetadataTable } from '..';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/sections.ts b/x-pack/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/sections.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/sections.ts
rename to x-pack/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/sections.ts
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/Section.tsx b/x-pack/plugins/apm/public/components/shared/MetadataTable/Section.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/Section.tsx
rename to x-pack/plugins/apm/public/components/shared/MetadataTable/Section.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/__test__/SpanMetadata.test.tsx b/x-pack/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/__test__/SpanMetadata.test.tsx
similarity index 96%
rename from x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/__test__/SpanMetadata.test.tsx
rename to x-pack/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/__test__/SpanMetadata.test.tsx
index 0059b7b8fb4b3..a46539fe72fcb 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/__test__/SpanMetadata.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/__test__/SpanMetadata.test.tsx
@@ -7,7 +7,7 @@
import React from 'react';
import { render } from '@testing-library/react';
import { SpanMetadata } from '..';
-import { Span } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/span';
+import { Span } from '../../../../../../typings/es_schemas/ui/span';
import {
expectTextsInDocument,
expectTextsNotInDocument
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/index.tsx b/x-pack/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/index.tsx
similarity index 88%
rename from x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/index.tsx
rename to x-pack/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/index.tsx
index 2134f12531a7a..abef083e39b9e 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/index.tsx
@@ -6,7 +6,7 @@
import React, { useMemo } from 'react';
import { SPAN_METADATA_SECTIONS } from './sections';
-import { Span } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/span';
+import { Span } from '../../../../../typings/es_schemas/ui/span';
import { getSectionsWithRows } from '../helper';
import { MetadataTable } from '..';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/sections.ts b/x-pack/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/sections.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/sections.ts
rename to x-pack/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/sections.ts
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/__test__/TransactionMetadata.test.tsx b/x-pack/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/__test__/TransactionMetadata.test.tsx
similarity index 97%
rename from x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/__test__/TransactionMetadata.test.tsx
rename to x-pack/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/__test__/TransactionMetadata.test.tsx
index 3d78f36db9786..8ae46d359efc3 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/__test__/TransactionMetadata.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/__test__/TransactionMetadata.test.tsx
@@ -7,7 +7,7 @@
import React from 'react';
import { TransactionMetadata } from '..';
import { render } from '@testing-library/react';
-import { Transaction } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
+import { Transaction } from '../../../../../../typings/es_schemas/ui/transaction';
import {
expectTextsInDocument,
expectTextsNotInDocument
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/index.tsx b/x-pack/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/index.tsx
similarity index 87%
rename from x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/index.tsx
rename to x-pack/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/index.tsx
index 6f93de4e87e49..86ecbba6a0aaa 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/index.tsx
@@ -6,7 +6,7 @@
import React, { useMemo } from 'react';
import { TRANSACTION_METADATA_SECTIONS } from './sections';
-import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
+import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
import { getSectionsWithRows } from '../helper';
import { MetadataTable } from '..';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/sections.ts b/x-pack/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/sections.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/sections.ts
rename to x-pack/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/sections.ts
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/__test__/MetadataTable.test.tsx b/x-pack/plugins/apm/public/components/shared/MetadataTable/__test__/MetadataTable.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/__test__/MetadataTable.test.tsx
rename to x-pack/plugins/apm/public/components/shared/MetadataTable/__test__/MetadataTable.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/__test__/Section.test.tsx b/x-pack/plugins/apm/public/components/shared/MetadataTable/__test__/Section.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/__test__/Section.test.tsx
rename to x-pack/plugins/apm/public/components/shared/MetadataTable/__test__/Section.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/__test__/helper.test.ts b/x-pack/plugins/apm/public/components/shared/MetadataTable/__test__/helper.test.ts
similarity index 96%
rename from x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/__test__/helper.test.ts
rename to x-pack/plugins/apm/public/components/shared/MetadataTable/__test__/helper.test.ts
index b65b52bf30a5c..e754f7163ca11 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/__test__/helper.test.ts
+++ b/x-pack/plugins/apm/public/components/shared/MetadataTable/__test__/helper.test.ts
@@ -6,7 +6,7 @@
import { getSectionsWithRows, filterSectionsByTerm } from '../helper';
import { LABELS, HTTP, SERVICE } from '../sections';
-import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
+import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
describe('MetadataTable Helper', () => {
const sections = [
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/helper.ts b/x-pack/plugins/apm/public/components/shared/MetadataTable/helper.ts
similarity index 85%
rename from x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/helper.ts
rename to x-pack/plugins/apm/public/components/shared/MetadataTable/helper.ts
index ef329abafa61b..a8678ee596e43 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/helper.ts
+++ b/x-pack/plugins/apm/public/components/shared/MetadataTable/helper.ts
@@ -6,9 +6,9 @@
import { get, pick, isEmpty } from 'lodash';
import { Section } from './sections';
-import { Transaction } from '../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
-import { APMError } from '../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error';
-import { Span } from '../../../../../../../plugins/apm/typings/es_schemas/ui/span';
+import { Transaction } from '../../../../typings/es_schemas/ui/transaction';
+import { APMError } from '../../../../typings/es_schemas/ui/apm_error';
+import { Span } from '../../../../typings/es_schemas/ui/span';
import { flattenObject, KeyValuePair } from '../../../utils/flattenObject';
export type SectionsWithRows = ReturnType
;
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/index.tsx b/x-pack/plugins/apm/public/components/shared/MetadataTable/index.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/index.tsx
rename to x-pack/plugins/apm/public/components/shared/MetadataTable/index.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/sections.ts b/x-pack/plugins/apm/public/components/shared/MetadataTable/sections.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/sections.ts
rename to x-pack/plugins/apm/public/components/shared/MetadataTable/sections.ts
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/SelectWithPlaceholder/index.tsx b/x-pack/plugins/apm/public/components/shared/SelectWithPlaceholder/index.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/SelectWithPlaceholder/index.tsx
rename to x-pack/plugins/apm/public/components/shared/SelectWithPlaceholder/index.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/ServiceAlertTrigger/PopoverExpression/index.tsx b/x-pack/plugins/apm/public/components/shared/ServiceAlertTrigger/PopoverExpression/index.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/ServiceAlertTrigger/PopoverExpression/index.tsx
rename to x-pack/plugins/apm/public/components/shared/ServiceAlertTrigger/PopoverExpression/index.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/ServiceAlertTrigger/index.tsx b/x-pack/plugins/apm/public/components/shared/ServiceAlertTrigger/index.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/ServiceAlertTrigger/index.tsx
rename to x-pack/plugins/apm/public/components/shared/ServiceAlertTrigger/index.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/CauseStacktrace.test.tsx b/x-pack/plugins/apm/public/components/shared/Stacktrace/CauseStacktrace.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/CauseStacktrace.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Stacktrace/CauseStacktrace.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/CauseStacktrace.tsx b/x-pack/plugins/apm/public/components/shared/Stacktrace/CauseStacktrace.tsx
similarity index 95%
rename from x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/CauseStacktrace.tsx
rename to x-pack/plugins/apm/public/components/shared/Stacktrace/CauseStacktrace.tsx
index eab414ad47c2c..6dfc8778fe1fc 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/CauseStacktrace.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Stacktrace/CauseStacktrace.tsx
@@ -11,7 +11,7 @@ import { i18n } from '@kbn/i18n';
import { EuiAccordion, EuiTitle } from '@elastic/eui';
import { px, unit } from '../../../style/variables';
import { Stacktrace } from '.';
-import { IStackframe } from '../../../../../../../plugins/apm/typings/es_schemas/raw/fields/stackframe';
+import { IStackframe } from '../../../../typings/es_schemas/raw/fields/stackframe';
// @ts-ignore Styled Components has trouble inferring the types of the default props here.
const Accordion = styled(EuiAccordion)`
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Context.tsx b/x-pack/plugins/apm/public/components/shared/Stacktrace/Context.tsx
similarity index 97%
rename from x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Context.tsx
rename to x-pack/plugins/apm/public/components/shared/Stacktrace/Context.tsx
index d289539ca44b1..d48f4b4f51a6a 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Context.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Stacktrace/Context.tsx
@@ -22,7 +22,7 @@ import { registerLanguage } from 'react-syntax-highlighter/dist/light';
// @ts-ignore
import { xcode } from 'react-syntax-highlighter/dist/styles';
import styled from 'styled-components';
-import { IStackframeWithLineContext } from '../../../../../../../plugins/apm/typings/es_schemas/raw/fields/stackframe';
+import { IStackframeWithLineContext } from '../../../../typings/es_schemas/raw/fields/stackframe';
import { borderRadius, px, unit, units } from '../../../style/variables';
registerLanguage('javascript', javascript);
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/FrameHeading.tsx b/x-pack/plugins/apm/public/components/shared/Stacktrace/FrameHeading.tsx
similarity index 93%
rename from x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/FrameHeading.tsx
rename to x-pack/plugins/apm/public/components/shared/Stacktrace/FrameHeading.tsx
index daa722255bdf3..4467fe7ad615e 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/FrameHeading.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Stacktrace/FrameHeading.tsx
@@ -7,7 +7,7 @@
import theme from '@elastic/eui/dist/eui_theme_light.json';
import React, { Fragment } from 'react';
import styled from 'styled-components';
-import { IStackframe } from '../../../../../../../plugins/apm/typings/es_schemas/raw/fields/stackframe';
+import { IStackframe } from '../../../../typings/es_schemas/raw/fields/stackframe';
import { fontFamilyCode, fontSize, px, units } from '../../../style/variables';
const FileDetails = styled.div`
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/LibraryStacktrace.test.tsx b/x-pack/plugins/apm/public/components/shared/Stacktrace/LibraryStacktrace.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/LibraryStacktrace.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Stacktrace/LibraryStacktrace.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/LibraryStacktrace.tsx b/x-pack/plugins/apm/public/components/shared/Stacktrace/LibraryStacktrace.tsx
similarity index 93%
rename from x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/LibraryStacktrace.tsx
rename to x-pack/plugins/apm/public/components/shared/Stacktrace/LibraryStacktrace.tsx
index be6595153aa77..009e97358428c 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/LibraryStacktrace.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Stacktrace/LibraryStacktrace.tsx
@@ -8,7 +8,7 @@ import { EuiAccordion } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
import styled from 'styled-components';
-import { IStackframe } from '../../../../../../../plugins/apm/typings/es_schemas/raw/fields/stackframe';
+import { IStackframe } from '../../../../typings/es_schemas/raw/fields/stackframe';
import { Stackframe } from './Stackframe';
import { px, unit } from '../../../style/variables';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Stackframe.tsx b/x-pack/plugins/apm/public/components/shared/Stacktrace/Stackframe.tsx
similarity index 96%
rename from x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Stackframe.tsx
rename to x-pack/plugins/apm/public/components/shared/Stacktrace/Stackframe.tsx
index 404d474a7960a..4c55add56bc40 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Stackframe.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Stacktrace/Stackframe.tsx
@@ -11,7 +11,7 @@ import { EuiAccordion } from '@elastic/eui';
import {
IStackframe,
IStackframeWithLineContext
-} from '../../../../../../../plugins/apm/typings/es_schemas/raw/fields/stackframe';
+} from '../../../../typings/es_schemas/raw/fields/stackframe';
import {
borderRadius,
fontFamilyCode,
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Variables.tsx b/x-pack/plugins/apm/public/components/shared/Stacktrace/Variables.tsx
similarity index 93%
rename from x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Variables.tsx
rename to x-pack/plugins/apm/public/components/shared/Stacktrace/Variables.tsx
index 0786116a659c7..ec5fb39f83f8c 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Variables.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Stacktrace/Variables.tsx
@@ -10,7 +10,7 @@ import { EuiAccordion } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { borderRadius, px, unit, units } from '../../../style/variables';
-import { IStackframe } from '../../../../../../../plugins/apm/typings/es_schemas/raw/fields/stackframe';
+import { IStackframe } from '../../../../typings/es_schemas/raw/fields/stackframe';
import { KeyValueTable } from '../KeyValueTable';
import { flattenObject } from '../../../utils/flattenObject';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/Stackframe.test.tsx b/x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/Stackframe.test.tsx
similarity index 95%
rename from x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/Stackframe.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/Stackframe.test.tsx
index 1b2268326e6be..478f9cfe921d9 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/Stackframe.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/Stackframe.test.tsx
@@ -6,7 +6,7 @@
import { mount, ReactWrapper, shallow } from 'enzyme';
import React from 'react';
-import { IStackframe } from '../../../../../../../../plugins/apm/typings/es_schemas/raw/fields/stackframe';
+import { IStackframe } from '../../../../../typings/es_schemas/raw/fields/stackframe';
import { Stackframe } from '../Stackframe';
import stacktracesMock from './stacktraces.json';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/__snapshots__/Stackframe.test.tsx.snap b/x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/__snapshots__/Stackframe.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/__snapshots__/Stackframe.test.tsx.snap
rename to x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/__snapshots__/Stackframe.test.tsx.snap
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/__snapshots__/index.test.ts.snap b/x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/__snapshots__/index.test.ts.snap
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/__snapshots__/index.test.ts.snap
rename to x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/__snapshots__/index.test.ts.snap
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/index.test.ts b/x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/index.test.ts
similarity index 97%
rename from x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/index.test.ts
rename to x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/index.test.ts
index 9b6d74033e1c5..22357b9590887 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/index.test.ts
+++ b/x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/index.test.ts
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { IStackframe } from '../../../../../../../../plugins/apm/typings/es_schemas/raw/fields/stackframe';
+import { IStackframe } from '../../../../../typings/es_schemas/raw/fields/stackframe';
import { getGroupedStackframes } from '../index';
import stacktracesMock from './stacktraces.json';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/stacktraces.json b/x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/stacktraces.json
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/stacktraces.json
rename to x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/stacktraces.json
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/index.tsx b/x-pack/plugins/apm/public/components/shared/Stacktrace/index.tsx
similarity index 96%
rename from x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/index.tsx
rename to x-pack/plugins/apm/public/components/shared/Stacktrace/index.tsx
index 141ed544a6166..b6435f7c42183 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Stacktrace/index.tsx
@@ -8,7 +8,7 @@ import { EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { isEmpty, last } from 'lodash';
import React, { Fragment } from 'react';
-import { IStackframe } from '../../../../../../../plugins/apm/typings/es_schemas/raw/fields/stackframe';
+import { IStackframe } from '../../../../typings/es_schemas/raw/fields/stackframe';
import { EmptyMessage } from '../../shared/EmptyMessage';
import { LibraryStacktrace } from './LibraryStacktrace';
import { Stackframe } from './Stackframe';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/StickyProperties/StickyProperties.test.js b/x-pack/plugins/apm/public/components/shared/StickyProperties/StickyProperties.test.js
similarity index 95%
rename from x-pack/legacy/plugins/apm/public/components/shared/StickyProperties/StickyProperties.test.js
rename to x-pack/plugins/apm/public/components/shared/StickyProperties/StickyProperties.test.js
index 08283dee3825d..b6acb6904f865 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/StickyProperties/StickyProperties.test.js
+++ b/x-pack/plugins/apm/public/components/shared/StickyProperties/StickyProperties.test.js
@@ -7,10 +7,7 @@
import React from 'react';
import { StickyProperties } from './index';
import { shallow } from 'enzyme';
-import {
- USER_ID,
- URL_FULL
-} from '../../../../../../../plugins/apm/common/elasticsearch_fieldnames';
+import { USER_ID, URL_FULL } from '../../../../common/elasticsearch_fieldnames';
import { mockMoment } from '../../../utils/testHelpers';
describe('StickyProperties', () => {
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/StickyProperties/__snapshots__/StickyProperties.test.js.snap b/x-pack/plugins/apm/public/components/shared/StickyProperties/__snapshots__/StickyProperties.test.js.snap
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/StickyProperties/__snapshots__/StickyProperties.test.js.snap
rename to x-pack/plugins/apm/public/components/shared/StickyProperties/__snapshots__/StickyProperties.test.js.snap
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/StickyProperties/index.tsx b/x-pack/plugins/apm/public/components/shared/StickyProperties/index.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/StickyProperties/index.tsx
rename to x-pack/plugins/apm/public/components/shared/StickyProperties/index.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/DurationSummaryItem.tsx b/x-pack/plugins/apm/public/components/shared/Summary/DurationSummaryItem.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Summary/DurationSummaryItem.tsx
rename to x-pack/plugins/apm/public/components/shared/Summary/DurationSummaryItem.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/ErrorCountSummaryItemBadge.tsx b/x-pack/plugins/apm/public/components/shared/Summary/ErrorCountSummaryItemBadge.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Summary/ErrorCountSummaryItemBadge.tsx
rename to x-pack/plugins/apm/public/components/shared/Summary/ErrorCountSummaryItemBadge.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/HttpInfoSummaryItem/__test__/HttpInfoSummaryItem.test.tsx b/x-pack/plugins/apm/public/components/shared/Summary/HttpInfoSummaryItem/__test__/HttpInfoSummaryItem.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Summary/HttpInfoSummaryItem/__test__/HttpInfoSummaryItem.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Summary/HttpInfoSummaryItem/__test__/HttpInfoSummaryItem.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/HttpInfoSummaryItem/index.tsx b/x-pack/plugins/apm/public/components/shared/Summary/HttpInfoSummaryItem/index.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Summary/HttpInfoSummaryItem/index.tsx
rename to x-pack/plugins/apm/public/components/shared/Summary/HttpInfoSummaryItem/index.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/HttpStatusBadge/__test__/HttpStatusBadge.test.tsx b/x-pack/plugins/apm/public/components/shared/Summary/HttpStatusBadge/__test__/HttpStatusBadge.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Summary/HttpStatusBadge/__test__/HttpStatusBadge.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Summary/HttpStatusBadge/__test__/HttpStatusBadge.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/HttpStatusBadge/index.tsx b/x-pack/plugins/apm/public/components/shared/Summary/HttpStatusBadge/index.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Summary/HttpStatusBadge/index.tsx
rename to x-pack/plugins/apm/public/components/shared/Summary/HttpStatusBadge/index.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/HttpStatusBadge/statusCodes.ts b/x-pack/plugins/apm/public/components/shared/Summary/HttpStatusBadge/statusCodes.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Summary/HttpStatusBadge/statusCodes.ts
rename to x-pack/plugins/apm/public/components/shared/Summary/HttpStatusBadge/statusCodes.ts
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/TransactionResultSummaryItem.tsx b/x-pack/plugins/apm/public/components/shared/Summary/TransactionResultSummaryItem.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Summary/TransactionResultSummaryItem.tsx
rename to x-pack/plugins/apm/public/components/shared/Summary/TransactionResultSummaryItem.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/TransactionSummary.test.tsx b/x-pack/plugins/apm/public/components/shared/Summary/TransactionSummary.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Summary/TransactionSummary.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Summary/TransactionSummary.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/TransactionSummary.tsx b/x-pack/plugins/apm/public/components/shared/Summary/TransactionSummary.tsx
similarity index 91%
rename from x-pack/legacy/plugins/apm/public/components/shared/Summary/TransactionSummary.tsx
rename to x-pack/plugins/apm/public/components/shared/Summary/TransactionSummary.tsx
index f0fe57e46f2fe..f24a806426510 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Summary/TransactionSummary.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Summary/TransactionSummary.tsx
@@ -4,12 +4,12 @@
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
-import { Transaction } from '../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
+import { Transaction } from '../../../../typings/es_schemas/ui/transaction';
import { Summary } from './';
import { TimestampTooltip } from '../TimestampTooltip';
import { DurationSummaryItem } from './DurationSummaryItem';
import { ErrorCountSummaryItemBadge } from './ErrorCountSummaryItemBadge';
-import { isRumAgentName } from '../../../../../../../plugins/apm/common/agent_name';
+import { isRumAgentName } from '../../../../common/agent_name';
import { HttpInfoSummaryItem } from './HttpInfoSummaryItem';
import { TransactionResultSummaryItem } from './TransactionResultSummaryItem';
import { UserAgentSummaryItem } from './UserAgentSummaryItem';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/UserAgentSummaryItem.test.tsx b/x-pack/plugins/apm/public/components/shared/Summary/UserAgentSummaryItem.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Summary/UserAgentSummaryItem.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Summary/UserAgentSummaryItem.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/UserAgentSummaryItem.tsx b/x-pack/plugins/apm/public/components/shared/Summary/UserAgentSummaryItem.tsx
similarity index 90%
rename from x-pack/legacy/plugins/apm/public/components/shared/Summary/UserAgentSummaryItem.tsx
rename to x-pack/plugins/apm/public/components/shared/Summary/UserAgentSummaryItem.tsx
index 10a6bcc1ef7bd..8173170b72f23 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Summary/UserAgentSummaryItem.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Summary/UserAgentSummaryItem.tsx
@@ -9,7 +9,7 @@ import styled from 'styled-components';
import theme from '@elastic/eui/dist/eui_theme_light.json';
import { EuiToolTip } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
-import { UserAgent } from '../../../../../../../plugins/apm/typings/es_schemas/raw/fields/user_agent';
+import { UserAgent } from '../../../../typings/es_schemas/raw/fields/user_agent';
type UserAgentSummaryItemProps = UserAgent;
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/__fixtures__/transactions.ts b/x-pack/plugins/apm/public/components/shared/Summary/__fixtures__/transactions.ts
similarity index 92%
rename from x-pack/legacy/plugins/apm/public/components/shared/Summary/__fixtures__/transactions.ts
rename to x-pack/plugins/apm/public/components/shared/Summary/__fixtures__/transactions.ts
index 05fb73a9e2749..e1615934cd92e 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Summary/__fixtures__/transactions.ts
+++ b/x-pack/plugins/apm/public/components/shared/Summary/__fixtures__/transactions.ts
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
+import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
export const httpOk: Transaction = {
'@timestamp': '0',
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/__test__/ErrorCountSummaryItemBadge.test.tsx b/x-pack/plugins/apm/public/components/shared/Summary/__test__/ErrorCountSummaryItemBadge.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/Summary/__test__/ErrorCountSummaryItemBadge.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Summary/__test__/ErrorCountSummaryItemBadge.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/index.tsx b/x-pack/plugins/apm/public/components/shared/Summary/index.tsx
similarity index 94%
rename from x-pack/legacy/plugins/apm/public/components/shared/Summary/index.tsx
rename to x-pack/plugins/apm/public/components/shared/Summary/index.tsx
index ef99f3a4933a7..ce6935d1858aa 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/Summary/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Summary/index.tsx
@@ -8,7 +8,7 @@ import { EuiFlexGrid, EuiFlexItem } from '@elastic/eui';
import styled from 'styled-components';
import euiLightVars from '@elastic/eui/dist/eui_theme_light.json';
import { px, units } from '../../../../public/style/variables';
-import { Maybe } from '../../../../../../../plugins/apm/typings/common';
+import { Maybe } from '../../../../typings/common';
interface Props {
items: Array>;
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TimestampTooltip/__test__/index.test.tsx b/x-pack/plugins/apm/public/components/shared/TimestampTooltip/__test__/index.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/TimestampTooltip/__test__/index.test.tsx
rename to x-pack/plugins/apm/public/components/shared/TimestampTooltip/__test__/index.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TimestampTooltip/index.tsx b/x-pack/plugins/apm/public/components/shared/TimestampTooltip/index.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/TimestampTooltip/index.tsx
rename to x-pack/plugins/apm/public/components/shared/TimestampTooltip/index.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkPopover.test.tsx b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkPopover.test.tsx
similarity index 91%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkPopover.test.tsx
rename to x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkPopover.test.tsx
index 8df6d952cfacd..49f8fddb303bd 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkPopover.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkPopover.test.tsx
@@ -5,10 +5,10 @@
*/
import React from 'react';
import { render, act, fireEvent } from '@testing-library/react';
-import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
+import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
import { CustomLinkPopover } from './CustomLinkPopover';
import { expectTextsInDocument } from '../../../../utils/testHelpers';
-import { CustomLink } from '../../../../../../../../plugins/apm/common/custom_link/custom_link_types';
+import { CustomLink } from '../../../../../common/custom_link/custom_link_types';
describe('CustomLinkPopover', () => {
const customLinks = [
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkPopover.tsx b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkPopover.tsx
similarity index 90%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkPopover.tsx
rename to x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkPopover.tsx
index 3aed1b7ac2953..a63c226a5c46e 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkPopover.tsx
+++ b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkPopover.tsx
@@ -12,8 +12,8 @@ import {
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import styled from 'styled-components';
-import { CustomLink } from '../../../../../../../../plugins/apm/common/custom_link/custom_link_types';
-import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
+import { CustomLink } from '../../../../../common/custom_link/custom_link_types';
+import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
import { CustomLinkSection } from './CustomLinkSection';
import { ManageCustomLink } from './ManageCustomLink';
import { px } from '../../../../style/variables';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkSection.test.tsx b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkSection.test.tsx
similarity index 85%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkSection.test.tsx
rename to x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkSection.test.tsx
index d429fa56894eb..6cf8b9ee5e98a 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkSection.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkSection.test.tsx
@@ -10,8 +10,8 @@ import {
expectTextsInDocument,
expectTextsNotInDocument
} from '../../../../utils/testHelpers';
-import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
-import { CustomLink } from '../../../../../../../../plugins/apm/common/custom_link/custom_link_types';
+import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
+import { CustomLink } from '../../../../../common/custom_link/custom_link_types';
describe('CustomLinkSection', () => {
const customLinks = [
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkSection.tsx b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkSection.tsx
similarity index 86%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkSection.tsx
rename to x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkSection.tsx
index bd00bcf600ffe..e22f4b4a37745 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkSection.tsx
+++ b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/CustomLinkSection.tsx
@@ -7,8 +7,8 @@ import { EuiLink, EuiText } from '@elastic/eui';
import Mustache from 'mustache';
import React from 'react';
import styled from 'styled-components';
-import { CustomLink } from '../../../../../../../../plugins/apm/common/custom_link/custom_link_types';
-import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
+import { CustomLink } from '../../../../../common/custom_link/custom_link_types';
+import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
import { px, truncate, units } from '../../../../style/variables';
const LinkContainer = styled.li`
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/ManageCustomLink.test.tsx b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/ManageCustomLink.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/ManageCustomLink.test.tsx
rename to x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/ManageCustomLink.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/ManageCustomLink.tsx b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/ManageCustomLink.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/ManageCustomLink.tsx
rename to x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/ManageCustomLink.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/index.test.tsx b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/index.test.tsx
similarity index 94%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/index.test.tsx
rename to x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/index.test.tsx
index 9d1eeb9a3136d..c7a2d77d85fa6 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/index.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/index.test.tsx
@@ -7,13 +7,13 @@
import React from 'react';
import { render, act, fireEvent } from '@testing-library/react';
import { CustomLink } from '.';
-import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
+import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
import { FETCH_STATUS } from '../../../../hooks/useFetcher';
import {
expectTextsInDocument,
expectTextsNotInDocument
} from '../../../../utils/testHelpers';
-import { CustomLink as CustomLinkType } from '../../../../../../../../plugins/apm/common/custom_link/custom_link_types';
+import { CustomLink as CustomLinkType } from '../../../../../common/custom_link/custom_link_types';
describe('Custom links', () => {
it('shows empty message when no custom link is available', () => {
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/index.tsx b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/index.tsx
similarity index 92%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/index.tsx
rename to x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/index.tsx
index 38b672a181fce..710b2175e3377 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLink/index.tsx
@@ -15,12 +15,12 @@ import {
import { i18n } from '@kbn/i18n';
import styled from 'styled-components';
import { isEmpty } from 'lodash';
-import { CustomLink as CustomLinkType } from '../../../../../../../../plugins/apm/common/custom_link/custom_link_types';
-import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
+import { CustomLink as CustomLinkType } from '../../../../../common/custom_link/custom_link_types';
+import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
import {
ActionMenuDivider,
SectionSubtitle
-} from '../../../../../../../../plugins/observability/public';
+} from '../../../../../../observability/public';
import { CustomLinkSection } from './CustomLinkSection';
import { ManageCustomLink } from './ManageCustomLink';
import { FETCH_STATUS } from '../../../../hooks/useFetcher';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/TransactionActionMenu.tsx b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/TransactionActionMenu.tsx
similarity index 95%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/TransactionActionMenu.tsx
rename to x-pack/plugins/apm/public/components/shared/TransactionActionMenu/TransactionActionMenu.tsx
index 7ebfe26b83630..c9376cdc01b5b 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/TransactionActionMenu.tsx
+++ b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/TransactionActionMenu.tsx
@@ -7,8 +7,8 @@
import { EuiButtonEmpty } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React, { FunctionComponent, useMemo, useState } from 'react';
-import { Filter } from '../../../../../../../plugins/apm/common/custom_link/custom_link_types';
-import { Transaction } from '../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
+import { Filter } from '../../../../common/custom_link/custom_link_types';
+import { Transaction } from '../../../../typings/es_schemas/ui/transaction';
import {
ActionMenu,
ActionMenuDivider,
@@ -17,7 +17,7 @@ import {
SectionLinks,
SectionSubtitle,
SectionTitle
-} from '../../../../../../../plugins/observability/public';
+} from '../../../../../observability/public';
import { useApmPluginContext } from '../../../hooks/useApmPluginContext';
import { useFetcher } from '../../../hooks/useFetcher';
import { useLocation } from '../../../hooks/useLocation';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/TransactionActionMenu.test.tsx b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/__test__/TransactionActionMenu.test.tsx
similarity index 98%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/TransactionActionMenu.test.tsx
rename to x-pack/plugins/apm/public/components/shared/TransactionActionMenu/__test__/TransactionActionMenu.test.tsx
index 8dc2076eab5b5..cda602204469c 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/TransactionActionMenu.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/__test__/TransactionActionMenu.test.tsx
@@ -7,7 +7,7 @@
import React from 'react';
import { render, fireEvent, act, wait } from '@testing-library/react';
import { TransactionActionMenu } from '../TransactionActionMenu';
-import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
+import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
import * as Transactions from './mockData';
import {
expectTextsNotInDocument,
@@ -15,7 +15,7 @@ import {
} from '../../../../utils/testHelpers';
import * as hooks from '../../../../hooks/useFetcher';
import { LicenseContext } from '../../../../context/LicenseContext';
-import { License } from '../../../../../../../../plugins/licensing/common/license';
+import { License } from '../../../../../../licensing/common/license';
import { MockApmPluginContextWrapper } from '../../../../context/ApmPluginContext/MockApmPluginContext';
import * as apmApi from '../../../../services/rest/createCallApmApi';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/__snapshots__/TransactionActionMenu.test.tsx.snap b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/__test__/__snapshots__/TransactionActionMenu.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/__snapshots__/TransactionActionMenu.test.tsx.snap
rename to x-pack/plugins/apm/public/components/shared/TransactionActionMenu/__test__/__snapshots__/TransactionActionMenu.test.tsx.snap
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/mockData.ts b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/__test__/mockData.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/mockData.ts
rename to x-pack/plugins/apm/public/components/shared/TransactionActionMenu/__test__/mockData.ts
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/sections.test.ts b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/__test__/sections.test.ts
similarity index 98%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/sections.test.ts
rename to x-pack/plugins/apm/public/components/shared/TransactionActionMenu/__test__/sections.test.ts
index 3032dd1704f4e..b2f6f39e0b596 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/sections.test.ts
+++ b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/__test__/sections.test.ts
@@ -5,7 +5,7 @@
*/
import { Location } from 'history';
import { getSections } from '../sections';
-import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
+import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
import { AppMountContextBasePath } from '../../../../context/ApmPluginContext';
describe('Transaction action menu', () => {
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/sections.ts b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/sections.ts
similarity index 98%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/sections.ts
rename to x-pack/plugins/apm/public/components/shared/TransactionActionMenu/sections.ts
index ffdf0b485da64..2c2f4bfcadd7d 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/sections.ts
+++ b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/sections.ts
@@ -8,7 +8,7 @@ import { Location } from 'history';
import { pick, isEmpty } from 'lodash';
import moment from 'moment';
import url from 'url';
-import { Transaction } from '../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
+import { Transaction } from '../../../../typings/es_schemas/ui/transaction';
import { IUrlParams } from '../../../context/UrlParamsContext/types';
import { getDiscoverHref } from '../Links/DiscoverLinks/DiscoverLink';
import { getDiscoverQuery } from '../Links/DiscoverLinks/DiscoverTransactionLink';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownGraph/index.tsx b/x-pack/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownGraph/index.tsx
similarity index 81%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownGraph/index.tsx
rename to x-pack/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownGraph/index.tsx
index 50ea169c017f9..966cc64fde505 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownGraph/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownGraph/index.tsx
@@ -7,17 +7,14 @@
import React, { useMemo } from 'react';
import numeral from '@elastic/numeral';
import { throttle } from 'lodash';
-import { NOT_AVAILABLE_LABEL } from '../../../../../../../../plugins/apm/common/i18n';
-import {
- Coordinate,
- TimeSeries
-} from '../../../../../../../../plugins/apm/typings/timeseries';
-import { Maybe } from '../../../../../../../../plugins/apm/typings/common';
+import { NOT_AVAILABLE_LABEL } from '../../../../../common/i18n';
+import { Coordinate, TimeSeries } from '../../../../../typings/timeseries';
+import { Maybe } from '../../../../../typings/common';
import { TransactionLineChart } from '../../charts/TransactionCharts/TransactionLineChart';
import { asPercent } from '../../../../utils/formatters';
import { unit } from '../../../../style/variables';
import { isValidCoordinateValue } from '../../../../utils/isValidCoordinateValue';
-import { useUiTracker } from '../../../../../../../../plugins/observability/public';
+import { useUiTracker } from '../../../../../../observability/public';
interface Props {
timeseries: TimeSeries[];
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownHeader.tsx b/x-pack/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownHeader.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownHeader.tsx
rename to x-pack/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownHeader.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownKpiList.tsx b/x-pack/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownKpiList.tsx
similarity index 95%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownKpiList.tsx
rename to x-pack/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownKpiList.tsx
index 91f5f4e0a7176..c4a8e07fb3004 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownKpiList.tsx
+++ b/x-pack/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownKpiList.tsx
@@ -13,10 +13,7 @@ import {
EuiIcon
} from '@elastic/eui';
import styled from 'styled-components';
-import {
- FORMATTERS,
- InfraFormatterType
-} from '../../../../../../../plugins/infra/public';
+import { FORMATTERS, InfraFormatterType } from '../../../../../infra/public';
interface TransactionBreakdownKpi {
name: string;
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/index.tsx b/x-pack/plugins/apm/public/components/shared/TransactionBreakdown/index.tsx
similarity index 96%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/index.tsx
rename to x-pack/plugins/apm/public/components/shared/TransactionBreakdown/index.tsx
index 85f5f83fb920e..be5860190c11e 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/TransactionBreakdown/index.tsx
@@ -11,7 +11,7 @@ import { TransactionBreakdownHeader } from './TransactionBreakdownHeader';
import { TransactionBreakdownKpiList } from './TransactionBreakdownKpiList';
import { TransactionBreakdownGraph } from './TransactionBreakdownGraph';
import { FETCH_STATUS } from '../../../hooks/useFetcher';
-import { useUiTracker } from '../../../../../../../plugins/observability/public';
+import { useUiTracker } from '../../../../../observability/public';
const emptyMessage = i18n.translate('xpack.apm.transactionBreakdown.noData', {
defaultMessage: 'No data within this time range.'
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionDurationAlertTrigger/index.stories.tsx b/x-pack/plugins/apm/public/components/shared/TransactionDurationAlertTrigger/index.stories.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionDurationAlertTrigger/index.stories.tsx
rename to x-pack/plugins/apm/public/components/shared/TransactionDurationAlertTrigger/index.stories.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionDurationAlertTrigger/index.tsx b/x-pack/plugins/apm/public/components/shared/TransactionDurationAlertTrigger/index.tsx
similarity index 96%
rename from x-pack/legacy/plugins/apm/public/components/shared/TransactionDurationAlertTrigger/index.tsx
rename to x-pack/plugins/apm/public/components/shared/TransactionDurationAlertTrigger/index.tsx
index 077e6535a8b21..1e9fbd2c1c135 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionDurationAlertTrigger/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/TransactionDurationAlertTrigger/index.tsx
@@ -7,11 +7,11 @@ import React from 'react';
import { map } from 'lodash';
import { EuiFieldNumber, EuiSelect } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
-import { ForLastExpression } from '../../../../../../../plugins/triggers_actions_ui/public';
+import { ForLastExpression } from '../../../../../triggers_actions_ui/public';
import {
TRANSACTION_ALERT_AGGREGATION_TYPES,
ALERT_TYPES_CONFIG
-} from '../../../../../../../plugins/apm/common/alert_types';
+} from '../../../../common/alert_types';
import { ServiceAlertTrigger } from '../ServiceAlertTrigger';
import { useUrlParams } from '../../../hooks/useUrlParams';
import { useServiceTransactionTypes } from '../../../hooks/useServiceTransactionTypes';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/AnnotationsPlot.tsx b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/AnnotationsPlot.tsx
similarity index 92%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/AnnotationsPlot.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/CustomPlot/AnnotationsPlot.tsx
index ec6168df5b134..6eff4759b2e7c 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/AnnotationsPlot.tsx
+++ b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/AnnotationsPlot.tsx
@@ -14,8 +14,8 @@ import {
EuiText
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
-import { Maybe } from '../../../../../../../../plugins/apm/typings/common';
-import { Annotation } from '../../../../../../../../plugins/apm/common/annotations';
+import { Maybe } from '../../../../../typings/common';
+import { Annotation } from '../../../../../common/annotations';
import { PlotValues, SharedPlot } from './plotUtils';
import { asAbsoluteDateTime } from '../../../../utils/formatters';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/InteractivePlot.js b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/InteractivePlot.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/InteractivePlot.js
rename to x-pack/plugins/apm/public/components/shared/charts/CustomPlot/InteractivePlot.js
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/Legends.js b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/Legends.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/Legends.js
rename to x-pack/plugins/apm/public/components/shared/charts/CustomPlot/Legends.js
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/SelectionMarker.js b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/SelectionMarker.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/SelectionMarker.js
rename to x-pack/plugins/apm/public/components/shared/charts/CustomPlot/SelectionMarker.js
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/StaticPlot.js b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/StaticPlot.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/StaticPlot.js
rename to x-pack/plugins/apm/public/components/shared/charts/CustomPlot/StaticPlot.js
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/StatusText.js b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/StatusText.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/StatusText.js
rename to x-pack/plugins/apm/public/components/shared/charts/CustomPlot/StatusText.js
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/VoronoiPlot.js b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/VoronoiPlot.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/VoronoiPlot.js
rename to x-pack/plugins/apm/public/components/shared/charts/CustomPlot/VoronoiPlot.js
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/getEmptySeries.ts b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/getEmptySeries.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/getEmptySeries.ts
rename to x-pack/plugins/apm/public/components/shared/charts/CustomPlot/getEmptySeries.ts
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/getTimezoneOffsetInMs.test.ts b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/getTimezoneOffsetInMs.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/getTimezoneOffsetInMs.test.ts
rename to x-pack/plugins/apm/public/components/shared/charts/CustomPlot/getTimezoneOffsetInMs.test.ts
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/getTimezoneOffsetInMs.ts b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/getTimezoneOffsetInMs.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/getTimezoneOffsetInMs.ts
rename to x-pack/plugins/apm/public/components/shared/charts/CustomPlot/getTimezoneOffsetInMs.ts
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/index.js b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/index.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/index.js
rename to x-pack/plugins/apm/public/components/shared/charts/CustomPlot/index.js
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.test.ts b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.test.ts
similarity index 94%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.test.ts
rename to x-pack/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.test.ts
index bfc5c7c243f31..b130deed7f098 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.test.ts
+++ b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.test.ts
@@ -6,10 +6,7 @@
// @ts-ignore
import * as plotUtils from './plotUtils';
-import {
- TimeSeries,
- Coordinate
-} from '../../../../../../../../plugins/apm/typings/timeseries';
+import { TimeSeries, Coordinate } from '../../../../../typings/timeseries';
describe('plotUtils', () => {
describe('getPlotValues', () => {
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.tsx b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.tsx
similarity index 97%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.tsx
index c489c270d19ac..64350a5741647 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.tsx
+++ b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.tsx
@@ -11,10 +11,7 @@ import d3 from 'd3';
import PropTypes from 'prop-types';
import React from 'react';
-import {
- TimeSeries,
- Coordinate
-} from '../../../../../../../../plugins/apm/typings/timeseries';
+import { TimeSeries, Coordinate } from '../../../../../typings/timeseries';
import { unit } from '../../../../style/variables';
import { getDomainTZ, getTimeTicksTZ } from '../helper/timezone';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/test/CustomPlot.test.js b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/test/CustomPlot.test.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/test/CustomPlot.test.js
rename to x-pack/plugins/apm/public/components/shared/charts/CustomPlot/test/CustomPlot.test.js
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/test/__snapshots__/CustomPlot.test.js.snap b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/test/__snapshots__/CustomPlot.test.js.snap
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/test/__snapshots__/CustomPlot.test.js.snap
rename to x-pack/plugins/apm/public/components/shared/charts/CustomPlot/test/__snapshots__/CustomPlot.test.js.snap
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/test/responseWithData.json b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/test/responseWithData.json
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/test/responseWithData.json
rename to x-pack/plugins/apm/public/components/shared/charts/CustomPlot/test/responseWithData.json
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Histogram/SingleRect.js b/x-pack/plugins/apm/public/components/shared/charts/Histogram/SingleRect.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Histogram/SingleRect.js
rename to x-pack/plugins/apm/public/components/shared/charts/Histogram/SingleRect.js
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Histogram/__test__/Histogram.test.js b/x-pack/plugins/apm/public/components/shared/charts/Histogram/__test__/Histogram.test.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Histogram/__test__/Histogram.test.js
rename to x-pack/plugins/apm/public/components/shared/charts/Histogram/__test__/Histogram.test.js
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Histogram/__test__/__snapshots__/Histogram.test.js.snap b/x-pack/plugins/apm/public/components/shared/charts/Histogram/__test__/__snapshots__/Histogram.test.js.snap
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Histogram/__test__/__snapshots__/Histogram.test.js.snap
rename to x-pack/plugins/apm/public/components/shared/charts/Histogram/__test__/__snapshots__/Histogram.test.js.snap
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Histogram/__test__/response.json b/x-pack/plugins/apm/public/components/shared/charts/Histogram/__test__/response.json
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Histogram/__test__/response.json
rename to x-pack/plugins/apm/public/components/shared/charts/Histogram/__test__/response.json
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Histogram/index.js b/x-pack/plugins/apm/public/components/shared/charts/Histogram/index.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Histogram/index.js
rename to x-pack/plugins/apm/public/components/shared/charts/Histogram/index.js
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Legend/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/Legend/index.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Legend/index.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/Legend/index.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/MetricsChart/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/MetricsChart/index.tsx
similarity index 90%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/MetricsChart/index.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/MetricsChart/index.tsx
index 2ceac87d9aab3..862f2a8987067 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/charts/MetricsChart/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/charts/MetricsChart/index.tsx
@@ -6,7 +6,7 @@
import { EuiTitle } from '@elastic/eui';
import React from 'react';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { GenericMetricsChart } from '../../../../../../../../plugins/apm/server/lib/metrics/transform_metrics_chart';
+import { GenericMetricsChart } from '../../../../../server/lib/metrics/transform_metrics_chart';
// @ts-ignore
import CustomPlot from '../CustomPlot';
import {
@@ -17,10 +17,10 @@ import {
getFixedByteFormatter,
asDuration
} from '../../../../utils/formatters';
-import { Coordinate } from '../../../../../../../../plugins/apm/typings/timeseries';
+import { Coordinate } from '../../../../../typings/timeseries';
import { isValidCoordinateValue } from '../../../../utils/isValidCoordinateValue';
import { useChartsSync } from '../../../../hooks/useChartsSync';
-import { Maybe } from '../../../../../../../../plugins/apm/typings/common';
+import { Maybe } from '../../../../../typings/common';
interface Props {
start: Maybe;
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/LastTickValue.tsx b/x-pack/plugins/apm/public/components/shared/charts/Timeline/LastTickValue.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/LastTickValue.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/Timeline/LastTickValue.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/AgentMarker.tsx b/x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/AgentMarker.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/AgentMarker.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/AgentMarker.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/ErrorMarker.tsx b/x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/ErrorMarker.tsx
similarity index 97%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/ErrorMarker.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/ErrorMarker.tsx
index 48265ce7c80a8..51368a4fb946d 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/ErrorMarker.tsx
+++ b/x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/ErrorMarker.tsx
@@ -11,7 +11,7 @@ import styled from 'styled-components';
import {
TRACE_ID,
TRANSACTION_ID
-} from '../../../../../../../../../plugins/apm/common/elasticsearch_fieldnames';
+} from '../../../../../../common/elasticsearch_fieldnames';
import { useUrlParams } from '../../../../../hooks/useUrlParams';
import { px, unit, units } from '../../../../../style/variables';
import { asDuration } from '../../../../../utils/formatters';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/AgentMarker.test.tsx b/x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/AgentMarker.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/AgentMarker.test.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/AgentMarker.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/ErrorMarker.test.tsx b/x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/ErrorMarker.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/ErrorMarker.test.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/ErrorMarker.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/Marker.test.tsx b/x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/Marker.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/Marker.test.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/Marker.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/__snapshots__/AgentMarker.test.tsx.snap b/x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/__snapshots__/AgentMarker.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/__snapshots__/AgentMarker.test.tsx.snap
rename to x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/__snapshots__/AgentMarker.test.tsx.snap
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/__snapshots__/ErrorMarker.test.tsx.snap b/x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/__snapshots__/ErrorMarker.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/__snapshots__/ErrorMarker.test.tsx.snap
rename to x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/__snapshots__/ErrorMarker.test.tsx.snap
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/__snapshots__/Marker.test.tsx.snap b/x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/__snapshots__/Marker.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/__snapshots__/Marker.test.tsx.snap
rename to x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/__snapshots__/Marker.test.tsx.snap
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/index.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/index.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/index.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Timeline.test.tsx b/x-pack/plugins/apm/public/components/shared/charts/Timeline/Timeline.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Timeline.test.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/Timeline/Timeline.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/TimelineAxis.tsx b/x-pack/plugins/apm/public/components/shared/charts/Timeline/TimelineAxis.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/TimelineAxis.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/Timeline/TimelineAxis.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/VerticalLines.tsx b/x-pack/plugins/apm/public/components/shared/charts/Timeline/VerticalLines.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/VerticalLines.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/Timeline/VerticalLines.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/__snapshots__/Timeline.test.tsx.snap b/x-pack/plugins/apm/public/components/shared/charts/Timeline/__snapshots__/Timeline.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/__snapshots__/Timeline.test.tsx.snap
rename to x-pack/plugins/apm/public/components/shared/charts/Timeline/__snapshots__/Timeline.test.tsx.snap
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/Timeline/index.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/index.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/Timeline/index.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/plotUtils.ts b/x-pack/plugins/apm/public/components/shared/charts/Timeline/plotUtils.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/plotUtils.ts
rename to x-pack/plugins/apm/public/components/shared/charts/Timeline/plotUtils.ts
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Tooltip/index.js b/x-pack/plugins/apm/public/components/shared/charts/Tooltip/index.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/Tooltip/index.js
rename to x-pack/plugins/apm/public/components/shared/charts/Tooltip/index.js
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/BrowserLineChart.test.tsx b/x-pack/plugins/apm/public/components/shared/charts/TransactionCharts/BrowserLineChart.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/BrowserLineChart.test.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/TransactionCharts/BrowserLineChart.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/BrowserLineChart.tsx b/x-pack/plugins/apm/public/components/shared/charts/TransactionCharts/BrowserLineChart.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/BrowserLineChart.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/TransactionCharts/BrowserLineChart.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/ChoroplethMap/ChoroplethToolTip.tsx b/x-pack/plugins/apm/public/components/shared/charts/TransactionCharts/ChoroplethMap/ChoroplethToolTip.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/ChoroplethMap/ChoroplethToolTip.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/TransactionCharts/ChoroplethMap/ChoroplethToolTip.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/ChoroplethMap/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/TransactionCharts/ChoroplethMap/index.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/ChoroplethMap/index.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/TransactionCharts/ChoroplethMap/index.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/DurationByCountryMap/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/TransactionCharts/DurationByCountryMap/index.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/DurationByCountryMap/index.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/TransactionCharts/DurationByCountryMap/index.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/TransactionLineChart/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/TransactionCharts/TransactionLineChart/index.tsx
similarity index 96%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/TransactionLineChart/index.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/TransactionCharts/TransactionLineChart/index.tsx
index c9c31b05e264c..27c829f63cf0a 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/TransactionLineChart/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/charts/TransactionCharts/TransactionLineChart/index.tsx
@@ -8,7 +8,7 @@ import React, { useCallback } from 'react';
import {
Coordinate,
RectCoordinate
-} from '../../../../../../../../../plugins/apm/typings/timeseries';
+} from '../../../../../../typings/timeseries';
import { useChartsSync } from '../../../../../hooks/useChartsSync';
// @ts-ignore
import CustomPlot from '../../CustomPlot';
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/TransactionCharts/index.tsx
similarity index 96%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/index.tsx
rename to x-pack/plugins/apm/public/components/shared/charts/TransactionCharts/index.tsx
index 368a39e4ad228..b0555da705a30 100644
--- a/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/charts/TransactionCharts/index.tsx
@@ -19,11 +19,8 @@ import { Location } from 'history';
import React, { Component } from 'react';
import { isEmpty, flatten } from 'lodash';
import styled from 'styled-components';
-import { NOT_AVAILABLE_LABEL } from '../../../../../../../../plugins/apm/common/i18n';
-import {
- Coordinate,
- TimeSeries
-} from '../../../../../../../../plugins/apm/typings/timeseries';
+import { NOT_AVAILABLE_LABEL } from '../../../../../common/i18n';
+import { Coordinate, TimeSeries } from '../../../../../typings/timeseries';
import { ITransactionChartData } from '../../../../selectors/chartSelectors';
import { IUrlParams } from '../../../../context/UrlParamsContext/types';
import {
@@ -42,7 +39,7 @@ import {
TRANSACTION_PAGE_LOAD,
TRANSACTION_ROUTE_CHANGE,
TRANSACTION_REQUEST
-} from '../../../../../../../../plugins/apm/common/transaction_types';
+} from '../../../../../common/transaction_types';
interface TransactionChartProps {
hasMLJob: boolean;
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/helper/__test__/timezone.test.ts b/x-pack/plugins/apm/public/components/shared/charts/helper/__test__/timezone.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/helper/__test__/timezone.test.ts
rename to x-pack/plugins/apm/public/components/shared/charts/helper/__test__/timezone.test.ts
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/helper/timezone.ts b/x-pack/plugins/apm/public/components/shared/charts/helper/timezone.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/charts/helper/timezone.ts
rename to x-pack/plugins/apm/public/components/shared/charts/helper/timezone.ts
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/useDelayedVisibility/Delayed/index.test.tsx b/x-pack/plugins/apm/public/components/shared/useDelayedVisibility/Delayed/index.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/useDelayedVisibility/Delayed/index.test.tsx
rename to x-pack/plugins/apm/public/components/shared/useDelayedVisibility/Delayed/index.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/useDelayedVisibility/Delayed/index.ts b/x-pack/plugins/apm/public/components/shared/useDelayedVisibility/Delayed/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/useDelayedVisibility/Delayed/index.ts
rename to x-pack/plugins/apm/public/components/shared/useDelayedVisibility/Delayed/index.ts
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/useDelayedVisibility/index.test.tsx b/x-pack/plugins/apm/public/components/shared/useDelayedVisibility/index.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/useDelayedVisibility/index.test.tsx
rename to x-pack/plugins/apm/public/components/shared/useDelayedVisibility/index.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/components/shared/useDelayedVisibility/index.ts b/x-pack/plugins/apm/public/components/shared/useDelayedVisibility/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/components/shared/useDelayedVisibility/index.ts
rename to x-pack/plugins/apm/public/components/shared/useDelayedVisibility/index.ts
diff --git a/x-pack/legacy/plugins/apm/public/context/ApmPluginContext/MockApmPluginContext.tsx b/x-pack/plugins/apm/public/context/ApmPluginContext/MockApmPluginContext.tsx
similarity index 93%
rename from x-pack/legacy/plugins/apm/public/context/ApmPluginContext/MockApmPluginContext.tsx
rename to x-pack/plugins/apm/public/context/ApmPluginContext/MockApmPluginContext.tsx
index cc2e382611628..865e3dbe6dafc 100644
--- a/x-pack/legacy/plugins/apm/public/context/ApmPluginContext/MockApmPluginContext.tsx
+++ b/x-pack/plugins/apm/public/context/ApmPluginContext/MockApmPluginContext.tsx
@@ -6,7 +6,7 @@
import React from 'react';
import { ApmPluginContext, ApmPluginContextValue } from '.';
import { createCallApmApi } from '../../services/rest/createCallApmApi';
-import { ConfigSchema } from '../../new-platform/plugin';
+import { ConfigSchema } from '../..';
const mockCore = {
chrome: {
@@ -30,7 +30,6 @@ const mockCore = {
};
const mockConfig: ConfigSchema = {
- indexPatternTitle: 'apm-*',
serviceMapEnabled: true,
ui: {
enabled: false
diff --git a/x-pack/legacy/plugins/apm/public/context/ApmPluginContext/index.tsx b/x-pack/plugins/apm/public/context/ApmPluginContext/index.tsx
similarity index 87%
rename from x-pack/legacy/plugins/apm/public/context/ApmPluginContext/index.tsx
rename to x-pack/plugins/apm/public/context/ApmPluginContext/index.tsx
index acc3886586889..37304d292540d 100644
--- a/x-pack/legacy/plugins/apm/public/context/ApmPluginContext/index.tsx
+++ b/x-pack/plugins/apm/public/context/ApmPluginContext/index.tsx
@@ -6,7 +6,8 @@
import { createContext } from 'react';
import { AppMountContext } from 'kibana/public';
-import { ApmPluginSetupDeps, ConfigSchema } from '../../new-platform/plugin';
+import { ConfigSchema } from '../..';
+import { ApmPluginSetupDeps } from '../../plugin';
export type AppMountContextBasePath = AppMountContext['core']['http']['basePath'];
diff --git a/x-pack/legacy/plugins/apm/public/context/ChartsSyncContext.tsx b/x-pack/plugins/apm/public/context/ChartsSyncContext.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/context/ChartsSyncContext.tsx
rename to x-pack/plugins/apm/public/context/ChartsSyncContext.tsx
diff --git a/x-pack/legacy/plugins/apm/public/context/LicenseContext/InvalidLicenseNotification.tsx b/x-pack/plugins/apm/public/context/LicenseContext/InvalidLicenseNotification.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/context/LicenseContext/InvalidLicenseNotification.tsx
rename to x-pack/plugins/apm/public/context/LicenseContext/InvalidLicenseNotification.tsx
diff --git a/x-pack/legacy/plugins/apm/public/context/LicenseContext/index.tsx b/x-pack/plugins/apm/public/context/LicenseContext/index.tsx
similarity index 94%
rename from x-pack/legacy/plugins/apm/public/context/LicenseContext/index.tsx
rename to x-pack/plugins/apm/public/context/LicenseContext/index.tsx
index 62cdbd3bbc995..e6615a2fc98bf 100644
--- a/x-pack/legacy/plugins/apm/public/context/LicenseContext/index.tsx
+++ b/x-pack/plugins/apm/public/context/LicenseContext/index.tsx
@@ -6,7 +6,7 @@
import React from 'react';
import useObservable from 'react-use/lib/useObservable';
-import { ILicense } from '../../../../../../plugins/licensing/public';
+import { ILicense } from '../../../../licensing/public';
import { useApmPluginContext } from '../../hooks/useApmPluginContext';
import { InvalidLicenseNotification } from './InvalidLicenseNotification';
diff --git a/x-pack/legacy/plugins/apm/public/context/LoadingIndicatorContext.tsx b/x-pack/plugins/apm/public/context/LoadingIndicatorContext.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/context/LoadingIndicatorContext.tsx
rename to x-pack/plugins/apm/public/context/LoadingIndicatorContext.tsx
diff --git a/x-pack/legacy/plugins/apm/public/context/LocationContext.tsx b/x-pack/plugins/apm/public/context/LocationContext.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/context/LocationContext.tsx
rename to x-pack/plugins/apm/public/context/LocationContext.tsx
diff --git a/x-pack/legacy/plugins/apm/public/context/MatchedRouteContext.tsx b/x-pack/plugins/apm/public/context/MatchedRouteContext.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/context/MatchedRouteContext.tsx
rename to x-pack/plugins/apm/public/context/MatchedRouteContext.tsx
diff --git a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/MockUrlParamsContextProvider.tsx b/x-pack/plugins/apm/public/context/UrlParamsContext/MockUrlParamsContextProvider.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/context/UrlParamsContext/MockUrlParamsContextProvider.tsx
rename to x-pack/plugins/apm/public/context/UrlParamsContext/MockUrlParamsContextProvider.tsx
diff --git a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/__tests__/UrlParamsContext.test.tsx b/x-pack/plugins/apm/public/context/UrlParamsContext/__tests__/UrlParamsContext.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/context/UrlParamsContext/__tests__/UrlParamsContext.test.tsx
rename to x-pack/plugins/apm/public/context/UrlParamsContext/__tests__/UrlParamsContext.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/constants.ts b/x-pack/plugins/apm/public/context/UrlParamsContext/constants.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/context/UrlParamsContext/constants.ts
rename to x-pack/plugins/apm/public/context/UrlParamsContext/constants.ts
diff --git a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/helpers.ts b/x-pack/plugins/apm/public/context/UrlParamsContext/helpers.ts
similarity index 97%
rename from x-pack/legacy/plugins/apm/public/context/UrlParamsContext/helpers.ts
rename to x-pack/plugins/apm/public/context/UrlParamsContext/helpers.ts
index b80db0e9ae073..f1e45fe45255d 100644
--- a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/helpers.ts
+++ b/x-pack/plugins/apm/public/context/UrlParamsContext/helpers.ts
@@ -7,7 +7,7 @@
import { compact, pick } from 'lodash';
import datemath from '@elastic/datemath';
import { IUrlParams } from './types';
-import { ProcessorEvent } from '../../../../../../plugins/apm/common/processor_event';
+import { ProcessorEvent } from '../../../common/processor_event';
interface PathParams {
processorEvent?: ProcessorEvent;
diff --git a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/index.tsx b/x-pack/plugins/apm/public/context/UrlParamsContext/index.tsx
similarity index 92%
rename from x-pack/legacy/plugins/apm/public/context/UrlParamsContext/index.tsx
rename to x-pack/plugins/apm/public/context/UrlParamsContext/index.tsx
index 588936039c2bc..7a929380bce37 100644
--- a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/index.tsx
+++ b/x-pack/plugins/apm/public/context/UrlParamsContext/index.tsx
@@ -16,13 +16,13 @@ import { uniqueId, mapValues } from 'lodash';
import { IUrlParams } from './types';
import { getParsedDate } from './helpers';
import { resolveUrlParams } from './resolveUrlParams';
-import { UIFilters } from '../../../../../../plugins/apm/typings/ui_filters';
+import { UIFilters } from '../../../typings/ui_filters';
import {
localUIFilterNames,
LocalUIFilterName
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-} from '../../../../../../plugins/apm/server/lib/ui_filters/local_ui_filters/config';
-import { pickKeys } from '../../utils/pickKeys';
+} from '../../../server/lib/ui_filters/local_ui_filters/config';
+import { pickKeys } from '../../../common/utils/pick_keys';
import { useDeepObjectIdentity } from '../../hooks/useDeepObjectIdentity';
interface TimeRange {
diff --git a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/resolveUrlParams.ts b/x-pack/plugins/apm/public/context/UrlParamsContext/resolveUrlParams.ts
similarity index 93%
rename from x-pack/legacy/plugins/apm/public/context/UrlParamsContext/resolveUrlParams.ts
rename to x-pack/plugins/apm/public/context/UrlParamsContext/resolveUrlParams.ts
index f022d2084583b..34af18431a2df 100644
--- a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/resolveUrlParams.ts
+++ b/x-pack/plugins/apm/public/context/UrlParamsContext/resolveUrlParams.ts
@@ -18,8 +18,8 @@ import {
import { toQuery } from '../../components/shared/Links/url_helpers';
import { TIMEPICKER_DEFAULTS } from './constants';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { localUIFilterNames } from '../../../../../../plugins/apm/server/lib/ui_filters/local_ui_filters/config';
-import { pickKeys } from '../../utils/pickKeys';
+import { localUIFilterNames } from '../../../server/lib/ui_filters/local_ui_filters/config';
+import { pickKeys } from '../../../common/utils/pick_keys';
type TimeUrlParams = Pick<
IUrlParams,
diff --git a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/types.ts b/x-pack/plugins/apm/public/context/UrlParamsContext/types.ts
similarity index 83%
rename from x-pack/legacy/plugins/apm/public/context/UrlParamsContext/types.ts
rename to x-pack/plugins/apm/public/context/UrlParamsContext/types.ts
index acde09308ab46..78fe662b88d75 100644
--- a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/types.ts
+++ b/x-pack/plugins/apm/public/context/UrlParamsContext/types.ts
@@ -5,8 +5,8 @@
*/
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { LocalUIFilterName } from '../../../../../../plugins/apm/server/lib/ui_filters/local_ui_filters/config';
-import { ProcessorEvent } from '../../../../../../plugins/apm/common/processor_event';
+import { LocalUIFilterName } from '../../../server/lib/ui_filters/local_ui_filters/config';
+import { ProcessorEvent } from '../../../common/processor_event';
export type IUrlParams = {
detailTab?: string;
diff --git a/x-pack/legacy/plugins/apm/public/new-platform/featureCatalogueEntry.ts b/x-pack/plugins/apm/public/featureCatalogueEntry.ts
similarity index 88%
rename from x-pack/legacy/plugins/apm/public/new-platform/featureCatalogueEntry.ts
rename to x-pack/plugins/apm/public/featureCatalogueEntry.ts
index 7a150de6d5d02..f76c6f5169dc5 100644
--- a/x-pack/legacy/plugins/apm/public/new-platform/featureCatalogueEntry.ts
+++ b/x-pack/plugins/apm/public/featureCatalogueEntry.ts
@@ -5,7 +5,7 @@
*/
import { i18n } from '@kbn/i18n';
-import { FeatureCatalogueCategory } from '../../../../../../src/plugins/home/public';
+import { FeatureCatalogueCategory } from '../../../../src/plugins/home/public';
export const featureCatalogueEntry = {
id: 'apm',
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useAgentName.ts b/x-pack/plugins/apm/public/hooks/useAgentName.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useAgentName.ts
rename to x-pack/plugins/apm/public/hooks/useAgentName.ts
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useApmPluginContext.ts b/x-pack/plugins/apm/public/hooks/useApmPluginContext.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useApmPluginContext.ts
rename to x-pack/plugins/apm/public/hooks/useApmPluginContext.ts
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useAvgDurationByBrowser.test.ts b/x-pack/plugins/apm/public/hooks/useAvgDurationByBrowser.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useAvgDurationByBrowser.test.ts
rename to x-pack/plugins/apm/public/hooks/useAvgDurationByBrowser.test.ts
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useAvgDurationByBrowser.ts b/x-pack/plugins/apm/public/hooks/useAvgDurationByBrowser.ts
similarity index 83%
rename from x-pack/legacy/plugins/apm/public/hooks/useAvgDurationByBrowser.ts
rename to x-pack/plugins/apm/public/hooks/useAvgDurationByBrowser.ts
index 256c2fa68bfbc..5d0c9d1435798 100644
--- a/x-pack/legacy/plugins/apm/public/hooks/useAvgDurationByBrowser.ts
+++ b/x-pack/plugins/apm/public/hooks/useAvgDurationByBrowser.ts
@@ -8,9 +8,9 @@ import theme from '@elastic/eui/dist/eui_theme_light.json';
import { useFetcher } from './useFetcher';
import { useUrlParams } from './useUrlParams';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { AvgDurationByBrowserAPIResponse } from '../../../../../plugins/apm/server/lib/transactions/avg_duration_by_browser';
-import { TimeSeries } from '../../../../../plugins/apm/typings/timeseries';
-import { getVizColorForIndex } from '../../../../../plugins/apm/common/viz_colors';
+import { AvgDurationByBrowserAPIResponse } from '../../server/lib/transactions/avg_duration_by_browser';
+import { TimeSeries } from '../../typings/timeseries';
+import { getVizColorForIndex } from '../../common/viz_colors';
function toTimeSeries(data?: AvgDurationByBrowserAPIResponse): TimeSeries[] {
if (!data) {
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useAvgDurationByCountry.ts b/x-pack/plugins/apm/public/hooks/useAvgDurationByCountry.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useAvgDurationByCountry.ts
rename to x-pack/plugins/apm/public/hooks/useAvgDurationByCountry.ts
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useCallApi.ts b/x-pack/plugins/apm/public/hooks/useCallApi.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useCallApi.ts
rename to x-pack/plugins/apm/public/hooks/useCallApi.ts
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useChartsSync.tsx b/x-pack/plugins/apm/public/hooks/useChartsSync.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useChartsSync.tsx
rename to x-pack/plugins/apm/public/hooks/useChartsSync.tsx
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useComponentId.tsx b/x-pack/plugins/apm/public/hooks/useComponentId.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useComponentId.tsx
rename to x-pack/plugins/apm/public/hooks/useComponentId.tsx
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useDeepObjectIdentity.ts b/x-pack/plugins/apm/public/hooks/useDeepObjectIdentity.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useDeepObjectIdentity.ts
rename to x-pack/plugins/apm/public/hooks/useDeepObjectIdentity.ts
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useDynamicIndexPattern.ts b/x-pack/plugins/apm/public/hooks/useDynamicIndexPattern.ts
similarity index 89%
rename from x-pack/legacy/plugins/apm/public/hooks/useDynamicIndexPattern.ts
rename to x-pack/plugins/apm/public/hooks/useDynamicIndexPattern.ts
index ee3d2e81f259f..9a95bd925d6e1 100644
--- a/x-pack/legacy/plugins/apm/public/hooks/useDynamicIndexPattern.ts
+++ b/x-pack/plugins/apm/public/hooks/useDynamicIndexPattern.ts
@@ -5,7 +5,7 @@
*/
import { useFetcher } from './useFetcher';
-import { ProcessorEvent } from '../../../../../plugins/apm/common/processor_event';
+import { ProcessorEvent } from '../../common/processor_event';
export function useDynamicIndexPattern(
processorEvent: ProcessorEvent | undefined
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useFetcher.integration.test.tsx b/x-pack/plugins/apm/public/hooks/useFetcher.integration.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useFetcher.integration.test.tsx
rename to x-pack/plugins/apm/public/hooks/useFetcher.integration.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useFetcher.test.tsx b/x-pack/plugins/apm/public/hooks/useFetcher.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useFetcher.test.tsx
rename to x-pack/plugins/apm/public/hooks/useFetcher.test.tsx
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useFetcher.tsx b/x-pack/plugins/apm/public/hooks/useFetcher.tsx
similarity index 98%
rename from x-pack/legacy/plugins/apm/public/hooks/useFetcher.tsx
rename to x-pack/plugins/apm/public/hooks/useFetcher.tsx
index 95cebd6b2a465..5d5128d969aad 100644
--- a/x-pack/legacy/plugins/apm/public/hooks/useFetcher.tsx
+++ b/x-pack/plugins/apm/public/hooks/useFetcher.tsx
@@ -9,7 +9,7 @@
import React, { useContext, useEffect, useState, useMemo } from 'react';
import { i18n } from '@kbn/i18n';
import { IHttpFetchError } from 'src/core/public';
-import { toMountPoint } from '../../../../../../src/plugins/kibana_react/public';
+import { toMountPoint } from '../../../../../src/plugins/kibana_react/public';
import { LoadingIndicatorContext } from '../context/LoadingIndicatorContext';
import { APMClient, callApmApi } from '../services/rest/createCallApmApi';
import { useApmPluginContext } from './useApmPluginContext';
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useKibanaUrl.ts b/x-pack/plugins/apm/public/hooks/useKibanaUrl.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useKibanaUrl.ts
rename to x-pack/plugins/apm/public/hooks/useKibanaUrl.ts
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useLicense.ts b/x-pack/plugins/apm/public/hooks/useLicense.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useLicense.ts
rename to x-pack/plugins/apm/public/hooks/useLicense.ts
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useLoadingIndicator.ts b/x-pack/plugins/apm/public/hooks/useLoadingIndicator.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useLoadingIndicator.ts
rename to x-pack/plugins/apm/public/hooks/useLoadingIndicator.ts
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useLocalUIFilters.ts b/x-pack/plugins/apm/public/hooks/useLocalUIFilters.ts
similarity index 88%
rename from x-pack/legacy/plugins/apm/public/hooks/useLocalUIFilters.ts
rename to x-pack/plugins/apm/public/hooks/useLocalUIFilters.ts
index 9f14b2b25fc94..1dfd3ec7c3ee3 100644
--- a/x-pack/legacy/plugins/apm/public/hooks/useLocalUIFilters.ts
+++ b/x-pack/plugins/apm/public/hooks/useLocalUIFilters.ts
@@ -7,18 +7,18 @@
import { omit } from 'lodash';
import { useFetcher } from './useFetcher';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { LocalUIFiltersAPIResponse } from '../../../../../plugins/apm/server/lib/ui_filters/local_ui_filters';
+import { LocalUIFiltersAPIResponse } from '../../server/lib/ui_filters/local_ui_filters';
import { useUrlParams } from './useUrlParams';
import {
LocalUIFilterName,
localUIFilters
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-} from '../../../../../plugins/apm/server/lib/ui_filters/local_ui_filters/config';
+} from '../../server/lib/ui_filters/local_ui_filters/config';
import { history } from '../utils/history';
import { toQuery, fromQuery } from '../components/shared/Links/url_helpers';
import { removeUndefinedProps } from '../context/UrlParamsContext/helpers';
-import { PROJECTION } from '../../../../../plugins/apm/common/projections/typings';
-import { pickKeys } from '../utils/pickKeys';
+import { PROJECTION } from '../../common/projections/typings';
+import { pickKeys } from '../../common/utils/pick_keys';
import { useCallApi } from './useCallApi';
const getInitialData = (
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useLocation.tsx b/x-pack/plugins/apm/public/hooks/useLocation.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useLocation.tsx
rename to x-pack/plugins/apm/public/hooks/useLocation.tsx
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useMatchedRoutes.tsx b/x-pack/plugins/apm/public/hooks/useMatchedRoutes.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useMatchedRoutes.tsx
rename to x-pack/plugins/apm/public/hooks/useMatchedRoutes.tsx
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useServiceMetricCharts.ts b/x-pack/plugins/apm/public/hooks/useServiceMetricCharts.ts
similarity index 91%
rename from x-pack/legacy/plugins/apm/public/hooks/useServiceMetricCharts.ts
rename to x-pack/plugins/apm/public/hooks/useServiceMetricCharts.ts
index 72618a6254f4c..ebcd6ab063708 100644
--- a/x-pack/legacy/plugins/apm/public/hooks/useServiceMetricCharts.ts
+++ b/x-pack/plugins/apm/public/hooks/useServiceMetricCharts.ts
@@ -5,7 +5,7 @@
*/
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { MetricsChartsByAgentAPIResponse } from '../../../../../plugins/apm/server/lib/metrics/get_metrics_chart_data_by_agent';
+import { MetricsChartsByAgentAPIResponse } from '../../server/lib/metrics/get_metrics_chart_data_by_agent';
import { IUrlParams } from '../context/UrlParamsContext/types';
import { useUiFilters } from '../context/UrlParamsContext';
import { useFetcher } from './useFetcher';
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useServiceTransactionTypes.tsx b/x-pack/plugins/apm/public/hooks/useServiceTransactionTypes.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useServiceTransactionTypes.tsx
rename to x-pack/plugins/apm/public/hooks/useServiceTransactionTypes.tsx
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useTransactionBreakdown.ts b/x-pack/plugins/apm/public/hooks/useTransactionBreakdown.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useTransactionBreakdown.ts
rename to x-pack/plugins/apm/public/hooks/useTransactionBreakdown.ts
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useTransactionCharts.ts b/x-pack/plugins/apm/public/hooks/useTransactionCharts.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useTransactionCharts.ts
rename to x-pack/plugins/apm/public/hooks/useTransactionCharts.ts
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useTransactionDistribution.ts b/x-pack/plugins/apm/public/hooks/useTransactionDistribution.ts
similarity index 93%
rename from x-pack/legacy/plugins/apm/public/hooks/useTransactionDistribution.ts
rename to x-pack/plugins/apm/public/hooks/useTransactionDistribution.ts
index 9a93a2334924a..152980b5655d6 100644
--- a/x-pack/legacy/plugins/apm/public/hooks/useTransactionDistribution.ts
+++ b/x-pack/plugins/apm/public/hooks/useTransactionDistribution.ts
@@ -8,7 +8,7 @@ import { IUrlParams } from '../context/UrlParamsContext/types';
import { useFetcher } from './useFetcher';
import { useUiFilters } from '../context/UrlParamsContext';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { TransactionDistributionAPIResponse } from '../../../../../plugins/apm/server/lib/transactions/distribution';
+import { TransactionDistributionAPIResponse } from '../../server/lib/transactions/distribution';
const INITIAL_DATA = {
buckets: [] as TransactionDistributionAPIResponse['buckets'],
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useTransactionList.ts b/x-pack/plugins/apm/public/hooks/useTransactionList.ts
similarity index 94%
rename from x-pack/legacy/plugins/apm/public/hooks/useTransactionList.ts
rename to x-pack/plugins/apm/public/hooks/useTransactionList.ts
index 6ede77023790b..e048e8fe0e3cb 100644
--- a/x-pack/legacy/plugins/apm/public/hooks/useTransactionList.ts
+++ b/x-pack/plugins/apm/public/hooks/useTransactionList.ts
@@ -9,7 +9,7 @@ import { IUrlParams } from '../context/UrlParamsContext/types';
import { useUiFilters } from '../context/UrlParamsContext';
import { useFetcher } from './useFetcher';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { TransactionGroupListAPIResponse } from '../../../../../plugins/apm/server/lib/transaction_groups';
+import { TransactionGroupListAPIResponse } from '../../server/lib/transaction_groups';
const getRelativeImpact = (
impact: number,
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useUrlParams.tsx b/x-pack/plugins/apm/public/hooks/useUrlParams.tsx
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useUrlParams.tsx
rename to x-pack/plugins/apm/public/hooks/useUrlParams.tsx
diff --git a/x-pack/legacy/plugins/apm/public/hooks/useWaterfall.ts b/x-pack/plugins/apm/public/hooks/useWaterfall.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/hooks/useWaterfall.ts
rename to x-pack/plugins/apm/public/hooks/useWaterfall.ts
diff --git a/x-pack/legacy/plugins/apm/public/icon.svg b/x-pack/plugins/apm/public/icon.svg
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/icon.svg
rename to x-pack/plugins/apm/public/icon.svg
diff --git a/x-pack/legacy/plugins/apm/public/images/apm-ml-anomaly-detection-example.png b/x-pack/plugins/apm/public/images/apm-ml-anomaly-detection-example.png
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/images/apm-ml-anomaly-detection-example.png
rename to x-pack/plugins/apm/public/images/apm-ml-anomaly-detection-example.png
diff --git a/x-pack/plugins/apm/public/index.ts b/x-pack/plugins/apm/public/index.ts
new file mode 100644
index 0000000000000..4ac06e1eb8a1c
--- /dev/null
+++ b/x-pack/plugins/apm/public/index.ts
@@ -0,0 +1,25 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import {
+ PluginInitializer,
+ PluginInitializerContext
+} from '../../../../src/core/public';
+import { ApmPlugin, ApmPluginSetup, ApmPluginStart } from './plugin';
+
+export interface ConfigSchema {
+ serviceMapEnabled: boolean;
+ ui: {
+ enabled: boolean;
+ };
+}
+
+export const plugin: PluginInitializer = (
+ pluginInitializerContext: PluginInitializerContext
+) => new ApmPlugin(pluginInitializerContext);
+
+export { ApmPluginSetup, ApmPluginStart };
+export { getTraceUrl } from './components/shared/Links/apm/ExternalLinks';
diff --git a/x-pack/plugins/apm/public/plugin.ts b/x-pack/plugins/apm/public/plugin.ts
new file mode 100644
index 0000000000000..f13c8853d0582
--- /dev/null
+++ b/x-pack/plugins/apm/public/plugin.ts
@@ -0,0 +1,133 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { i18n } from '@kbn/i18n';
+import {
+ AppMountParameters,
+ CoreSetup,
+ CoreStart,
+ Plugin,
+ PluginInitializerContext
+} from '../../../../src/core/public';
+import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils';
+
+import {
+ PluginSetupContract as AlertingPluginPublicSetup,
+ PluginStartContract as AlertingPluginPublicStart
+} from '../../alerting/public';
+import { FeaturesPluginSetup } from '../../features/public';
+import {
+ DataPublicPluginSetup,
+ DataPublicPluginStart
+} from '../../../../src/plugins/data/public';
+import { HomePublicPluginSetup } from '../../../../src/plugins/home/public';
+import { LicensingPluginSetup } from '../../licensing/public';
+import {
+ TriggersAndActionsUIPublicPluginSetup,
+ TriggersAndActionsUIPublicPluginStart
+} from '../../triggers_actions_ui/public';
+import { ConfigSchema } from '.';
+import { createCallApmApi } from './services/rest/createCallApmApi';
+import { featureCatalogueEntry } from './featureCatalogueEntry';
+import { AlertType } from '../common/alert_types';
+import { ErrorRateAlertTrigger } from './components/shared/ErrorRateAlertTrigger';
+import { TransactionDurationAlertTrigger } from './components/shared/TransactionDurationAlertTrigger';
+import { setHelpExtension } from './setHelpExtension';
+import { toggleAppLinkInNav } from './toggleAppLinkInNav';
+import { setReadonlyBadge } from './updateBadge';
+import { createStaticIndexPattern } from './services/rest/index_pattern';
+
+export type ApmPluginSetup = void;
+export type ApmPluginStart = void;
+
+export interface ApmPluginSetupDeps {
+ alerting?: AlertingPluginPublicSetup;
+ data: DataPublicPluginSetup;
+ features: FeaturesPluginSetup;
+ home: HomePublicPluginSetup;
+ licensing: LicensingPluginSetup;
+ triggers_actions_ui: TriggersAndActionsUIPublicPluginSetup;
+}
+
+export interface ApmPluginStartDeps {
+ alerting?: AlertingPluginPublicStart;
+ data: DataPublicPluginStart;
+ home: void;
+ licensing: void;
+ triggers_actions_ui: TriggersAndActionsUIPublicPluginStart;
+}
+
+export class ApmPlugin implements Plugin {
+ private readonly initializerContext: PluginInitializerContext;
+ constructor(initializerContext: PluginInitializerContext) {
+ this.initializerContext = initializerContext;
+ }
+ public setup(core: CoreSetup, plugins: ApmPluginSetupDeps) {
+ const config = this.initializerContext.config.get();
+ const pluginSetupDeps = plugins;
+
+ pluginSetupDeps.home.environment.update({ apmUi: true });
+ pluginSetupDeps.home.featureCatalogue.register(featureCatalogueEntry);
+
+ core.application.register({
+ id: 'apm',
+ title: 'APM',
+ order: 8100,
+ euiIconType: 'apmApp',
+ appRoute: '/app/apm',
+ icon: 'plugins/apm/public/icon.svg',
+ category: DEFAULT_APP_CATEGORIES.observability,
+
+ async mount(params: AppMountParameters) {
+ // Load application bundle
+ const { renderApp } = await import('./application');
+ // Get start services
+ const [coreStart] = await core.getStartServices();
+
+ // render APM feedback link in global help menu
+ setHelpExtension(coreStart);
+ setReadonlyBadge(coreStart);
+
+ // Automatically creates static index pattern and stores as saved object
+ createStaticIndexPattern().catch(e => {
+ // eslint-disable-next-line no-console
+ console.log('Error creating static index pattern', e);
+ });
+
+ return renderApp(coreStart, pluginSetupDeps, params, config);
+ }
+ });
+ }
+ public start(core: CoreStart, plugins: ApmPluginStartDeps) {
+ createCallApmApi(core.http);
+
+ toggleAppLinkInNav(core, this.initializerContext.config.get());
+
+ plugins.triggers_actions_ui.alertTypeRegistry.register({
+ id: AlertType.ErrorRate,
+ name: i18n.translate('xpack.apm.alertTypes.errorRate', {
+ defaultMessage: 'Error rate'
+ }),
+ iconClass: 'bell',
+ alertParamsExpression: ErrorRateAlertTrigger,
+ validate: () => ({
+ errors: []
+ })
+ });
+
+ plugins.triggers_actions_ui.alertTypeRegistry.register({
+ id: AlertType.TransactionDuration,
+ name: i18n.translate('xpack.apm.alertTypes.transactionDuration', {
+ defaultMessage: 'Transaction duration'
+ }),
+ iconClass: 'bell',
+ alertParamsExpression: TransactionDurationAlertTrigger,
+ validate: () => ({
+ errors: []
+ })
+ });
+ }
+}
diff --git a/x-pack/legacy/plugins/apm/public/selectors/__tests__/chartSelectors.test.ts b/x-pack/plugins/apm/public/selectors/__tests__/chartSelectors.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/selectors/__tests__/chartSelectors.test.ts
rename to x-pack/plugins/apm/public/selectors/__tests__/chartSelectors.test.ts
diff --git a/x-pack/legacy/plugins/apm/public/selectors/__tests__/mockData/anomalyData.ts b/x-pack/plugins/apm/public/selectors/__tests__/mockData/anomalyData.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/selectors/__tests__/mockData/anomalyData.ts
rename to x-pack/plugins/apm/public/selectors/__tests__/mockData/anomalyData.ts
diff --git a/x-pack/legacy/plugins/apm/public/selectors/chartSelectors.ts b/x-pack/plugins/apm/public/selectors/chartSelectors.ts
similarity index 94%
rename from x-pack/legacy/plugins/apm/public/selectors/chartSelectors.ts
rename to x-pack/plugins/apm/public/selectors/chartSelectors.ts
index d60b63e243d71..e6ef9361ee52a 100644
--- a/x-pack/legacy/plugins/apm/public/selectors/chartSelectors.ts
+++ b/x-pack/plugins/apm/public/selectors/chartSelectors.ts
@@ -10,14 +10,14 @@ import { difference, zipObject } from 'lodash';
import mean from 'lodash.mean';
import { rgba } from 'polished';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { TimeSeriesAPIResponse } from '../../../../../plugins/apm/server/lib/transactions/charts';
+import { TimeSeriesAPIResponse } from '../../server/lib/transactions/charts';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { ApmTimeSeriesResponse } from '../../../../../plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform';
+import { ApmTimeSeriesResponse } from '../../server/lib/transactions/charts/get_timeseries_data/transform';
import {
Coordinate,
RectCoordinate,
TimeSeries
-} from '../../../../../plugins/apm/typings/timeseries';
+} from '../../typings/timeseries';
import { asDecimal, tpmUnit, convertTo } from '../utils/formatters';
import { IUrlParams } from '../context/UrlParamsContext/types';
import { getEmptySeries } from '../components/shared/charts/CustomPlot/getEmptySeries';
diff --git a/x-pack/legacy/plugins/apm/public/services/__test__/SessionStorageMock.ts b/x-pack/plugins/apm/public/services/__test__/SessionStorageMock.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/services/__test__/SessionStorageMock.ts
rename to x-pack/plugins/apm/public/services/__test__/SessionStorageMock.ts
diff --git a/x-pack/legacy/plugins/apm/public/services/__test__/callApi.test.ts b/x-pack/plugins/apm/public/services/__test__/callApi.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/services/__test__/callApi.test.ts
rename to x-pack/plugins/apm/public/services/__test__/callApi.test.ts
diff --git a/x-pack/legacy/plugins/apm/public/services/__test__/callApmApi.test.ts b/x-pack/plugins/apm/public/services/__test__/callApmApi.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/services/__test__/callApmApi.test.ts
rename to x-pack/plugins/apm/public/services/__test__/callApmApi.test.ts
diff --git a/x-pack/legacy/plugins/apm/public/services/rest/callApi.ts b/x-pack/plugins/apm/public/services/rest/callApi.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/services/rest/callApi.ts
rename to x-pack/plugins/apm/public/services/rest/callApi.ts
diff --git a/x-pack/legacy/plugins/apm/public/services/rest/createCallApmApi.ts b/x-pack/plugins/apm/public/services/rest/createCallApmApi.ts
similarity index 89%
rename from x-pack/legacy/plugins/apm/public/services/rest/createCallApmApi.ts
rename to x-pack/plugins/apm/public/services/rest/createCallApmApi.ts
index 2fffb40d353fc..1027e8b885d71 100644
--- a/x-pack/legacy/plugins/apm/public/services/rest/createCallApmApi.ts
+++ b/x-pack/plugins/apm/public/services/rest/createCallApmApi.ts
@@ -6,9 +6,9 @@
import { HttpSetup } from 'kibana/public';
import { callApi, FetchOptions } from './callApi';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { APMAPI } from '../../../../../../plugins/apm/server/routes/create_apm_api';
+import { APMAPI } from '../../../server/routes/create_apm_api';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { Client } from '../../../../../../plugins/apm/server/routes/typings';
+import { Client } from '../../../server/routes/typings';
export type APMClient = Client;
export type APMClientOptions = Omit & {
diff --git a/x-pack/legacy/plugins/apm/public/services/rest/index_pattern.ts b/x-pack/plugins/apm/public/services/rest/index_pattern.ts
similarity index 76%
rename from x-pack/legacy/plugins/apm/public/services/rest/index_pattern.ts
rename to x-pack/plugins/apm/public/services/rest/index_pattern.ts
index 1efcc98bbbd66..ac7a0d3cf734b 100644
--- a/x-pack/legacy/plugins/apm/public/services/rest/index_pattern.ts
+++ b/x-pack/plugins/apm/public/services/rest/index_pattern.ts
@@ -12,3 +12,9 @@ export const createStaticIndexPattern = async () => {
pathname: '/api/apm/index_pattern/static'
});
};
+
+export const getApmIndexPatternTitle = async () => {
+ return await callApmApi({
+ pathname: '/api/apm/index_pattern/title'
+ });
+};
diff --git a/x-pack/legacy/plugins/apm/public/services/rest/ml.ts b/x-pack/plugins/apm/public/services/rest/ml.ts
similarity index 91%
rename from x-pack/legacy/plugins/apm/public/services/rest/ml.ts
rename to x-pack/plugins/apm/public/services/rest/ml.ts
index 0cd1bdf907531..b333a08d2eb05 100644
--- a/x-pack/legacy/plugins/apm/public/services/rest/ml.ts
+++ b/x-pack/plugins/apm/public/services/rest/ml.ts
@@ -9,14 +9,14 @@ import {
PROCESSOR_EVENT,
SERVICE_NAME,
TRANSACTION_TYPE
-} from '../../../../../../plugins/apm/common/elasticsearch_fieldnames';
+} from '../../../common/elasticsearch_fieldnames';
import {
getMlJobId,
getMlPrefix,
encodeForMlApi
-} from '../../../../../../plugins/apm/common/ml_job_constants';
+} from '../../../common/ml_job_constants';
import { callApi } from './callApi';
-import { ESFilter } from '../../../../../../plugins/apm/typings/elasticsearch';
+import { ESFilter } from '../../../typings/elasticsearch';
import { callApmApi } from './createCallApmApi';
interface MlResponseItem {
diff --git a/x-pack/legacy/plugins/apm/public/services/rest/watcher.ts b/x-pack/plugins/apm/public/services/rest/watcher.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/services/rest/watcher.ts
rename to x-pack/plugins/apm/public/services/rest/watcher.ts
diff --git a/x-pack/legacy/plugins/apm/public/new-platform/setHelpExtension.ts b/x-pack/plugins/apm/public/setHelpExtension.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/new-platform/setHelpExtension.ts
rename to x-pack/plugins/apm/public/setHelpExtension.ts
diff --git a/x-pack/legacy/plugins/apm/public/style/variables.ts b/x-pack/plugins/apm/public/style/variables.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/style/variables.ts
rename to x-pack/plugins/apm/public/style/variables.ts
diff --git a/x-pack/legacy/plugins/apm/public/new-platform/toggleAppLinkInNav.ts b/x-pack/plugins/apm/public/toggleAppLinkInNav.ts
similarity index 91%
rename from x-pack/legacy/plugins/apm/public/new-platform/toggleAppLinkInNav.ts
rename to x-pack/plugins/apm/public/toggleAppLinkInNav.ts
index c807cebf97525..8204e1a022d7e 100644
--- a/x-pack/legacy/plugins/apm/public/new-platform/toggleAppLinkInNav.ts
+++ b/x-pack/plugins/apm/public/toggleAppLinkInNav.ts
@@ -5,7 +5,7 @@
*/
import { CoreStart } from 'kibana/public';
-import { ConfigSchema } from './plugin';
+import { ConfigSchema } from '.';
export function toggleAppLinkInNav(core: CoreStart, { ui }: ConfigSchema) {
if (ui.enabled === false) {
diff --git a/x-pack/legacy/plugins/apm/public/new-platform/updateBadge.ts b/x-pack/plugins/apm/public/updateBadge.ts
similarity index 99%
rename from x-pack/legacy/plugins/apm/public/new-platform/updateBadge.ts
rename to x-pack/plugins/apm/public/updateBadge.ts
index b3e29bb891c23..10849754313c4 100644
--- a/x-pack/legacy/plugins/apm/public/new-platform/updateBadge.ts
+++ b/x-pack/plugins/apm/public/updateBadge.ts
@@ -10,7 +10,6 @@ import { CoreStart } from 'kibana/public';
export function setReadonlyBadge({ application, chrome }: CoreStart) {
const canSave = application.capabilities.apm.save;
const { setBadge } = chrome;
-
setBadge(
!canSave
? {
diff --git a/x-pack/legacy/plugins/apm/public/utils/__test__/flattenObject.test.ts b/x-pack/plugins/apm/public/utils/__test__/flattenObject.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/utils/__test__/flattenObject.test.ts
rename to x-pack/plugins/apm/public/utils/__test__/flattenObject.test.ts
diff --git a/x-pack/legacy/plugins/apm/public/utils/flattenObject.ts b/x-pack/plugins/apm/public/utils/flattenObject.ts
similarity index 94%
rename from x-pack/legacy/plugins/apm/public/utils/flattenObject.ts
rename to x-pack/plugins/apm/public/utils/flattenObject.ts
index 020bfec2cbd6a..295ea1f9f900f 100644
--- a/x-pack/legacy/plugins/apm/public/utils/flattenObject.ts
+++ b/x-pack/plugins/apm/public/utils/flattenObject.ts
@@ -5,7 +5,7 @@
*/
import { compact, isObject } from 'lodash';
-import { Maybe } from '../../../../../plugins/apm/typings/common';
+import { Maybe } from '../../typings/common';
export interface KeyValuePair {
key: string;
diff --git a/x-pack/legacy/plugins/apm/public/utils/formatters/__test__/datetime.test.ts b/x-pack/plugins/apm/public/utils/formatters/__test__/datetime.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/utils/formatters/__test__/datetime.test.ts
rename to x-pack/plugins/apm/public/utils/formatters/__test__/datetime.test.ts
diff --git a/x-pack/legacy/plugins/apm/public/utils/formatters/__test__/duration.test.ts b/x-pack/plugins/apm/public/utils/formatters/__test__/duration.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/utils/formatters/__test__/duration.test.ts
rename to x-pack/plugins/apm/public/utils/formatters/__test__/duration.test.ts
diff --git a/x-pack/legacy/plugins/apm/public/utils/formatters/__test__/formatters.test.ts b/x-pack/plugins/apm/public/utils/formatters/__test__/formatters.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/utils/formatters/__test__/formatters.test.ts
rename to x-pack/plugins/apm/public/utils/formatters/__test__/formatters.test.ts
diff --git a/x-pack/legacy/plugins/apm/public/utils/formatters/__test__/size.test.ts b/x-pack/plugins/apm/public/utils/formatters/__test__/size.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/utils/formatters/__test__/size.test.ts
rename to x-pack/plugins/apm/public/utils/formatters/__test__/size.test.ts
diff --git a/x-pack/legacy/plugins/apm/public/utils/formatters/datetime.ts b/x-pack/plugins/apm/public/utils/formatters/datetime.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/utils/formatters/datetime.ts
rename to x-pack/plugins/apm/public/utils/formatters/datetime.ts
diff --git a/x-pack/legacy/plugins/apm/public/utils/formatters/duration.ts b/x-pack/plugins/apm/public/utils/formatters/duration.ts
similarity index 96%
rename from x-pack/legacy/plugins/apm/public/utils/formatters/duration.ts
rename to x-pack/plugins/apm/public/utils/formatters/duration.ts
index 681d876ca3beb..39341e1ff4443 100644
--- a/x-pack/legacy/plugins/apm/public/utils/formatters/duration.ts
+++ b/x-pack/plugins/apm/public/utils/formatters/duration.ts
@@ -7,10 +7,10 @@
import { i18n } from '@kbn/i18n';
import moment from 'moment';
import { memoize } from 'lodash';
-import { NOT_AVAILABLE_LABEL } from '../../../../../../plugins/apm/common/i18n';
+import { NOT_AVAILABLE_LABEL } from '../../../common/i18n';
import { asDecimal, asInteger } from './formatters';
import { TimeUnit } from './datetime';
-import { Maybe } from '../../../../../../plugins/apm/typings/common';
+import { Maybe } from '../../../typings/common';
interface FormatterOptions {
defaultValue?: string;
diff --git a/x-pack/legacy/plugins/apm/public/utils/formatters/formatters.ts b/x-pack/plugins/apm/public/utils/formatters/formatters.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/utils/formatters/formatters.ts
rename to x-pack/plugins/apm/public/utils/formatters/formatters.ts
diff --git a/x-pack/legacy/plugins/apm/public/utils/formatters/index.ts b/x-pack/plugins/apm/public/utils/formatters/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/utils/formatters/index.ts
rename to x-pack/plugins/apm/public/utils/formatters/index.ts
diff --git a/x-pack/legacy/plugins/apm/public/utils/formatters/size.ts b/x-pack/plugins/apm/public/utils/formatters/size.ts
similarity index 95%
rename from x-pack/legacy/plugins/apm/public/utils/formatters/size.ts
rename to x-pack/plugins/apm/public/utils/formatters/size.ts
index 8fe6ebf3e573d..2cdf8af1d46de 100644
--- a/x-pack/legacy/plugins/apm/public/utils/formatters/size.ts
+++ b/x-pack/plugins/apm/public/utils/formatters/size.ts
@@ -5,7 +5,7 @@
*/
import { memoize } from 'lodash';
import { asDecimal } from './formatters';
-import { Maybe } from '../../../../../../plugins/apm/typings/common';
+import { Maybe } from '../../../typings/common';
function asKilobytes(value: number) {
return `${asDecimal(value / 1000)} KB`;
diff --git a/x-pack/legacy/plugins/apm/public/utils/getRangeFromTimeSeries.ts b/x-pack/plugins/apm/public/utils/getRangeFromTimeSeries.ts
similarity index 88%
rename from x-pack/legacy/plugins/apm/public/utils/getRangeFromTimeSeries.ts
rename to x-pack/plugins/apm/public/utils/getRangeFromTimeSeries.ts
index 4301ead2fc79f..1865d5ae574a7 100644
--- a/x-pack/legacy/plugins/apm/public/utils/getRangeFromTimeSeries.ts
+++ b/x-pack/plugins/apm/public/utils/getRangeFromTimeSeries.ts
@@ -5,7 +5,7 @@
*/
import { flatten } from 'lodash';
-import { TimeSeries } from '../../../../../plugins/apm/typings/timeseries';
+import { TimeSeries } from '../../typings/timeseries';
export const getRangeFromTimeSeries = (timeseries: TimeSeries[]) => {
const dataPoints = flatten(timeseries.map(series => series.data));
diff --git a/x-pack/legacy/plugins/apm/public/utils/history.ts b/x-pack/plugins/apm/public/utils/history.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/utils/history.ts
rename to x-pack/plugins/apm/public/utils/history.ts
diff --git a/x-pack/legacy/plugins/apm/public/utils/httpStatusCodeToColor.ts b/x-pack/plugins/apm/public/utils/httpStatusCodeToColor.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/public/utils/httpStatusCodeToColor.ts
rename to x-pack/plugins/apm/public/utils/httpStatusCodeToColor.ts
diff --git a/x-pack/legacy/plugins/apm/public/utils/isValidCoordinateValue.ts b/x-pack/plugins/apm/public/utils/isValidCoordinateValue.ts
similarity index 84%
rename from x-pack/legacy/plugins/apm/public/utils/isValidCoordinateValue.ts
rename to x-pack/plugins/apm/public/utils/isValidCoordinateValue.ts
index f7c13603c3535..c36efc232b782 100644
--- a/x-pack/legacy/plugins/apm/public/utils/isValidCoordinateValue.ts
+++ b/x-pack/plugins/apm/public/utils/isValidCoordinateValue.ts
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-import { Maybe } from '../../../../../plugins/apm/typings/common';
+import { Maybe } from '../../typings/common';
export const isValidCoordinateValue = (value: Maybe): value is number =>
value !== null && value !== undefined;
diff --git a/x-pack/legacy/plugins/apm/public/utils/testHelpers.tsx b/x-pack/plugins/apm/public/utils/testHelpers.tsx
similarity index 96%
rename from x-pack/legacy/plugins/apm/public/utils/testHelpers.tsx
rename to x-pack/plugins/apm/public/utils/testHelpers.tsx
index 36c0e18777bfd..def41a1cabd61 100644
--- a/x-pack/legacy/plugins/apm/public/utils/testHelpers.tsx
+++ b/x-pack/plugins/apm/public/utils/testHelpers.tsx
@@ -16,14 +16,14 @@ import { render, waitForElement } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import { MemoryRouter } from 'react-router-dom';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { APMConfig } from '../../../../../plugins/apm/server';
+import { APMConfig } from '../../server';
import { LocationProvider } from '../context/LocationContext';
-import { PromiseReturnType } from '../../../../../plugins/apm/typings/common';
+import { PromiseReturnType } from '../../typings/common';
import {
ESFilter,
ESSearchResponse,
ESSearchRequest
-} from '../../../../../plugins/apm/typings/elasticsearch';
+} from '../../typings/elasticsearch';
import { MockApmPluginContextWrapper } from '../context/ApmPluginContext/MockApmPluginContext';
export function toJson(wrapper: ReactWrapper) {
diff --git a/x-pack/legacy/plugins/apm/readme.md b/x-pack/plugins/apm/readme.md
similarity index 92%
rename from x-pack/legacy/plugins/apm/readme.md
rename to x-pack/plugins/apm/readme.md
index e8e2514c83fcb..62465e920d793 100644
--- a/x-pack/legacy/plugins/apm/readme.md
+++ b/x-pack/plugins/apm/readme.md
@@ -32,7 +32,7 @@ _Docker Compose is required_
### E2E (Cypress) tests
```sh
-x-pack/legacy/plugins/apm/e2e/run-e2e.sh
+x-pack/plugins/apm/e2e/run-e2e.sh
```
_Starts Kibana (:5701), APM Server (:8201) and Elasticsearch (:9201). Ingests sample data into Elasticsearch via APM Server and runs the Cypress tests_
@@ -94,13 +94,13 @@ _Note: Run the following commands from `kibana/`._
#### Prettier
```
-yarn prettier "./x-pack/legacy/plugins/apm/**/*.{tsx,ts,js}" --write
+yarn prettier "./x-pack/plugins/apm/**/*.{tsx,ts,js}" --write
```
#### ESLint
```
-yarn eslint ./x-pack/legacy/plugins/apm --fix
+yarn eslint ./x-pack/plugins/apm --fix
```
### Setup default APM users
@@ -117,7 +117,7 @@ For testing purposes APM uses 3 custom users:
To create the users with the correct roles run the following script:
```sh
-node x-pack/legacy/plugins/apm/scripts/setup-kibana-security.js --role-suffix
+node x-pack/plugins/apm/scripts/setup-kibana-security.js --role-suffix
```
The users will be created with the password specified in kibana.dev.yml for `elasticsearch.password`
diff --git a/x-pack/legacy/plugins/apm/scripts/.gitignore b/x-pack/plugins/apm/scripts/.gitignore
similarity index 100%
rename from x-pack/legacy/plugins/apm/scripts/.gitignore
rename to x-pack/plugins/apm/scripts/.gitignore
diff --git a/x-pack/legacy/plugins/apm/scripts/kibana-security/setup-custom-kibana-user-role.ts b/x-pack/plugins/apm/scripts/kibana-security/setup-custom-kibana-user-role.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/scripts/kibana-security/setup-custom-kibana-user-role.ts
rename to x-pack/plugins/apm/scripts/kibana-security/setup-custom-kibana-user-role.ts
diff --git a/x-pack/legacy/plugins/apm/scripts/optimize-tsconfig.js b/x-pack/plugins/apm/scripts/optimize-tsconfig.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/scripts/optimize-tsconfig.js
rename to x-pack/plugins/apm/scripts/optimize-tsconfig.js
diff --git a/x-pack/legacy/plugins/apm/scripts/optimize-tsconfig/optimize.js b/x-pack/plugins/apm/scripts/optimize-tsconfig/optimize.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/scripts/optimize-tsconfig/optimize.js
rename to x-pack/plugins/apm/scripts/optimize-tsconfig/optimize.js
diff --git a/x-pack/legacy/plugins/apm/scripts/optimize-tsconfig/paths.js b/x-pack/plugins/apm/scripts/optimize-tsconfig/paths.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/scripts/optimize-tsconfig/paths.js
rename to x-pack/plugins/apm/scripts/optimize-tsconfig/paths.js
diff --git a/x-pack/legacy/plugins/apm/scripts/optimize-tsconfig/tsconfig.json b/x-pack/plugins/apm/scripts/optimize-tsconfig/tsconfig.json
similarity index 60%
rename from x-pack/legacy/plugins/apm/scripts/optimize-tsconfig/tsconfig.json
rename to x-pack/plugins/apm/scripts/optimize-tsconfig/tsconfig.json
index 8f6b0f35e4b52..5e05d3962eccb 100644
--- a/x-pack/legacy/plugins/apm/scripts/optimize-tsconfig/tsconfig.json
+++ b/x-pack/plugins/apm/scripts/optimize-tsconfig/tsconfig.json
@@ -1,11 +1,10 @@
{
"include": [
"./plugins/apm/**/*",
- "./legacy/plugins/apm/**/*",
"./typings/**/*"
],
"exclude": [
"**/__fixtures__/**/*",
- "./legacy/plugins/apm/e2e/cypress/**/*"
+ "./plugins/apm/e2e/cypress/**/*"
]
}
diff --git a/x-pack/legacy/plugins/apm/scripts/optimize-tsconfig/unoptimize.js b/x-pack/plugins/apm/scripts/optimize-tsconfig/unoptimize.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/scripts/optimize-tsconfig/unoptimize.js
rename to x-pack/plugins/apm/scripts/optimize-tsconfig/unoptimize.js
diff --git a/x-pack/legacy/plugins/apm/scripts/package.json b/x-pack/plugins/apm/scripts/package.json
similarity index 100%
rename from x-pack/legacy/plugins/apm/scripts/package.json
rename to x-pack/plugins/apm/scripts/package.json
diff --git a/x-pack/legacy/plugins/apm/scripts/setup-kibana-security.js b/x-pack/plugins/apm/scripts/setup-kibana-security.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/scripts/setup-kibana-security.js
rename to x-pack/plugins/apm/scripts/setup-kibana-security.js
diff --git a/x-pack/legacy/plugins/apm/scripts/storybook.js b/x-pack/plugins/apm/scripts/storybook.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/scripts/storybook.js
rename to x-pack/plugins/apm/scripts/storybook.js
diff --git a/x-pack/legacy/plugins/apm/scripts/unoptimize-tsconfig.js b/x-pack/plugins/apm/scripts/unoptimize-tsconfig.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/scripts/unoptimize-tsconfig.js
rename to x-pack/plugins/apm/scripts/unoptimize-tsconfig.js
diff --git a/x-pack/legacy/plugins/apm/scripts/upload-telemetry-data.js b/x-pack/plugins/apm/scripts/upload-telemetry-data.js
similarity index 100%
rename from x-pack/legacy/plugins/apm/scripts/upload-telemetry-data.js
rename to x-pack/plugins/apm/scripts/upload-telemetry-data.js
diff --git a/x-pack/legacy/plugins/apm/scripts/upload-telemetry-data/download-telemetry-template.ts b/x-pack/plugins/apm/scripts/upload-telemetry-data/download-telemetry-template.ts
similarity index 100%
rename from x-pack/legacy/plugins/apm/scripts/upload-telemetry-data/download-telemetry-template.ts
rename to x-pack/plugins/apm/scripts/upload-telemetry-data/download-telemetry-template.ts
diff --git a/x-pack/legacy/plugins/apm/scripts/upload-telemetry-data/generate-sample-documents.ts b/x-pack/plugins/apm/scripts/upload-telemetry-data/generate-sample-documents.ts
similarity index 97%
rename from x-pack/legacy/plugins/apm/scripts/upload-telemetry-data/generate-sample-documents.ts
rename to x-pack/plugins/apm/scripts/upload-telemetry-data/generate-sample-documents.ts
index 8d76063a7fdf6..390609996874b 100644
--- a/x-pack/legacy/plugins/apm/scripts/upload-telemetry-data/generate-sample-documents.ts
+++ b/x-pack/plugins/apm/scripts/upload-telemetry-data/generate-sample-documents.ts
@@ -18,7 +18,7 @@ import {
CollectTelemetryParams,
collectDataTelemetry
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-} from '../../../../../plugins/apm/server/lib/apm_telemetry/collect_data_telemetry';
+} from '../../server/lib/apm_telemetry/collect_data_telemetry';
interface GenerateOptions {
days: number;
diff --git a/x-pack/legacy/plugins/apm/scripts/upload-telemetry-data/index.ts b/x-pack/plugins/apm/scripts/upload-telemetry-data/index.ts
similarity index 98%
rename from x-pack/legacy/plugins/apm/scripts/upload-telemetry-data/index.ts
rename to x-pack/plugins/apm/scripts/upload-telemetry-data/index.ts
index bdc57eac412fc..4f69a3a3bd213 100644
--- a/x-pack/legacy/plugins/apm/scripts/upload-telemetry-data/index.ts
+++ b/x-pack/plugins/apm/scripts/upload-telemetry-data/index.ts
@@ -25,7 +25,7 @@ import { Logger } from 'kibana/server';
// @ts-ignore
import consoleStamp from 'console-stamp';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { CollectTelemetryParams } from '../../../../../plugins/apm/server/lib/apm_telemetry/collect_data_telemetry';
+import { CollectTelemetryParams } from '../../server/lib/apm_telemetry/collect_data_telemetry';
import { downloadTelemetryTemplate } from './download-telemetry-template';
import mapping from '../../mappings.json';
import { generateSampleDocuments } from './generate-sample-documents';
diff --git a/x-pack/plugins/apm/server/feature.ts b/x-pack/plugins/apm/server/feature.ts
new file mode 100644
index 0000000000000..ae0f5510cd80e
--- /dev/null
+++ b/x-pack/plugins/apm/server/feature.ts
@@ -0,0 +1,72 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { i18n } from '@kbn/i18n';
+
+export const APM_FEATURE = {
+ id: 'apm',
+ name: i18n.translate('xpack.apm.featureRegistry.apmFeatureName', {
+ defaultMessage: 'APM'
+ }),
+ order: 900,
+ icon: 'apmApp',
+ navLinkId: 'apm',
+ app: ['apm', 'kibana'],
+ catalogue: ['apm'],
+ // see x-pack/plugins/features/common/feature_kibana_privileges.ts
+ privileges: {
+ all: {
+ app: ['apm', 'kibana'],
+ api: [
+ 'apm',
+ 'apm_write',
+ 'actions-read',
+ 'actions-all',
+ 'alerting-read',
+ 'alerting-all'
+ ],
+ catalogue: ['apm'],
+ savedObject: {
+ all: ['alert', 'action', 'action_task_params'],
+ read: []
+ },
+ ui: [
+ 'show',
+ 'save',
+ 'alerting:show',
+ 'actions:show',
+ 'alerting:save',
+ 'actions:save',
+ 'alerting:delete',
+ 'actions:delete'
+ ]
+ },
+ read: {
+ app: ['apm', 'kibana'],
+ api: [
+ 'apm',
+ 'actions-read',
+ 'actions-all',
+ 'alerting-read',
+ 'alerting-all'
+ ],
+ catalogue: ['apm'],
+ savedObject: {
+ all: ['alert', 'action', 'action_task_params'],
+ read: []
+ },
+ ui: [
+ 'show',
+ 'alerting:show',
+ 'actions:show',
+ 'alerting:save',
+ 'actions:save',
+ 'alerting:delete',
+ 'actions:delete'
+ ]
+ }
+ }
+};
diff --git a/x-pack/plugins/apm/server/index.ts b/x-pack/plugins/apm/server/index.ts
index 77655568a7e9c..9009008790631 100644
--- a/x-pack/plugins/apm/server/index.ts
+++ b/x-pack/plugins/apm/server/index.ts
@@ -73,4 +73,4 @@ export type APMConfig = ReturnType;
export const plugin = (initContext: PluginInitializerContext) =>
new APMPlugin(initContext);
-export { APMPlugin, APMPluginContract } from './plugin';
+export { APMPlugin, APMPluginSetup } from './plugin';
diff --git a/x-pack/plugins/apm/server/lib/errors/distribution/queries.test.ts b/x-pack/plugins/apm/server/lib/errors/distribution/queries.test.ts
index 0d539a09f091b..fcc456c653303 100644
--- a/x-pack/plugins/apm/server/lib/errors/distribution/queries.test.ts
+++ b/x-pack/plugins/apm/server/lib/errors/distribution/queries.test.ts
@@ -8,7 +8,7 @@ import { getErrorDistribution } from './get_distribution';
import {
SearchParamsMock,
inspectSearchParams
-} from '../../../../../../legacy/plugins/apm/public/utils/testHelpers';
+} from '../../../../public/utils/testHelpers';
describe('error distribution queries', () => {
let mock: SearchParamsMock;
diff --git a/x-pack/plugins/apm/server/lib/errors/queries.test.ts b/x-pack/plugins/apm/server/lib/errors/queries.test.ts
index 5b063c2fb2b61..f1e5d31efd4bd 100644
--- a/x-pack/plugins/apm/server/lib/errors/queries.test.ts
+++ b/x-pack/plugins/apm/server/lib/errors/queries.test.ts
@@ -9,7 +9,7 @@ import { getErrorGroups } from './get_error_groups';
import {
SearchParamsMock,
inspectSearchParams
-} from '../../../../../legacy/plugins/apm/public/utils/testHelpers';
+} from '../../../public/utils/testHelpers';
describe('error queries', () => {
let mock: SearchParamsMock;
diff --git a/x-pack/plugins/apm/server/lib/helpers/es_client.ts b/x-pack/plugins/apm/server/lib/helpers/es_client.ts
index c22084dbb7168..de9ab87b69fc8 100644
--- a/x-pack/plugins/apm/server/lib/helpers/es_client.ts
+++ b/x-pack/plugins/apm/server/lib/helpers/es_client.ts
@@ -20,7 +20,7 @@ import {
ESSearchResponse
} from '../../../typings/elasticsearch';
import { OBSERVER_VERSION_MAJOR } from '../../../common/elasticsearch_fieldnames';
-import { pickKeys } from '../../../../../legacy/plugins/apm/public/utils/pickKeys';
+import { pickKeys } from '../../../common/utils/pick_keys';
import { APMRequestHandlerContext } from '../../routes/typings';
import { getApmIndices } from '../settings/apm_indices/get_apm_indices';
diff --git a/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts b/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts
index 8e8cf698a84cf..40a2a0e7216a0 100644
--- a/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts
+++ b/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts
@@ -39,19 +39,6 @@ function getMockRequest() {
_debug: false
}
},
- __LEGACY: {
- server: {
- plugins: {
- elasticsearch: {
- getCluster: jest.fn().mockReturnValue({ callWithInternalUser: {} })
- }
- },
- savedObjects: {
- SavedObjectsClient: jest.fn(),
- getSavedObjectsRepository: jest.fn()
- }
- }
- },
core: {
elasticsearch: {
dataClient: {
diff --git a/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.ts b/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.ts
new file mode 100644
index 0000000000000..b3b40bac7bd54
--- /dev/null
+++ b/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.ts
@@ -0,0 +1,10 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+import { APMRequestHandlerContext } from '../../routes/typings';
+
+export function getApmIndexPatternTitle(context: APMRequestHandlerContext) {
+ return context.config['apm_oss.indexPattern'];
+}
diff --git a/x-pack/plugins/apm/server/lib/metrics/queries.test.ts b/x-pack/plugins/apm/server/lib/metrics/queries.test.ts
index ac4e13ae442cf..f276fa69e20e3 100644
--- a/x-pack/plugins/apm/server/lib/metrics/queries.test.ts
+++ b/x-pack/plugins/apm/server/lib/metrics/queries.test.ts
@@ -12,7 +12,7 @@ import { getThreadCountChart } from './by_agent/java/thread_count';
import {
SearchParamsMock,
inspectSearchParams
-} from '../../../../../legacy/plugins/apm/public/utils/testHelpers';
+} from '../../../public/utils/testHelpers';
import { SERVICE_NODE_NAME_MISSING } from '../../../common/service_nodes';
describe('metrics queries', () => {
diff --git a/x-pack/plugins/apm/server/lib/service_nodes/queries.test.ts b/x-pack/plugins/apm/server/lib/service_nodes/queries.test.ts
index 672d568b3a5e3..80cd94b1549d7 100644
--- a/x-pack/plugins/apm/server/lib/service_nodes/queries.test.ts
+++ b/x-pack/plugins/apm/server/lib/service_nodes/queries.test.ts
@@ -13,7 +13,7 @@ import { getServiceNodes } from './';
import {
SearchParamsMock,
inspectSearchParams
-} from '../../../../../legacy/plugins/apm/public/utils/testHelpers';
+} from '../../../public/utils/testHelpers';
import { getServiceNodeMetadata } from '../services/get_service_node_metadata';
import { SERVICE_NODE_NAME_MISSING } from '../../../common/service_nodes';
diff --git a/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts b/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts
index 0e52982c6de28..614014ee37afc 100644
--- a/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts
+++ b/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts
@@ -7,7 +7,7 @@ import { getServiceAnnotations } from '.';
import {
SearchParamsMock,
inspectSearchParams
-} from '../../../../../../legacy/plugins/apm/public/utils/testHelpers';
+} from '../../../../public/utils/testHelpers';
import noVersions from './__fixtures__/no_versions.json';
import oneVersion from './__fixtures__/one_version.json';
import multipleVersions from './__fixtures__/multiple_versions.json';
diff --git a/x-pack/plugins/apm/server/lib/services/queries.test.ts b/x-pack/plugins/apm/server/lib/services/queries.test.ts
index e75d9ad05648c..16490ace77744 100644
--- a/x-pack/plugins/apm/server/lib/services/queries.test.ts
+++ b/x-pack/plugins/apm/server/lib/services/queries.test.ts
@@ -12,7 +12,7 @@ import { hasHistoricalAgentData } from './get_services/has_historical_agent_data
import {
SearchParamsMock,
inspectSearchParams
-} from '../../../../../legacy/plugins/apm/public/utils/testHelpers';
+} from '../../../public/utils/testHelpers';
describe('services queries', () => {
let mock: SearchParamsMock;
diff --git a/x-pack/plugins/apm/server/lib/settings/agent_configuration/queries.test.ts b/x-pack/plugins/apm/server/lib/settings/agent_configuration/queries.test.ts
index b951b7f350eed..a1a915e6a84a5 100644
--- a/x-pack/plugins/apm/server/lib/settings/agent_configuration/queries.test.ts
+++ b/x-pack/plugins/apm/server/lib/settings/agent_configuration/queries.test.ts
@@ -12,7 +12,7 @@ import { searchConfigurations } from './search_configurations';
import {
SearchParamsMock,
inspectSearchParams
-} from '../../../../../../legacy/plugins/apm/public/utils/testHelpers';
+} from '../../../../public/utils/testHelpers';
import { findExactConfiguration } from './find_exact_configuration';
describe('agent configuration queries', () => {
diff --git a/x-pack/plugins/apm/server/lib/settings/custom_link/create_or_update_custom_link.test.ts b/x-pack/plugins/apm/server/lib/settings/custom_link/create_or_update_custom_link.test.ts
index 9bd6c78797605..5d0bf329368f7 100644
--- a/x-pack/plugins/apm/server/lib/settings/custom_link/create_or_update_custom_link.test.ts
+++ b/x-pack/plugins/apm/server/lib/settings/custom_link/create_or_update_custom_link.test.ts
@@ -5,7 +5,7 @@
*/
import { Setup } from '../../helpers/setup_request';
-import { mockNow } from '../../../../../../legacy/plugins/apm/public/utils/testHelpers';
+import { mockNow } from '../../../../public/utils/testHelpers';
import { CustomLink } from '../../../../common/custom_link/custom_link_types';
import { createOrUpdateCustomLink } from './create_or_update_custom_link';
diff --git a/x-pack/plugins/apm/server/lib/settings/custom_link/get_transaction.test.ts b/x-pack/plugins/apm/server/lib/settings/custom_link/get_transaction.test.ts
index 514e473b8e78c..0254660e3523f 100644
--- a/x-pack/plugins/apm/server/lib/settings/custom_link/get_transaction.test.ts
+++ b/x-pack/plugins/apm/server/lib/settings/custom_link/get_transaction.test.ts
@@ -6,7 +6,7 @@
import {
inspectSearchParams,
SearchParamsMock
-} from '../../../../../../legacy/plugins/apm/public/utils/testHelpers';
+} from '../../../../public/utils/testHelpers';
import { getTransaction } from './get_transaction';
import { Setup } from '../../helpers/setup_request';
import {
diff --git a/x-pack/plugins/apm/server/lib/settings/custom_link/list_custom_links.test.ts b/x-pack/plugins/apm/server/lib/settings/custom_link/list_custom_links.test.ts
index 45610e36786b7..6a67c30bee197 100644
--- a/x-pack/plugins/apm/server/lib/settings/custom_link/list_custom_links.test.ts
+++ b/x-pack/plugins/apm/server/lib/settings/custom_link/list_custom_links.test.ts
@@ -8,7 +8,7 @@ import { listCustomLinks } from './list_custom_links';
import {
inspectSearchParams,
SearchParamsMock
-} from '../../../../../../legacy/plugins/apm/public/utils/testHelpers';
+} from '../../../../public/utils/testHelpers';
import { Setup } from '../../helpers/setup_request';
import {
SERVICE_NAME,
diff --git a/x-pack/plugins/apm/server/lib/traces/queries.test.ts b/x-pack/plugins/apm/server/lib/traces/queries.test.ts
index 0c2ac4d0f9201..871d0fd1c7fb6 100644
--- a/x-pack/plugins/apm/server/lib/traces/queries.test.ts
+++ b/x-pack/plugins/apm/server/lib/traces/queries.test.ts
@@ -8,7 +8,7 @@ import { getTraceItems } from './get_trace_items';
import {
SearchParamsMock,
inspectSearchParams
-} from '../../../../../legacy/plugins/apm/public/utils/testHelpers';
+} from '../../../public/utils/testHelpers';
describe('trace queries', () => {
let mock: SearchParamsMock;
diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/queries.test.ts b/x-pack/plugins/apm/server/lib/transaction_groups/queries.test.ts
index 8d6495c2e0b5f..73122d8580134 100644
--- a/x-pack/plugins/apm/server/lib/transaction_groups/queries.test.ts
+++ b/x-pack/plugins/apm/server/lib/transaction_groups/queries.test.ts
@@ -8,7 +8,7 @@ import { transactionGroupsFetcher } from './fetcher';
import {
SearchParamsMock,
inspectSearchParams
-} from '../../../../../legacy/plugins/apm/public/utils/testHelpers';
+} from '../../../public/utils/testHelpers';
describe('transaction group queries', () => {
let mock: SearchParamsMock;
diff --git a/x-pack/plugins/apm/server/lib/transactions/queries.test.ts b/x-pack/plugins/apm/server/lib/transactions/queries.test.ts
index 116738da5ef9b..a9e4204fde1ad 100644
--- a/x-pack/plugins/apm/server/lib/transactions/queries.test.ts
+++ b/x-pack/plugins/apm/server/lib/transactions/queries.test.ts
@@ -11,7 +11,7 @@ import { getTransaction } from './get_transaction';
import {
SearchParamsMock,
inspectSearchParams
-} from '../../../../../legacy/plugins/apm/public/utils/testHelpers';
+} from '../../../public/utils/testHelpers';
describe('transaction queries', () => {
let mock: SearchParamsMock;
diff --git a/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/queries.test.ts b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/queries.test.ts
index 21cc35da72cb9..b72186f528f28 100644
--- a/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/queries.test.ts
+++ b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/queries.test.ts
@@ -8,7 +8,7 @@ import { getLocalUIFilters } from './';
import {
SearchParamsMock,
inspectSearchParams
-} from '../../../../../../legacy/plugins/apm/public/utils/testHelpers';
+} from '../../../../public/utils/testHelpers';
import { getServicesProjection } from '../../../../common/projections/services';
describe('local ui filter queries', () => {
diff --git a/x-pack/plugins/apm/server/lib/ui_filters/queries.test.ts b/x-pack/plugins/apm/server/lib/ui_filters/queries.test.ts
index 63c8c3e494bb0..079ab64f32db3 100644
--- a/x-pack/plugins/apm/server/lib/ui_filters/queries.test.ts
+++ b/x-pack/plugins/apm/server/lib/ui_filters/queries.test.ts
@@ -8,7 +8,7 @@ import { getEnvironments } from './get_environments';
import {
SearchParamsMock,
inspectSearchParams
-} from '../../../../../legacy/plugins/apm/public/utils/testHelpers';
+} from '../../../public/utils/testHelpers';
describe('ui filter queries', () => {
let mock: SearchParamsMock;
diff --git a/x-pack/plugins/apm/server/plugin.ts b/x-pack/plugins/apm/server/plugin.ts
index b434d41982f4c..8cf29de5b8b73 100644
--- a/x-pack/plugins/apm/server/plugin.ts
+++ b/x-pack/plugins/apm/server/plugin.ts
@@ -10,10 +10,8 @@ import {
CoreStart,
Logger
} from 'src/core/server';
-import { Observable, combineLatest, AsyncSubject } from 'rxjs';
+import { Observable, combineLatest } from 'rxjs';
import { map, take } from 'rxjs/operators';
-import { Server } from 'hapi';
-import { once } from 'lodash';
import { UsageCollectionSetup } from '../../../../src/plugins/usage_collection/server';
import { TaskManagerSetupContract } from '../../task_manager/server';
import { AlertingPlugin } from '../../alerting/server';
@@ -31,24 +29,20 @@ import { getInternalSavedObjectsClient } from './lib/helpers/get_internal_saved_
import { LicensingPluginSetup } from '../../licensing/public';
import { registerApmAlerts } from './lib/alerts/register_apm_alerts';
import { createApmTelemetry } from './lib/apm_telemetry';
+import { PluginSetupContract as FeaturesPluginSetup } from '../../../plugins/features/server';
+import { APM_FEATURE } from './feature';
+import { apmIndices, apmTelemetry } from './saved_objects';
-export interface LegacySetup {
- server: Server;
-}
-
-export interface APMPluginContract {
+export interface APMPluginSetup {
config$: Observable;
- registerLegacyAPI: (__LEGACY: LegacySetup) => void;
getApmIndices: () => ReturnType;
}
-export class APMPlugin implements Plugin {
+export class APMPlugin implements Plugin {
private currentConfig?: APMConfig;
private logger?: Logger;
- legacySetup$: AsyncSubject;
constructor(private readonly initContext: PluginInitializerContext) {
this.initContext = initContext;
- this.legacySetup$ = new AsyncSubject();
}
public async setup(
@@ -62,6 +56,7 @@ export class APMPlugin implements Plugin {
taskManager?: TaskManagerSetupContract;
alerting?: AlertingPlugin['setup'];
actions?: ActionsPlugin['setup'];
+ features: FeaturesPluginSetup;
}
) {
this.logger = this.initContext.logger.get();
@@ -70,6 +65,9 @@ export class APMPlugin implements Plugin {
map(([apmOssConfig, apmConfig]) => mergeConfigs(apmOssConfig, apmConfig))
);
+ core.savedObjects.registerType(apmIndices);
+ core.savedObjects.registerType(apmTelemetry);
+
if (plugins.actions && plugins.alerting) {
registerApmAlerts({
alerting: plugins.alerting,
@@ -78,14 +76,6 @@ export class APMPlugin implements Plugin {
});
}
- this.legacySetup$.subscribe(__LEGACY => {
- createApmApi().init(core, {
- config$: mergedConfig$,
- logger: this.logger!,
- __LEGACY
- });
- });
-
this.currentConfig = await mergedConfig$.pipe(take(1)).toPromise();
if (
@@ -116,13 +106,15 @@ export class APMPlugin implements Plugin {
}
})
);
+ plugins.features.registerFeature(APM_FEATURE);
+
+ createApmApi().init(core, {
+ config$: mergedConfig$,
+ logger: this.logger!
+ });
return {
config$: mergedConfig$,
- registerLegacyAPI: once((__LEGACY: LegacySetup) => {
- this.legacySetup$.next(__LEGACY);
- this.legacySetup$.complete();
- }),
getApmIndices: async () =>
getApmIndices({
savedObjectsClient: await getInternalSavedObjectsClient(core),
diff --git a/x-pack/plugins/apm/server/routes/create_api/index.test.ts b/x-pack/plugins/apm/server/routes/create_api/index.test.ts
index 312dae1d1f9d2..20c586868a979 100644
--- a/x-pack/plugins/apm/server/routes/create_api/index.test.ts
+++ b/x-pack/plugins/apm/server/routes/create_api/index.test.ts
@@ -9,7 +9,6 @@ import { CoreSetup, Logger } from 'src/core/server';
import { Params } from '../typings';
import { BehaviorSubject } from 'rxjs';
import { APMConfig } from '../..';
-import { LegacySetup } from '../../plugin';
const getCoreMock = () => {
const get = jest.fn();
@@ -40,8 +39,7 @@ const getCoreMock = () => {
config$: new BehaviorSubject({} as APMConfig),
logger: ({
error: jest.fn()
- } as unknown) as Logger,
- __LEGACY: {} as LegacySetup
+ } as unknown) as Logger
}
};
};
diff --git a/x-pack/plugins/apm/server/routes/create_api/index.ts b/x-pack/plugins/apm/server/routes/create_api/index.ts
index e216574f8a02e..a97e2f30fc2b6 100644
--- a/x-pack/plugins/apm/server/routes/create_api/index.ts
+++ b/x-pack/plugins/apm/server/routes/create_api/index.ts
@@ -30,7 +30,7 @@ export function createApi() {
factoryFns.push(fn);
return this as any;
},
- init(core, { config$, logger, __LEGACY }) {
+ init(core, { config$, logger }) {
const router = core.http.createRouter();
let config = {} as APMConfig;
@@ -136,7 +136,6 @@ export function createApi() {
request,
context: {
...context,
- __LEGACY,
// Only return values for parameters that have runtime types,
// but always include query as _debug is always set even if
// it's not defined in the route.
diff --git a/x-pack/plugins/apm/server/routes/create_apm_api.ts b/x-pack/plugins/apm/server/routes/create_apm_api.ts
index 57b3f282852c4..7964d8b0268e8 100644
--- a/x-pack/plugins/apm/server/routes/create_apm_api.ts
+++ b/x-pack/plugins/apm/server/routes/create_apm_api.ts
@@ -6,7 +6,8 @@
import {
staticIndexPatternRoute,
- dynamicIndexPatternRoute
+ dynamicIndexPatternRoute,
+ apmIndexPatternTitleRoute
} from './index_pattern';
import {
errorDistributionRoute,
@@ -73,6 +74,7 @@ const createApmApi = () => {
// index pattern
.add(staticIndexPatternRoute)
.add(dynamicIndexPatternRoute)
+ .add(apmIndexPatternTitleRoute)
// Errors
.add(errorDistributionRoute)
diff --git a/x-pack/plugins/apm/server/routes/index_pattern.ts b/x-pack/plugins/apm/server/routes/index_pattern.ts
index b7964dc8e91ed..e296057203ff1 100644
--- a/x-pack/plugins/apm/server/routes/index_pattern.ts
+++ b/x-pack/plugins/apm/server/routes/index_pattern.ts
@@ -8,6 +8,7 @@ import { createStaticIndexPattern } from '../lib/index_pattern/create_static_ind
import { createRoute } from './create_route';
import { setupRequest } from '../lib/helpers/setup_request';
import { getInternalSavedObjectsClient } from '../lib/helpers/get_internal_saved_objects_client';
+import { getApmIndexPatternTitle } from '../lib/index_pattern/get_apm_index_pattern_title';
export const staticIndexPatternRoute = createRoute(core => ({
method: 'POST',
@@ -38,3 +39,10 @@ export const dynamicIndexPatternRoute = createRoute(() => ({
return { dynamicIndexPattern };
}
}));
+
+export const apmIndexPatternTitleRoute = createRoute(() => ({
+ path: '/api/apm/index_pattern/title',
+ handler: async ({ context }) => {
+ return getApmIndexPatternTitle(context);
+ }
+}));
diff --git a/x-pack/plugins/apm/server/routes/typings.ts b/x-pack/plugins/apm/server/routes/typings.ts
index 3dc485630c180..6543f2015599b 100644
--- a/x-pack/plugins/apm/server/routes/typings.ts
+++ b/x-pack/plugins/apm/server/routes/typings.ts
@@ -14,7 +14,8 @@ import {
import { PickByValue, Optional } from 'utility-types';
import { Observable } from 'rxjs';
import { Server } from 'hapi';
-import { FetchOptions } from '../../../../legacy/plugins/apm/public/services/rest/callApi';
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import { FetchOptions } from '../../public/services/rest/callApi';
import { APMConfig } from '..';
export interface Params {
@@ -61,9 +62,6 @@ export type APMRequestHandlerContext<
params: { query: { _debug: boolean } } & TDecodedParams;
config: APMConfig;
logger: Logger;
- __LEGACY: {
- server: APMLegacyServer;
- };
};
export type RouteFactoryFn<
@@ -107,7 +105,6 @@ export interface ServerAPI {
context: {
config$: Observable;
logger: Logger;
- __LEGACY: { server: Server };
}
) => void;
}
diff --git a/x-pack/plugins/apm/server/saved_objects/apm_indices.ts b/x-pack/plugins/apm/server/saved_objects/apm_indices.ts
new file mode 100644
index 0000000000000..c641f4546aae7
--- /dev/null
+++ b/x-pack/plugins/apm/server/saved_objects/apm_indices.ts
@@ -0,0 +1,34 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+import { SavedObjectsType } from 'src/core/server';
+
+export const apmIndices: SavedObjectsType = {
+ name: 'apm-indices',
+ hidden: false,
+ namespaceType: 'agnostic',
+ mappings: {
+ properties: {
+ 'apm_oss.sourcemapIndices': {
+ type: 'keyword'
+ },
+ 'apm_oss.errorIndices': {
+ type: 'keyword'
+ },
+ 'apm_oss.onboardingIndices': {
+ type: 'keyword'
+ },
+ 'apm_oss.spanIndices': {
+ type: 'keyword'
+ },
+ 'apm_oss.transactionIndices': {
+ type: 'keyword'
+ },
+ 'apm_oss.metricsIndices': {
+ type: 'keyword'
+ }
+ }
+ }
+};
diff --git a/x-pack/plugins/apm/server/saved_objects/apm_telemetry.ts b/x-pack/plugins/apm/server/saved_objects/apm_telemetry.ts
new file mode 100644
index 0000000000000..f711e85076e14
--- /dev/null
+++ b/x-pack/plugins/apm/server/saved_objects/apm_telemetry.ts
@@ -0,0 +1,921 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+import { SavedObjectsType } from 'src/core/server';
+
+export const apmTelemetry: SavedObjectsType = {
+ name: 'apm-telemetry',
+ hidden: false,
+ namespaceType: 'agnostic',
+ mappings: {
+ properties: {
+ agents: {
+ properties: {
+ dotnet: {
+ properties: {
+ agent: {
+ properties: {
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ service: {
+ properties: {
+ framework: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ language: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ runtime: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ go: {
+ properties: {
+ agent: {
+ properties: {
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ service: {
+ properties: {
+ framework: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ language: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ runtime: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ java: {
+ properties: {
+ agent: {
+ properties: {
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ service: {
+ properties: {
+ framework: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ language: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ runtime: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ 'js-base': {
+ properties: {
+ agent: {
+ properties: {
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ service: {
+ properties: {
+ framework: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ language: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ runtime: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ nodejs: {
+ properties: {
+ agent: {
+ properties: {
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ service: {
+ properties: {
+ framework: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ language: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ runtime: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ python: {
+ properties: {
+ agent: {
+ properties: {
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ service: {
+ properties: {
+ framework: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ language: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ runtime: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ ruby: {
+ properties: {
+ agent: {
+ properties: {
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ service: {
+ properties: {
+ framework: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ language: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ runtime: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ 'rum-js': {
+ properties: {
+ agent: {
+ properties: {
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ service: {
+ properties: {
+ framework: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ language: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ },
+ runtime: {
+ properties: {
+ composite: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ name: {
+ type: 'keyword',
+ ignore_above: 1024
+ },
+ version: {
+ type: 'keyword',
+ ignore_above: 1024
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ counts: {
+ properties: {
+ agent_configuration: {
+ properties: {
+ all: {
+ type: 'long'
+ }
+ }
+ },
+ error: {
+ properties: {
+ '1d': {
+ type: 'long'
+ },
+ all: {
+ type: 'long'
+ }
+ }
+ },
+ max_error_groups_per_service: {
+ properties: {
+ '1d': {
+ type: 'long'
+ }
+ }
+ },
+ max_transaction_groups_per_service: {
+ properties: {
+ '1d': {
+ type: 'long'
+ }
+ }
+ },
+ metric: {
+ properties: {
+ '1d': {
+ type: 'long'
+ },
+ all: {
+ type: 'long'
+ }
+ }
+ },
+ onboarding: {
+ properties: {
+ '1d': {
+ type: 'long'
+ },
+ all: {
+ type: 'long'
+ }
+ }
+ },
+ services: {
+ properties: {
+ '1d': {
+ type: 'long'
+ }
+ }
+ },
+ sourcemap: {
+ properties: {
+ '1d': {
+ type: 'long'
+ },
+ all: {
+ type: 'long'
+ }
+ }
+ },
+ span: {
+ properties: {
+ '1d': {
+ type: 'long'
+ },
+ all: {
+ type: 'long'
+ }
+ }
+ },
+ traces: {
+ properties: {
+ '1d': {
+ type: 'long'
+ }
+ }
+ },
+ transaction: {
+ properties: {
+ '1d': {
+ type: 'long'
+ },
+ all: {
+ type: 'long'
+ }
+ }
+ }
+ }
+ },
+ cardinality: {
+ properties: {
+ user_agent: {
+ properties: {
+ original: {
+ properties: {
+ all_agents: {
+ properties: {
+ '1d': {
+ type: 'long'
+ }
+ }
+ },
+ rum: {
+ properties: {
+ '1d': {
+ type: 'long'
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ transaction: {
+ properties: {
+ name: {
+ properties: {
+ all_agents: {
+ properties: {
+ '1d': {
+ type: 'long'
+ }
+ }
+ },
+ rum: {
+ properties: {
+ '1d': {
+ type: 'long'
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ has_any_services: {
+ type: 'boolean'
+ },
+ indices: {
+ properties: {
+ all: {
+ properties: {
+ total: {
+ properties: {
+ docs: {
+ properties: {
+ count: {
+ type: 'long'
+ }
+ }
+ },
+ store: {
+ properties: {
+ size_in_bytes: {
+ type: 'long'
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ shards: {
+ properties: {
+ total: {
+ type: 'long'
+ }
+ }
+ }
+ }
+ },
+ integrations: {
+ properties: {
+ ml: {
+ properties: {
+ all_jobs_count: {
+ type: 'long'
+ }
+ }
+ }
+ }
+ },
+ retainment: {
+ properties: {
+ error: {
+ properties: {
+ ms: {
+ type: 'long'
+ }
+ }
+ },
+ metric: {
+ properties: {
+ ms: {
+ type: 'long'
+ }
+ }
+ },
+ onboarding: {
+ properties: {
+ ms: {
+ type: 'long'
+ }
+ }
+ },
+ span: {
+ properties: {
+ ms: {
+ type: 'long'
+ }
+ }
+ },
+ transaction: {
+ properties: {
+ ms: {
+ type: 'long'
+ }
+ }
+ }
+ }
+ },
+ services_per_agent: {
+ properties: {
+ dotnet: {
+ type: 'long',
+ null_value: 0
+ },
+ go: {
+ type: 'long',
+ null_value: 0
+ },
+ java: {
+ type: 'long',
+ null_value: 0
+ },
+ 'js-base': {
+ type: 'long',
+ null_value: 0
+ },
+ nodejs: {
+ type: 'long',
+ null_value: 0
+ },
+ python: {
+ type: 'long',
+ null_value: 0
+ },
+ ruby: {
+ type: 'long',
+ null_value: 0
+ },
+ 'rum-js': {
+ type: 'long',
+ null_value: 0
+ }
+ }
+ },
+ tasks: {
+ properties: {
+ agent_configuration: {
+ properties: {
+ took: {
+ properties: {
+ ms: {
+ type: 'long'
+ }
+ }
+ }
+ }
+ },
+ agents: {
+ properties: {
+ took: {
+ properties: {
+ ms: {
+ type: 'long'
+ }
+ }
+ }
+ }
+ },
+ cardinality: {
+ properties: {
+ took: {
+ properties: {
+ ms: {
+ type: 'long'
+ }
+ }
+ }
+ }
+ },
+ groupings: {
+ properties: {
+ took: {
+ properties: {
+ ms: {
+ type: 'long'
+ }
+ }
+ }
+ }
+ },
+ indices_stats: {
+ properties: {
+ took: {
+ properties: {
+ ms: {
+ type: 'long'
+ }
+ }
+ }
+ }
+ },
+ integrations: {
+ properties: {
+ took: {
+ properties: {
+ ms: {
+ type: 'long'
+ }
+ }
+ }
+ }
+ },
+ processor_events: {
+ properties: {
+ took: {
+ properties: {
+ ms: {
+ type: 'long'
+ }
+ }
+ }
+ }
+ },
+ services: {
+ properties: {
+ took: {
+ properties: {
+ ms: {
+ type: 'long'
+ }
+ }
+ }
+ }
+ },
+ versions: {
+ properties: {
+ took: {
+ properties: {
+ ms: {
+ type: 'long'
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ version: {
+ properties: {
+ apm_server: {
+ properties: {
+ major: {
+ type: 'long'
+ },
+ minor: {
+ type: 'long'
+ },
+ patch: {
+ type: 'long'
+ }
+ }
+ }
+ }
+ }
+ } as SavedObjectsType['mappings']['properties']
+ }
+};
diff --git a/x-pack/plugins/apm/server/saved_objects/index.ts b/x-pack/plugins/apm/server/saved_objects/index.ts
new file mode 100644
index 0000000000000..30c557c526356
--- /dev/null
+++ b/x-pack/plugins/apm/server/saved_objects/index.ts
@@ -0,0 +1,8 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+export { apmIndices } from './apm_indices';
+export { apmTelemetry } from './apm_telemetry';
diff --git a/x-pack/plugins/apm/typings/common.d.ts b/x-pack/plugins/apm/typings/common.d.ts
index bdd2c75f161e9..eeeb85cd1e7c3 100644
--- a/x-pack/plugins/apm/typings/common.d.ts
+++ b/x-pack/plugins/apm/typings/common.d.ts
@@ -4,12 +4,10 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import '../../../legacy/plugins/infra/types/rison_node';
-import '../../../legacy/plugins/infra/types/eui';
+import '../../../typings/rison_node';
+import '../../infra/types/eui';
// EUIBasicTable
-import '../../../legacy/plugins/reporting/public/components/report_listing';
-// .svg
-import '../../../legacy/plugins/canvas/types/webpack';
+import '../../reporting/public/components/report_listing';
// Allow unknown properties in an object
export type AllowUnknownProperties = T extends Array
diff --git a/x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.tsx b/x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.tsx
index 206e9821190fb..a8597b7073c95 100644
--- a/x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.tsx
+++ b/x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.tsx
@@ -9,7 +9,7 @@ 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';
+import { getTraceUrl } from '../../../../../apm/public';
import { LogEntriesItem } from '../../../../common/http_api';
import { useLinkProps, LinkDescriptor } from '../../../hooks/use_link_props';
import { decodeOrThrow } from '../../../../common/runtime_types';
diff --git a/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts b/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts
index 038fd457fb6c7..4bbbf8dcdee03 100644
--- a/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts
+++ b/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts
@@ -11,7 +11,7 @@ import { RouteMethod, RouteConfig } from '../../../../../../../src/core/server';
import { PluginSetupContract as FeaturesPluginSetup } from '../../../../../../plugins/features/server';
import { SpacesPluginSetup } from '../../../../../../plugins/spaces/server';
import { VisTypeTimeseriesSetup } from '../../../../../../../src/plugins/vis_type_timeseries/server';
-import { APMPluginContract } from '../../../../../../plugins/apm/server';
+import { APMPluginSetup } from '../../../../../../plugins/apm/server';
import { HomeServerPluginSetup } from '../../../../../../../src/plugins/home/server';
import { PluginSetupContract as AlertingPluginContract } from '../../../../../../plugins/alerting/server';
@@ -22,7 +22,7 @@ export interface InfraServerPluginDeps {
usageCollection: UsageCollectionSetup;
visTypeTimeseries: VisTypeTimeseriesSetup;
features: FeaturesPluginSetup;
- apm: APMPluginContract;
+ apm: APMPluginSetup;
alerting: AlertingPluginContract;
}
diff --git a/x-pack/plugins/siem/scripts/optimize_tsconfig/README.md b/x-pack/plugins/siem/scripts/optimize_tsconfig/README.md
index 2b402367c1db3..fbcd3329312aa 100644
--- a/x-pack/plugins/siem/scripts/optimize_tsconfig/README.md
+++ b/x-pack/plugins/siem/scripts/optimize_tsconfig/README.md
@@ -1,5 +1,5 @@
Hard forked from here:
-x-pack/legacy/plugins/apm/scripts/optimize-tsconfig.js
+x-pack/plugins/apm/scripts/optimize-tsconfig.js
#### Optimizing TypeScript
diff --git a/x-pack/plugins/siem/server/utils/build_query/calculate_timeseries_interval.ts b/x-pack/plugins/siem/server/utils/build_query/calculate_timeseries_interval.ts
index 5b667f461fc60..78aadf75e54c3 100644
--- a/x-pack/plugins/siem/server/utils/build_query/calculate_timeseries_interval.ts
+++ b/x-pack/plugins/siem/server/utils/build_query/calculate_timeseries_interval.ts
@@ -5,7 +5,7 @@
*/
/*
** Applying the same logic as:
- ** x-pack/legacy/plugins/apm/server/lib/helpers/get_bucket_size/calculate_auto.js
+ ** x-pack/plugins/apm/server/lib/helpers/get_bucket_size/calculate_auto.js
*/
import moment from 'moment';
import { get } from 'lodash/fp';
diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index 4cd152f2d297d..28e290c90687b 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -4184,7 +4184,6 @@
"xpack.apm.alertTypes.errorRate": "エラー率",
"xpack.apm.alertTypes.transactionDuration": "トランザクション期間",
"xpack.apm.apmDescription": "アプリケーション内から自動的に詳細なパフォーマンスメトリックやエラーを集めます。",
- "xpack.apm.apmForESDescription": "Elastic Stack 用の APM",
"xpack.apm.applyFilter": "{title} フィルターを適用",
"xpack.apm.applyOptions": "オプションを適用",
"xpack.apm.breadcrumb.errorsTitle": "エラー",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index 619ea0646eb44..321fd533aab6d 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -4185,7 +4185,6 @@
"xpack.apm.alertTypes.errorRate": "错误率",
"xpack.apm.alertTypes.transactionDuration": "事务持续时间",
"xpack.apm.apmDescription": "自动从您的应用程序内收集深入全面的性能指标和错误。",
- "xpack.apm.apmForESDescription": "Elastic Stack 的 APM",
"xpack.apm.applyFilter": "应用 {title} 筛选",
"xpack.apm.applyOptions": "应用选项",
"xpack.apm.breadcrumb.errorsTitle": "错误",
diff --git a/x-pack/plugins/uptime/public/components/overview/kuery_bar/typeahead/suggestion.js b/x-pack/plugins/uptime/public/components/overview/kuery_bar/typeahead/suggestion.js
index 936eae04ffa64..282cf1311a7a9 100644
--- a/x-pack/plugins/uptime/public/components/overview/kuery_bar/typeahead/suggestion.js
+++ b/x-pack/plugins/uptime/public/components/overview/kuery_bar/typeahead/suggestion.js
@@ -14,7 +14,8 @@ import {
units,
fontSizes,
unit,
-} from '../../../../../../../legacy/plugins/apm/public/style/variables';
+ // eslint-disable-next-line @kbn/eslint/no-restricted-paths
+} from '../../../../../../apm/public/style/variables';
import { tint } from 'polished';
import theme from '@elastic/eui/dist/eui_theme_light.json';
diff --git a/x-pack/plugins/uptime/public/components/overview/kuery_bar/typeahead/suggestions.js b/x-pack/plugins/uptime/public/components/overview/kuery_bar/typeahead/suggestions.js
index ac6832050b9d3..0fdf8c3400562 100644
--- a/x-pack/plugins/uptime/public/components/overview/kuery_bar/typeahead/suggestions.js
+++ b/x-pack/plugins/uptime/public/components/overview/kuery_bar/typeahead/suggestions.js
@@ -9,7 +9,8 @@ import PropTypes from 'prop-types';
import styled from 'styled-components';
import { isEmpty } from 'lodash';
import Suggestion from './suggestion';
-import { units, px, unit } from '../../../../../../../legacy/plugins/apm/public/style/variables';
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import { units, px, unit } from '../../../../../../apm/public/style/variables';
import { tint } from 'polished';
import theme from '@elastic/eui/dist/eui_theme_light.json';
diff --git a/x-pack/tsconfig.json b/x-pack/tsconfig.json
index a540c7e3c9786..81b29732377da 100644
--- a/x-pack/tsconfig.json
+++ b/x-pack/tsconfig.json
@@ -12,7 +12,7 @@
"exclude": [
"test/**/*",
"plugins/siem/cypress/**/*",
- "legacy/plugins/apm/e2e/cypress/**/*",
+ "plugins/apm/e2e/cypress/**/*",
"**/typespec_tests.ts"
],
"compilerOptions": {