diff --git a/x-pack/plugins/apm/public/application/action_menu/anomaly_detection_setup_link.tsx b/x-pack/plugins/apm/public/application/action_menu/anomaly_detection_setup_link.tsx
index d153060bcf94d..8a1d73c818944 100644
--- a/x-pack/plugins/apm/public/application/action_menu/anomaly_detection_setup_link.tsx
+++ b/x-pack/plugins/apm/public/application/action_menu/anomaly_detection_setup_link.tsx
@@ -16,9 +16,9 @@ import {
getEnvironmentLabel,
} from '../../../common/environment_filter_values';
import { getAPMHref } from '../../components/shared/Links/apm/APMLink';
-import { useApmPluginContext } from '../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../context/apm_plugin/use_apm_plugin_context';
import { FETCH_STATUS, useFetcher } from '../../hooks/use_fetcher';
-import { useLicense } from '../../context/license_context/use_license';
+import { useLicenseContext } from '../../context/license/use_license_context';
import { useUrlParams } from '../../context/url_params_context/use_url_params';
import { APIReturnType } from '../../services/rest/createCallApmApi';
import { units } from '../../style/variables';
@@ -32,7 +32,7 @@ export function AnomalyDetectionSetupLink() {
const environment = uiFilters.environment;
const { core } = useApmPluginContext();
const canGetJobs = !!core.application.capabilities.ml?.canGetJobs;
- const license = useLicense();
+ const license = useLicenseContext();
const hasValidLicense = license?.isActive && license?.hasAtLeast('platinum');
const { basePath } = core.http;
diff --git a/x-pack/plugins/apm/public/application/action_menu/index.tsx b/x-pack/plugins/apm/public/application/action_menu/index.tsx
index 91bdecc33409d..438eb2bca7f24 100644
--- a/x-pack/plugins/apm/public/application/action_menu/index.tsx
+++ b/x-pack/plugins/apm/public/application/action_menu/index.tsx
@@ -10,7 +10,7 @@ import React from 'react';
import { useParams } from 'react-router-dom';
import { getAlertingCapabilities } from '../../components/alerting/get_alert_capabilities';
import { getAPMHref } from '../../components/shared/Links/apm/APMLink';
-import { useApmPluginContext } from '../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../context/apm_plugin/use_apm_plugin_context';
import { AlertingPopoverAndFlyout } from './alerting_popover_flyout';
import { AnomalyDetectionSetupLink } from './anomaly_detection_setup_link';
diff --git a/x-pack/plugins/apm/public/application/application.test.tsx b/x-pack/plugins/apm/public/application/application.test.tsx
index d260bdf7a4510..c5091b1b554cc 100644
--- a/x-pack/plugins/apm/public/application/application.test.tsx
+++ b/x-pack/plugins/apm/public/application/application.test.tsx
@@ -8,7 +8,7 @@ import { act } from '@testing-library/react';
import { createMemoryHistory } from 'history';
import { Observable } from 'rxjs';
import { AppMountParameters, CoreStart, HttpSetup } from 'src/core/public';
-import { mockApmPluginContextValue } from '../context/apm_plugin_context/mock_apm_plugin_context';
+import { mockApmPluginContextValue } from '../context/apm_plugin/mock_apm_plugin_context';
import { ApmPluginSetupDeps } from '../plugin';
import { createCallApmApi } from '../services/rest/createCallApmApi';
import { renderApp } from './';
diff --git a/x-pack/plugins/apm/public/application/csmApp.tsx b/x-pack/plugins/apm/public/application/csmApp.tsx
index 9894b9c12beb7..4d16643a83fe9 100644
--- a/x-pack/plugins/apm/public/application/csmApp.tsx
+++ b/x-pack/plugins/apm/public/application/csmApp.tsx
@@ -20,7 +20,7 @@ import { APMRouteDefinition } from '../application/routes';
import { renderAsRedirectTo } from '../components/app/Main/route_config';
import { ScrollToTopOnPathChange } from '../components/app/Main/ScrollToTopOnPathChange';
import { RumHome, UX_LABEL } from '../components/app/RumDashboard/RumHome';
-import { ApmPluginContext } from '../context/apm_plugin_context/apm_plugin_context';
+import { ApmPluginContext } from '../context/apm_plugin/apm_plugin_context';
import { UrlParamsProvider } from '../context/url_params_context/url_params_context';
import { useBreadcrumbs } from '../hooks/use_breadcrumbs';
import { ConfigSchema } from '../index';
diff --git a/x-pack/plugins/apm/public/application/index.tsx b/x-pack/plugins/apm/public/application/index.tsx
index 10e9e850bb6cb..9c4413765a500 100644
--- a/x-pack/plugins/apm/public/application/index.tsx
+++ b/x-pack/plugins/apm/public/application/index.tsx
@@ -25,8 +25,8 @@ import { ScrollToTopOnPathChange } from '../components/app/Main/ScrollToTopOnPat
import {
ApmPluginContext,
ApmPluginContextValue,
-} from '../context/apm_plugin_context/apm_plugin_context';
-import { LicenseProvider } from '../context/license_context/license_context';
+} from '../context/apm_plugin/apm_plugin_context';
+import { LicenseProvider } from '../context/license/license_context';
import { UrlParamsProvider } from '../context/url_params_context/url_params_context';
import { useBreadcrumbs } from '../hooks/use_breadcrumbs';
import { ApmPluginSetupDeps } from '../plugin';
diff --git a/x-pack/plugins/apm/public/components/alerting/ErrorCountAlertTrigger/index.stories.tsx b/x-pack/plugins/apm/public/components/alerting/ErrorCountAlertTrigger/index.stories.tsx
index 3a468abc00873..f4f2be0a6e889 100644
--- a/x-pack/plugins/apm/public/components/alerting/ErrorCountAlertTrigger/index.stories.tsx
+++ b/x-pack/plugins/apm/public/components/alerting/ErrorCountAlertTrigger/index.stories.tsx
@@ -7,11 +7,11 @@
import React from 'react';
import { MemoryRouter } from 'react-router-dom';
import { ErrorCountAlertTrigger } from '.';
-import { ApmPluginContextValue } from '../../../context/apm_plugin_context/apm_plugin_context';
+import { ApmPluginContextValue } from '../../../context/apm_plugin/apm_plugin_context';
import {
mockApmPluginContextValue,
MockApmPluginContextWrapper,
-} from '../../../context/apm_plugin_context/mock_apm_plugin_context';
+} from '../../../context/apm_plugin/mock_apm_plugin_context';
export default {
title: 'app/ErrorCountAlertTrigger',
diff --git a/x-pack/plugins/apm/public/components/alerting/TransactionDurationAlertTrigger/index.stories.tsx b/x-pack/plugins/apm/public/components/alerting/TransactionDurationAlertTrigger/index.stories.tsx
index a00ffb2176f70..8b2d4e235ac25 100644
--- a/x-pack/plugins/apm/public/components/alerting/TransactionDurationAlertTrigger/index.stories.tsx
+++ b/x-pack/plugins/apm/public/components/alerting/TransactionDurationAlertTrigger/index.stories.tsx
@@ -8,11 +8,11 @@ import { cloneDeep, merge } from 'lodash';
import React, { ComponentType } from 'react';
import { MemoryRouter, Route } from 'react-router-dom';
import { TransactionDurationAlertTrigger } from '.';
-import { ApmPluginContextValue } from '../../../context/apm_plugin_context/apm_plugin_context';
+import { ApmPluginContextValue } from '../../../context/apm_plugin/apm_plugin_context';
import {
mockApmPluginContextValue,
MockApmPluginContextWrapper,
-} from '../../../context/apm_plugin_context/mock_apm_plugin_context';
+} from '../../../context/apm_plugin/mock_apm_plugin_context';
import { MockUrlParamsContextProvider } from '../../../context/url_params_context/mock_url_params_context_provider';
export default {
diff --git a/x-pack/plugins/apm/public/components/alerting/TransactionDurationAlertTrigger/index.tsx b/x-pack/plugins/apm/public/components/alerting/TransactionDurationAlertTrigger/index.tsx
index b21370672903e..3566850aa24c4 100644
--- a/x-pack/plugins/apm/public/components/alerting/TransactionDurationAlertTrigger/index.tsx
+++ b/x-pack/plugins/apm/public/components/alerting/TransactionDurationAlertTrigger/index.tsx
@@ -21,7 +21,7 @@ import {
TransactionTypeField,
IsAboveField,
} from '../fields';
-import { useApmService } from '../../../context/apm_service/use_apm_service';
+import { useApmServiceContext } from '../../../context/apm_service/use_apm_service_context';
interface AlertParams {
windowSize: number;
@@ -63,7 +63,7 @@ interface Props {
export function TransactionDurationAlertTrigger(props: Props) {
const { setAlertParams, alertParams, setAlertProperty } = props;
const { urlParams } = useUrlParams();
- const { transactionTypes } = useApmService();
+ const { transactionTypes } = useApmServiceContext();
const { serviceName } = useParams<{ serviceName?: string }>();
const { start, end, transactionType } = urlParams;
const { environmentOptions } = useEnvironmentsFetcher({
diff --git a/x-pack/plugins/apm/public/components/alerting/TransactionDurationAnomalyAlertTrigger/index.tsx b/x-pack/plugins/apm/public/components/alerting/TransactionDurationAnomalyAlertTrigger/index.tsx
index e75fd2c723566..ff5939c601375 100644
--- a/x-pack/plugins/apm/public/components/alerting/TransactionDurationAnomalyAlertTrigger/index.tsx
+++ b/x-pack/plugins/apm/public/components/alerting/TransactionDurationAnomalyAlertTrigger/index.tsx
@@ -23,7 +23,7 @@ import {
ServiceField,
TransactionTypeField,
} from '../fields';
-import { useApmService } from '../../../context/apm_service/use_apm_service';
+import { useApmServiceContext } from '../../../context/apm_service/use_apm_service_context';
interface Params {
windowSize: number;
@@ -47,7 +47,7 @@ interface Props {
export function TransactionDurationAnomalyAlertTrigger(props: Props) {
const { setAlertParams, alertParams, setAlertProperty } = props;
const { urlParams } = useUrlParams();
- const { transactionTypes } = useApmService();
+ const { transactionTypes } = useApmServiceContext();
const { serviceName } = useParams<{ serviceName?: string }>();
const { start, end, transactionType } = urlParams;
const { environmentOptions } = useEnvironmentsFetcher({
diff --git a/x-pack/plugins/apm/public/components/alerting/TransactionErrorRateAlertTrigger/index.tsx b/x-pack/plugins/apm/public/components/alerting/TransactionErrorRateAlertTrigger/index.tsx
index e058f5cee5ce4..f723febde389d 100644
--- a/x-pack/plugins/apm/public/components/alerting/TransactionErrorRateAlertTrigger/index.tsx
+++ b/x-pack/plugins/apm/public/components/alerting/TransactionErrorRateAlertTrigger/index.tsx
@@ -18,7 +18,7 @@ import {
EnvironmentField,
IsAboveField,
} from '../fields';
-import { useApmService } from '../../../context/apm_service/use_apm_service';
+import { useApmServiceContext } from '../../../context/apm_service/use_apm_service_context';
interface AlertParams {
windowSize: number;
@@ -38,7 +38,7 @@ interface Props {
export function TransactionErrorRateAlertTrigger(props: Props) {
const { setAlertParams, alertParams, setAlertProperty } = props;
const { urlParams } = useUrlParams();
- const { transactionTypes } = useApmService();
+ const { transactionTypes } = useApmServiceContext();
const { serviceName } = useParams<{ serviceName?: string }>();
const { start, end, transactionType } = urlParams;
const { environmentOptions } = useEnvironmentsFetcher({
diff --git a/x-pack/plugins/apm/public/components/app/Correlations/index.tsx b/x-pack/plugins/apm/public/components/app/Correlations/index.tsx
index 256bc82504d3f..16a21e28fc08d 100644
--- a/x-pack/plugins/apm/public/components/app/Correlations/index.tsx
+++ b/x-pack/plugins/apm/public/components/app/Correlations/index.tsx
@@ -19,7 +19,7 @@ import {
} from '@elastic/eui';
import { useHistory } from 'react-router-dom';
import { enableCorrelations } from '../../../../common/ui_settings_keys';
-import { useApmPluginContext } from '../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
import { LatencyCorrelations } from './LatencyCorrelations';
import { ErrorCorrelations } from './ErrorCorrelations';
import { useUrlParams } from '../../../context/url_params_context/use_url_params';
diff --git a/x-pack/plugins/apm/public/components/app/ErrorGroupOverview/List/__test__/List.test.tsx b/x-pack/plugins/apm/public/components/app/ErrorGroupOverview/List/__test__/List.test.tsx
index 124f777aa1b91..4022caedadaab 100644
--- a/x-pack/plugins/apm/public/components/app/ErrorGroupOverview/List/__test__/List.test.tsx
+++ b/x-pack/plugins/apm/public/components/app/ErrorGroupOverview/List/__test__/List.test.tsx
@@ -6,7 +6,7 @@
import { mount } from 'enzyme';
import React from 'react';
-import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin/mock_apm_plugin_context';
import { MockUrlParamsContextProvider } from '../../../../../context/url_params_context/mock_url_params_context_provider';
import { mockMoment, toJson } from '../../../../../utils/testHelpers';
import { ErrorGroupList } from '../index';
diff --git a/x-pack/plugins/apm/public/components/app/Home/Home.test.tsx b/x-pack/plugins/apm/public/components/app/Home/Home.test.tsx
index bb432d0cfb6fb..148e0733b93ca 100644
--- a/x-pack/plugins/apm/public/components/app/Home/Home.test.tsx
+++ b/x-pack/plugins/apm/public/components/app/Home/Home.test.tsx
@@ -7,7 +7,7 @@
import { shallow } from 'enzyme';
import React from 'react';
import { Home } from '../Home';
-import { MockApmPluginContextWrapper } from '../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../context/apm_plugin/mock_apm_plugin_context';
describe('Home component', () => {
it('should render services', () => {
diff --git a/x-pack/plugins/apm/public/components/app/ServiceMap/Controls.test.tsx b/x-pack/plugins/apm/public/components/app/ServiceMap/Controls.test.tsx
index 45ec4230b6b90..659f9f63d0cfa 100644
--- a/x-pack/plugins/apm/public/components/app/ServiceMap/Controls.test.tsx
+++ b/x-pack/plugins/apm/public/components/app/ServiceMap/Controls.test.tsx
@@ -9,7 +9,7 @@ import { render } from '@testing-library/react';
import cytoscape from 'cytoscape';
import React, { ReactNode } from 'react';
import { ThemeContext } from 'styled-components';
-import { MockApmPluginContextWrapper } from '../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../context/apm_plugin/mock_apm_plugin_context';
import { Controls } from './Controls';
import { CytoscapeContext } from './Cytoscape';
diff --git a/x-pack/plugins/apm/public/components/app/ServiceMap/Controls.tsx b/x-pack/plugins/apm/public/components/app/ServiceMap/Controls.tsx
index 7822f4e38a5d0..a23fa72314aed 100644
--- a/x-pack/plugins/apm/public/components/app/ServiceMap/Controls.tsx
+++ b/x-pack/plugins/apm/public/components/app/ServiceMap/Controls.tsx
@@ -8,7 +8,7 @@ import { EuiButtonIcon, EuiPanel, EuiToolTip } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React, { useContext, useEffect, useState } from 'react';
import styled from 'styled-components';
-import { useApmPluginContext } from '../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
import { useTheme } from '../../../hooks/use_theme';
import { useUrlParams } from '../../../context/url_params_context/use_url_params';
import { getAPMHref } from '../../shared/Links/apm/APMLink';
diff --git a/x-pack/plugins/apm/public/components/app/ServiceMap/Popover/Buttons.test.tsx b/x-pack/plugins/apm/public/components/app/ServiceMap/Popover/Buttons.test.tsx
index 92d7c6a91dc32..d9f33b8fca4cd 100644
--- a/x-pack/plugins/apm/public/components/app/ServiceMap/Popover/Buttons.test.tsx
+++ b/x-pack/plugins/apm/public/components/app/ServiceMap/Popover/Buttons.test.tsx
@@ -7,7 +7,7 @@
import React, { ReactNode } from 'react';
import { Buttons } from './Buttons';
import { render } from '@testing-library/react';
-import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context';
function Wrapper({ children }: { children?: ReactNode }) {
return {children};
diff --git a/x-pack/plugins/apm/public/components/app/ServiceMap/Popover/Buttons.tsx b/x-pack/plugins/apm/public/components/app/ServiceMap/Popover/Buttons.tsx
index 1e41d1891eaaf..56110a89ed888 100644
--- a/x-pack/plugins/apm/public/components/app/ServiceMap/Popover/Buttons.tsx
+++ b/x-pack/plugins/apm/public/components/app/ServiceMap/Popover/Buttons.tsx
@@ -9,7 +9,7 @@
import { EuiButton, EuiFlexItem } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React, { MouseEvent } from 'react';
-import { useApmPluginContext } from '../../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context';
import { useUrlParams } from '../../../../context/url_params_context/use_url_params';
import { getAPMHref } from '../../../shared/Links/apm/APMLink';
import { APMQueryParams } from '../../../shared/Links/url_helpers';
diff --git a/x-pack/plugins/apm/public/components/app/ServiceMap/Popover/Popover.stories.tsx b/x-pack/plugins/apm/public/components/app/ServiceMap/Popover/Popover.stories.tsx
index f1c29c5f6d210..313b262508c61 100644
--- a/x-pack/plugins/apm/public/components/app/ServiceMap/Popover/Popover.stories.tsx
+++ b/x-pack/plugins/apm/public/components/app/ServiceMap/Popover/Popover.stories.tsx
@@ -8,7 +8,7 @@ import cytoscape from 'cytoscape';
import { HttpSetup } from 'kibana/public';
import React, { ComponentType } from 'react';
import { EuiThemeProvider } from '../../../../../../observability/public';
-import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context';
import { MockUrlParamsContextProvider } from '../../../../context/url_params_context/mock_url_params_context_provider';
import { createCallApmApi } from '../../../../services/rest/createCallApmApi';
import { CytoscapeContext } from '../Cytoscape';
diff --git a/x-pack/plugins/apm/public/components/app/ServiceMap/empty_banner.test.tsx b/x-pack/plugins/apm/public/components/app/ServiceMap/empty_banner.test.tsx
index 1d09081eb1ac4..a1fb7e7077add 100644
--- a/x-pack/plugins/apm/public/components/app/ServiceMap/empty_banner.test.tsx
+++ b/x-pack/plugins/apm/public/components/app/ServiceMap/empty_banner.test.tsx
@@ -7,7 +7,7 @@
import { act, waitFor } from '@testing-library/react';
import cytoscape from 'cytoscape';
import React, { ReactNode } from 'react';
-import { MockApmPluginContextWrapper } from '../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../context/apm_plugin/mock_apm_plugin_context';
import { renderWithTheme } from '../../../utils/testHelpers';
import { CytoscapeContext } from './Cytoscape';
import { EmptyBanner } from './EmptyBanner';
diff --git a/x-pack/plugins/apm/public/components/app/ServiceMap/index.test.tsx b/x-pack/plugins/apm/public/components/app/ServiceMap/index.test.tsx
index 42f97f92e9723..97e507d7cc871 100644
--- a/x-pack/plugins/apm/public/components/app/ServiceMap/index.test.tsx
+++ b/x-pack/plugins/apm/public/components/app/ServiceMap/index.test.tsx
@@ -11,8 +11,8 @@ import { createKibanaReactContext } from 'src/plugins/kibana_react/public';
import { License } from '../../../../../licensing/common/license';
import { EuiThemeProvider } from '../../../../../observability/public';
import { FETCH_STATUS } from '../../../../../observability/public/hooks/use_fetcher';
-import { MockApmPluginContextWrapper } from '../../../context/apm_plugin_context/mock_apm_plugin_context';
-import { LicenseContext } from '../../../context/license_context/license_context';
+import { MockApmPluginContextWrapper } from '../../../context/apm_plugin/mock_apm_plugin_context';
+import { LicenseContext } from '../../../context/license/license_context';
import * as useFetcherModule from '../../../hooks/use_fetcher';
import { ServiceMap } from './';
diff --git a/x-pack/plugins/apm/public/components/app/ServiceMap/index.tsx b/x-pack/plugins/apm/public/components/app/ServiceMap/index.tsx
index e3b41fab07366..48a7f8f77ab84 100644
--- a/x-pack/plugins/apm/public/components/app/ServiceMap/index.tsx
+++ b/x-pack/plugins/apm/public/components/app/ServiceMap/index.tsx
@@ -14,7 +14,7 @@ import {
SERVICE_MAP_TIMEOUT_ERROR,
} from '../../../../common/service_map';
import { FETCH_STATUS, useFetcher } from '../../../hooks/use_fetcher';
-import { useLicense } from '../../../context/license_context/use_license';
+import { useLicenseContext } from '../../../context/license/use_license_context';
import { useTheme } from '../../../hooks/use_theme';
import { useUrlParams } from '../../../context/url_params_context/use_url_params';
import { callApmApi } from '../../../services/rest/createCallApmApi';
@@ -70,7 +70,7 @@ export function ServiceMap({
serviceName,
}: PropsWithChildren) {
const theme = useTheme();
- const license = useLicense();
+ const license = useLicenseContext();
const { urlParams } = useUrlParams();
const { data = { elements: [] }, status, error } = useFetcher(() => {
diff --git a/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/AgentConfigurationCreateEdit/SettingsPage/SettingsPage.tsx b/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/AgentConfigurationCreateEdit/SettingsPage/SettingsPage.tsx
index 108cc65279b8e..7e1146596dd87 100644
--- a/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/AgentConfigurationCreateEdit/SettingsPage/SettingsPage.tsx
+++ b/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/AgentConfigurationCreateEdit/SettingsPage/SettingsPage.tsx
@@ -32,7 +32,7 @@ import {
validateSetting,
} from '../../../../../../../common/agent_configuration/setting_definitions';
import { AgentName } from '../../../../../../../typings/es_schemas/ui/fields/agent';
-import { useApmPluginContext } from '../../../../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../../../../context/apm_plugin/use_apm_plugin_context';
import { FETCH_STATUS } from '../../../../../../hooks/use_fetcher';
import { saveConfig } from './saveConfig';
import { SettingFormRow } from './SettingFormRow';
diff --git a/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/AgentConfigurationCreateEdit/index.stories.tsx b/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/AgentConfigurationCreateEdit/index.stories.tsx
index 8e0ff15a4b8d6..5ca643428e49c 100644
--- a/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/AgentConfigurationCreateEdit/index.stories.tsx
+++ b/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/AgentConfigurationCreateEdit/index.stories.tsx
@@ -20,7 +20,7 @@ import { AgentConfigurationCreateEdit } from './index';
import {
ApmPluginContext,
ApmPluginContextValue,
-} from '../../../../../context/apm_plugin_context/apm_plugin_context';
+} from '../../../../../context/apm_plugin/apm_plugin_context';
import { EuiThemeProvider } from '../../../../../../../observability/public';
storiesOf(
diff --git a/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/List/ConfirmDeleteModal.tsx b/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/List/ConfirmDeleteModal.tsx
index d4defbef5b0e5..958aafa8159df 100644
--- a/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/List/ConfirmDeleteModal.tsx
+++ b/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/List/ConfirmDeleteModal.tsx
@@ -13,7 +13,7 @@ import {
APIReturnType,
callApmApi,
} from '../../../../../services/rest/createCallApmApi';
-import { useApmPluginContext } from '../../../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../../../context/apm_plugin/use_apm_plugin_context';
type Config = APIReturnType<'GET /api/apm/settings/agent-configuration'>[0];
diff --git a/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/List/index.tsx b/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/List/index.tsx
index 373f0e4810a06..be4edbe2ea270 100644
--- a/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/List/index.tsx
+++ b/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/List/index.tsx
@@ -18,7 +18,7 @@ import React, { useState } from 'react';
import { useLocation } from 'react-router-dom';
import { APIReturnType } from '../../../../../services/rest/createCallApmApi';
import { getOptionLabel } from '../../../../../../common/agent_configuration/all_option';
-import { useApmPluginContext } from '../../../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../../../context/apm_plugin/use_apm_plugin_context';
import { FETCH_STATUS } from '../../../../../hooks/use_fetcher';
import { useTheme } from '../../../../../hooks/use_theme';
import { px, units } from '../../../../../style/variables';
diff --git a/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/index.tsx b/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/index.tsx
index 855f5de6c0bd3..c408d5e960cf3 100644
--- a/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/index.tsx
+++ b/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/index.tsx
@@ -16,7 +16,7 @@ import { isEmpty } from 'lodash';
import React from 'react';
import { useLocation } from 'react-router-dom';
import { useTrackPageview } from '../../../../../../observability/public';
-import { useApmPluginContext } from '../../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context';
import { useFetcher } from '../../../../hooks/use_fetcher';
import { createAgentConfigurationHref } from '../../../shared/Links/apm/agentConfigurationLinks';
import { AgentConfigurationList } from './List';
diff --git a/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.test.tsx b/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.test.tsx
index d09baf0dcbfa8..2adf85181886c 100644
--- a/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.test.tsx
+++ b/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.test.tsx
@@ -8,7 +8,7 @@ import { render } from '@testing-library/react';
import React from 'react';
import { ApmIndices } from '.';
import * as hooks from '../../../../hooks/use_fetcher';
-import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context';
describe('ApmIndices', () => {
it('should not get stuck in infinite loop', () => {
diff --git a/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.tsx b/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.tsx
index 5e5c47f107076..5a5d20cde9ade 100644
--- a/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.tsx
+++ b/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.tsx
@@ -22,7 +22,7 @@ import {
import { useFetcher } from '../../../../hooks/use_fetcher';
import { callApmApi } from '../../../../services/rest/createCallApmApi';
import { clearCache } from '../../../../services/rest/callApi';
-import { useApmPluginContext } from '../../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context';
const APM_INDEX_LABELS = [
{
diff --git a/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/CreateEditCustomLinkFlyout/DeleteButton.tsx b/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/CreateEditCustomLinkFlyout/DeleteButton.tsx
index eac9f7dfb9313..ffcb85384642a 100644
--- a/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/CreateEditCustomLinkFlyout/DeleteButton.tsx
+++ b/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/CreateEditCustomLinkFlyout/DeleteButton.tsx
@@ -10,7 +10,7 @@ import { NotificationsStart } from 'kibana/public';
import React, { useState } from 'react';
import { px, unit } from '../../../../../../style/variables';
import { callApmApi } from '../../../../../../services/rest/createCallApmApi';
-import { useApmPluginContext } from '../../../../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../../../../context/apm_plugin/use_apm_plugin_context';
interface Props {
onDelete: () => void;
diff --git a/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/CreateEditCustomLinkFlyout/index.tsx b/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/CreateEditCustomLinkFlyout/index.tsx
index 1c0758f346d90..f9c5aa17e411a 100644
--- a/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/CreateEditCustomLinkFlyout/index.tsx
+++ b/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/CreateEditCustomLinkFlyout/index.tsx
@@ -15,7 +15,7 @@ import {
import { i18n } from '@kbn/i18n';
import React, { useState } from 'react';
import { Filter } from '../../../../../../../common/custom_link/custom_link_types';
-import { useApmPluginContext } from '../../../../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../../../../context/apm_plugin/use_apm_plugin_context';
import { FiltersSection } from './FiltersSection';
import { FlyoutFooter } from './FlyoutFooter';
import { LinkSection } from './LinkSection';
diff --git a/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/index.test.tsx b/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/index.test.tsx
index 5f205fa89cdae..1da7d415b5660 100644
--- a/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/index.test.tsx
+++ b/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/index.test.tsx
@@ -15,14 +15,14 @@ import { act } from 'react-dom/test-utils';
import * as apmApi from '../../../../../services/rest/createCallApmApi';
import { License } from '../../../../../../../licensing/common/license';
import * as hooks from '../../../../../hooks/use_fetcher';
-import { LicenseContext } from '../../../../../context/license_context/license_context';
+import { LicenseContext } from '../../../../../context/license/license_context';
import { CustomLinkOverview } from '.';
import {
expectTextsInDocument,
expectTextsNotInDocument,
} from '../../../../../utils/testHelpers';
import * as saveCustomLink from './CreateEditCustomLinkFlyout/saveCustomLink';
-import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin/mock_apm_plugin_context';
const data = [
{
diff --git a/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/index.tsx b/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/index.tsx
index 2fcacdbe1137e..6b5c7d583ee8a 100644
--- a/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/index.tsx
+++ b/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/index.tsx
@@ -18,7 +18,7 @@ import React, { useEffect, useState } from 'react';
import { INVALID_LICENSE } from '../../../../../../common/custom_link';
import { CustomLink } from '../../../../../../common/custom_link/custom_link_types';
import { FETCH_STATUS, useFetcher } from '../../../../../hooks/use_fetcher';
-import { useLicense } from '../../../../../context/license_context/use_license';
+import { useLicenseContext } from '../../../../../context/license/use_license_context';
import { LicensePrompt } from '../../../../shared/LicensePrompt';
import { CreateCustomLinkButton } from './CreateCustomLinkButton';
import { CreateEditCustomLinkFlyout } from './CreateEditCustomLinkFlyout';
@@ -26,7 +26,7 @@ import { CustomLinkTable } from './CustomLinkTable';
import { EmptyPrompt } from './EmptyPrompt';
export function CustomLinkOverview() {
- const license = useLicense();
+ const license = useLicenseContext();
const hasValidLicense = license?.isActive && license?.hasAtLeast('gold');
const [isFlyoutOpen, setIsFlyoutOpen] = useState(false);
diff --git a/x-pack/plugins/apm/public/components/app/Settings/Settings.test.tsx b/x-pack/plugins/apm/public/components/app/Settings/Settings.test.tsx
index 13aa9321c6ec9..cfef7ca937f66 100644
--- a/x-pack/plugins/apm/public/components/app/Settings/Settings.test.tsx
+++ b/x-pack/plugins/apm/public/components/app/Settings/Settings.test.tsx
@@ -5,7 +5,7 @@
*/
import { render } from '@testing-library/react';
-import { MockApmPluginContextWrapper } from '../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../context/apm_plugin/mock_apm_plugin_context';
import React, { ReactNode } from 'react';
import { Settings } from './';
import { createMemoryHistory } from 'history';
diff --git a/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/add_environments.tsx b/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/add_environments.tsx
index 533fdd3dceaef..e709c7e104472 100644
--- a/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/add_environments.tsx
+++ b/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/add_environments.tsx
@@ -22,7 +22,7 @@ import {
import { i18n } from '@kbn/i18n';
import { ML_ERRORS } from '../../../../../common/anomaly_detection';
import { useFetcher, FETCH_STATUS } from '../../../../hooks/use_fetcher';
-import { useApmPluginContext } from '../../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context';
import { createJobs } from './create_jobs';
import { getEnvironmentLabel } from '../../../../../common/environment_filter_values';
diff --git a/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/index.tsx b/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/index.tsx
index a720b5821e002..addfd64a9ef62 100644
--- a/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/index.tsx
+++ b/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/index.tsx
@@ -9,12 +9,12 @@ import { EuiTitle, EuiSpacer, EuiText } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { EuiPanel, EuiEmptyPrompt } from '@elastic/eui';
import { ML_ERRORS } from '../../../../../common/anomaly_detection';
-import { useApmPluginContext } from '../../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context';
import { JobsList } from './jobs_list';
import { AddEnvironments } from './add_environments';
import { useFetcher } from '../../../../hooks/use_fetcher';
import { LicensePrompt } from '../../../shared/LicensePrompt';
-import { useLicense } from '../../../../context/license_context/use_license';
+import { useLicenseContext } from '../../../../context/license/use_license_context';
import { APIReturnType } from '../../../../services/rest/createCallApmApi';
export type AnomalyDetectionApiResponse = APIReturnType<'GET /api/apm/settings/anomaly-detection/jobs'>;
@@ -27,7 +27,7 @@ const DEFAULT_VALUE: AnomalyDetectionApiResponse = {
export function AnomalyDetection() {
const plugin = useApmPluginContext();
const canGetJobs = !!plugin.core.application.capabilities.ml?.canGetJobs;
- const license = useLicense();
+ const license = useLicenseContext();
const hasValidLicense = license?.isActive && license?.hasAtLeast('platinum');
const [viewAddEnvironments, setViewAddEnvironments] = useState(false);
diff --git a/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/legacy_jobs_callout.tsx b/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/legacy_jobs_callout.tsx
index b95ccdb10554f..9e21eb2ffc870 100644
--- a/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/legacy_jobs_callout.tsx
+++ b/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/legacy_jobs_callout.tsx
@@ -7,7 +7,7 @@
import { EuiCallOut, EuiButton } from '@elastic/eui';
import React from 'react';
import { i18n } from '@kbn/i18n';
-import { useApmPluginContext } from '../../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context';
import { useMlHref } from '../../../../../../ml/public';
export function LegacyJobsCallout() {
diff --git a/x-pack/plugins/apm/public/components/app/Settings/index.tsx b/x-pack/plugins/apm/public/components/app/Settings/index.tsx
index 6f21c5633a57d..e974f05fbe994 100644
--- a/x-pack/plugins/apm/public/components/app/Settings/index.tsx
+++ b/x-pack/plugins/apm/public/components/app/Settings/index.tsx
@@ -16,7 +16,7 @@ import React, { ReactNode } from 'react';
import { RouteComponentProps } from 'react-router-dom';
import { HeaderMenuPortal } from '../../../../../observability/public';
import { ActionMenu } from '../../../application/action_menu';
-import { useApmPluginContext } from '../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
import { getAPMHref } from '../../shared/Links/apm/APMLink';
import { HomeLink } from '../../shared/Links/apm/HomeLink';
diff --git a/x-pack/plugins/apm/public/components/app/TraceLink/trace_link.test.tsx b/x-pack/plugins/apm/public/components/app/TraceLink/trace_link.test.tsx
index fca1b7af55863..c07e00ef387c9 100644
--- a/x-pack/plugins/apm/public/components/app/TraceLink/trace_link.test.tsx
+++ b/x-pack/plugins/apm/public/components/app/TraceLink/trace_link.test.tsx
@@ -8,11 +8,11 @@ import { shallow } from 'enzyme';
import React, { ReactNode } from 'react';
import { MemoryRouter, RouteComponentProps } from 'react-router-dom';
import { TraceLink } from './';
-import { ApmPluginContextValue } from '../../../context/apm_plugin_context/apm_plugin_context';
+import { ApmPluginContextValue } from '../../../context/apm_plugin/apm_plugin_context';
import {
mockApmPluginContextValue,
MockApmPluginContextWrapper,
-} from '../../../context/apm_plugin_context/mock_apm_plugin_context';
+} from '../../../context/apm_plugin/mock_apm_plugin_context';
import * as hooks from '../../../hooks/use_fetcher';
import * as urlParamsHooks from '../../../context/url_params_context/use_url_params';
diff --git a/x-pack/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/WaterfallContainer.stories.tsx b/x-pack/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/WaterfallContainer.stories.tsx
index b65947b3656ad..5217c2abb11dc 100644
--- a/x-pack/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/WaterfallContainer.stories.tsx
+++ b/x-pack/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/WaterfallContainer.stories.tsx
@@ -9,7 +9,7 @@ import { MemoryRouter } from 'react-router-dom';
import { EuiThemeProvider } from '../../../../../../../observability/public';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { TraceAPIResponse } from '../../../../../../server/lib/traces/get_trace';
-import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin/mock_apm_plugin_context';
import { WaterfallContainer } from './index';
import { getWaterfall } from './Waterfall/waterfall_helpers/waterfall_helpers';
import {
diff --git a/x-pack/plugins/apm/public/components/app/service_details/service_detail_tabs.tsx b/x-pack/plugins/apm/public/components/app/service_details/service_detail_tabs.tsx
index 08ee61df6f43a..ae0dd85b6a8b5 100644
--- a/x-pack/plugins/apm/public/components/app/service_details/service_detail_tabs.tsx
+++ b/x-pack/plugins/apm/public/components/app/service_details/service_detail_tabs.tsx
@@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n';
import React, { ReactNode } from 'react';
import { isJavaAgentName, isRumAgentName } from '../../../../common/agent_name';
import { enableServiceOverview } from '../../../../common/ui_settings_keys';
-import { useApmPluginContext } from '../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
import { useErrorOverviewHref } from '../../shared/Links/apm/ErrorOverviewLink';
import { useMetricOverviewHref } from '../../shared/Links/apm/MetricOverviewLink';
import { useServiceMapHref } from '../../shared/Links/apm/ServiceMapLink';
@@ -23,7 +23,7 @@ import { ServiceMetrics } from '../service_metrics';
import { ServiceNodeOverview } from '../ServiceNodeOverview';
import { ServiceOverview } from '../service_overview';
import { TransactionOverview } from '../transaction_overview';
-import { useApmService } from '../../../context/apm_service/use_apm_service';
+import { useApmServiceContext } from '../../../context/apm_service/use_apm_service_context';
interface Tab {
key: string;
@@ -44,7 +44,7 @@ interface Props {
}
export function ServiceDetailTabs({ serviceName, tab }: Props) {
- const { agentName } = useApmService();
+ const { agentName } = useApmServiceContext();
const { uiSettings } = useApmPluginContext().core;
const overviewTab = {
diff --git a/x-pack/plugins/apm/public/components/app/service_inventory/ServiceList/service_list.test.tsx b/x-pack/plugins/apm/public/components/app/service_inventory/ServiceList/service_list.test.tsx
index 568daafc85f18..1c6fa9fe0447e 100644
--- a/x-pack/plugins/apm/public/components/app/service_inventory/ServiceList/service_list.test.tsx
+++ b/x-pack/plugins/apm/public/components/app/service_inventory/ServiceList/service_list.test.tsx
@@ -7,7 +7,7 @@
import React, { ReactNode } from 'react';
import { MemoryRouter } from 'react-router-dom';
import { ServiceHealthStatus } from '../../../../../common/service_health_status';
-import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context';
import { mockMoment, renderWithTheme } from '../../../../utils/testHelpers';
import { APIReturnType } from '../../../../services/rest/createCallApmApi';
import { ServiceList, SERVICE_COLUMNS } from './';
diff --git a/x-pack/plugins/apm/public/components/app/service_inventory/index.tsx b/x-pack/plugins/apm/public/components/app/service_inventory/index.tsx
index 519e60f71c3ab..b1d725bba0ca9 100644
--- a/x-pack/plugins/apm/public/components/app/service_inventory/index.tsx
+++ b/x-pack/plugins/apm/public/components/app/service_inventory/index.tsx
@@ -17,7 +17,7 @@ import url from 'url';
import { toMountPoint } from '../../../../../../../src/plugins/kibana_react/public';
import { useTrackPageview } from '../../../../../observability/public';
import { Projection } from '../../../../common/projections';
-import { useApmPluginContext } from '../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
import { FETCH_STATUS, useFetcher } from '../../../hooks/use_fetcher';
import { useLocalStorage } from '../../../hooks/useLocalStorage';
import { useUrlParams } from '../../../context/url_params_context/use_url_params';
diff --git a/x-pack/plugins/apm/public/components/app/service_inventory/no_services_message.test.tsx b/x-pack/plugins/apm/public/components/app/service_inventory/no_services_message.test.tsx
index efaebb2be1454..cf1ccfbd36aaf 100644
--- a/x-pack/plugins/apm/public/components/app/service_inventory/no_services_message.test.tsx
+++ b/x-pack/plugins/apm/public/components/app/service_inventory/no_services_message.test.tsx
@@ -6,7 +6,7 @@
import { render } from '@testing-library/react';
import React, { ReactNode } from 'react';
-import { MockApmPluginContextWrapper } from '../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../context/apm_plugin/mock_apm_plugin_context';
import { FETCH_STATUS } from '../../../hooks/use_fetcher';
import { NoServicesMessage } from './no_services_message';
diff --git a/x-pack/plugins/apm/public/components/app/service_inventory/service_inventory.test.tsx b/x-pack/plugins/apm/public/components/app/service_inventory/service_inventory.test.tsx
index 636d72c5f3894..1c838a01d05c7 100644
--- a/x-pack/plugins/apm/public/components/app/service_inventory/service_inventory.test.tsx
+++ b/x-pack/plugins/apm/public/components/app/service_inventory/service_inventory.test.tsx
@@ -13,11 +13,11 @@ import { createKibanaReactContext } from 'src/plugins/kibana_react/public';
import { ServiceHealthStatus } from '../../../../common/service_health_status';
import { ServiceInventory } from '.';
import { EuiThemeProvider } from '../../../../../observability/public';
-import { ApmPluginContextValue } from '../../../context/apm_plugin_context/apm_plugin_context';
+import { ApmPluginContextValue } from '../../../context/apm_plugin/apm_plugin_context';
import {
mockApmPluginContextValue,
MockApmPluginContextWrapper,
-} from '../../../context/apm_plugin_context/mock_apm_plugin_context';
+} from '../../../context/apm_plugin/mock_apm_plugin_context';
import { FETCH_STATUS } from '../../../hooks/use_fetcher';
import * as useLocalUIFilters from '../../../hooks/useLocalUIFilters';
import * as useDynamicIndexPatternHooks from '../../../hooks/use_dynamic_index_pattern';
diff --git a/x-pack/plugins/apm/public/components/app/service_node_metrics/index.test.tsx b/x-pack/plugins/apm/public/components/app/service_node_metrics/index.test.tsx
index 1b8ae7ff603a2..0ba45fae15fef 100644
--- a/x-pack/plugins/apm/public/components/app/service_node_metrics/index.test.tsx
+++ b/x-pack/plugins/apm/public/components/app/service_node_metrics/index.test.tsx
@@ -7,7 +7,7 @@
import React from 'react';
import { shallow } from 'enzyme';
import { ServiceNodeMetrics } from '.';
-import { MockApmPluginContextWrapper } from '../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../context/apm_plugin/mock_apm_plugin_context';
import { RouteComponentProps } from 'react-router-dom';
describe('ServiceNodeMetrics', () => {
diff --git a/x-pack/plugins/apm/public/components/app/service_node_metrics/index.tsx b/x-pack/plugins/apm/public/components/app/service_node_metrics/index.tsx
index a4fd2b881a47a..aa1d9cccbdfa6 100644
--- a/x-pack/plugins/apm/public/components/app/service_node_metrics/index.tsx
+++ b/x-pack/plugins/apm/public/components/app/service_node_metrics/index.tsx
@@ -26,7 +26,7 @@ import { ChartPointerEventContextProvider } from '../../../context/chart_pointer
import { FETCH_STATUS, useFetcher } from '../../../hooks/use_fetcher';
import { useServiceMetricChartsFetcher } from '../../../hooks/use_service_metric_charts_fetcher';
import { useUrlParams } from '../../../context/url_params_context/use_url_params';
-import { useApmService } from '../../../context/apm_service/use_apm_service';
+import { useApmServiceContext } from '../../../context/apm_service/use_apm_service_context';
import { px, truncate, unit } from '../../../style/variables';
import { ApmHeader } from '../../shared/ApmHeader';
import { MetricsChart } from '../../shared/charts/metrics_chart';
@@ -58,7 +58,7 @@ type ServiceNodeMetricsProps = RouteComponentProps<{
export function ServiceNodeMetrics({ match }: ServiceNodeMetricsProps) {
const { urlParams, uiFilters } = useUrlParams();
const { serviceName, serviceNodeName } = match.params;
- const { agentName } = useApmService();
+ const { agentName } = useApmServiceContext();
const { data } = useServiceMetricChartsFetcher({ serviceNodeName });
const { start, end } = urlParams;
diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview.test.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview.test.tsx
index 5b26c1fdd71dd..faef450d6b5bb 100644
--- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview.test.tsx
+++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview.test.tsx
@@ -8,16 +8,16 @@ import React, { ReactNode } from 'react';
import { MemoryRouter } from 'react-router-dom';
import { CoreStart } from 'src/core/public';
import { createKibanaReactContext } from '../../../../../../../src/plugins/kibana_react/public';
-import { ApmPluginContextValue } from '../../../context/apm_plugin_context/apm_plugin_context';
+import { ApmPluginContextValue } from '../../../context/apm_plugin/apm_plugin_context';
import {
mockApmPluginContextValue,
MockApmPluginContextWrapper,
-} from '../../../context/apm_plugin_context/mock_apm_plugin_context';
+} from '../../../context/apm_plugin/mock_apm_plugin_context';
import { MockUrlParamsContextProvider } from '../../../context/url_params_context/mock_url_params_context_provider';
import * as useDynamicIndexPatternHooks from '../../../hooks/use_dynamic_index_pattern';
import * as useFetcherHooks from '../../../hooks/use_fetcher';
import { FETCH_STATUS } from '../../../hooks/use_fetcher';
-import * as useAnnotationsHooks from '../../../context/annotations/use_annotations';
+import * as useAnnotationsHooks from '../../../context/annotations/use_annotations_context';
import * as useTransactionBreakdownHooks from '../../shared/charts/transaction_breakdown_chart/use_transaction_breakdown';
import { renderWithTheme } from '../../../utils/testHelpers';
import { ServiceOverview } from './';
diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_throughput_chart.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_throughput_chart.tsx
index a0503d0460847..1662f44d1e421 100644
--- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_throughput_chart.tsx
+++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_throughput_chart.tsx
@@ -12,7 +12,7 @@ import { asTransactionRate } from '../../../../common/utils/formatters';
import { useFetcher } from '../../../hooks/use_fetcher';
import { useTheme } from '../../../hooks/use_theme';
import { useUrlParams } from '../../../context/url_params_context/use_url_params';
-import { useApmService } from '../../../context/apm_service/use_apm_service';
+import { useApmServiceContext } from '../../../context/apm_service/use_apm_service_context';
import { callApmApi } from '../../../services/rest/createCallApmApi';
import { TimeseriesChart } from '../../shared/charts/timeseries_chart';
@@ -24,7 +24,7 @@ export function ServiceOverviewThroughputChart({
const theme = useTheme();
const { serviceName } = useParams<{ serviceName?: string }>();
const { urlParams, uiFilters } = useUrlParams();
- const { transactionType } = useApmService();
+ const { transactionType } = useApmServiceContext();
const { start, end } = urlParams;
const { data, status } = useFetcher(() => {
diff --git a/x-pack/plugins/apm/public/components/app/transaction_overview/TransactionList/TransactionList.stories.tsx b/x-pack/plugins/apm/public/components/app/transaction_overview/TransactionList/TransactionList.stories.tsx
index a8e11c12f0436..c14c31afe0445 100644
--- a/x-pack/plugins/apm/public/components/app/transaction_overview/TransactionList/TransactionList.stories.tsx
+++ b/x-pack/plugins/apm/public/components/app/transaction_overview/TransactionList/TransactionList.stories.tsx
@@ -7,7 +7,7 @@
import React, { ComponentType } from 'react';
import { MemoryRouter } from 'react-router-dom';
import { APIReturnType } from '../../../../services/rest/createCallApmApi';
-import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context';
import { TransactionList } from './';
type TransactionGroup = APIReturnType<'GET /api/apm/services/{serviceName}/transaction_groups'>['items'][0];
diff --git a/x-pack/plugins/apm/public/components/app/transaction_overview/index.tsx b/x-pack/plugins/apm/public/components/app/transaction_overview/index.tsx
index 17f798d73b52d..9ff4ad916b174 100644
--- a/x-pack/plugins/apm/public/components/app/transaction_overview/index.tsx
+++ b/x-pack/plugins/apm/public/components/app/transaction_overview/index.tsx
@@ -37,7 +37,7 @@ import { Correlations } from '../Correlations';
import { TransactionList } from './TransactionList';
import { useRedirect } from './useRedirect';
import { UserExperienceCallout } from './user_experience_callout';
-import { useApmService } from '../../../context/apm_service/use_apm_service';
+import { useApmServiceContext } from '../../../context/apm_service/use_apm_service_context';
function getRedirectLocation({
location,
@@ -68,7 +68,7 @@ interface TransactionOverviewProps {
export function TransactionOverview({ serviceName }: TransactionOverviewProps) {
const location = useLocation();
const { urlParams } = useUrlParams();
- const { transactionType, transactionTypes } = useApmService();
+ const { transactionType, transactionTypes } = useApmServiceContext();
// redirect to first transaction type
useRedirect(getRedirectLocation({ location, transactionType, urlParams }));
diff --git a/x-pack/plugins/apm/public/components/app/transaction_overview/transaction_overview.test.tsx b/x-pack/plugins/apm/public/components/app/transaction_overview/transaction_overview.test.tsx
index 1e18510d90ab2..93d56ea19024e 100644
--- a/x-pack/plugins/apm/public/components/app/transaction_overview/transaction_overview.test.tsx
+++ b/x-pack/plugins/apm/public/components/app/transaction_overview/transaction_overview.test.tsx
@@ -10,7 +10,7 @@ import { CoreStart } from 'kibana/public';
import React from 'react';
import { Router } from 'react-router-dom';
import { createKibanaReactContext } from 'src/plugins/kibana_react/public';
-import { MockApmPluginContextWrapper } from '../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../context/apm_plugin/mock_apm_plugin_context';
import { ApmServiceContextProvider } from '../../../context/apm_service/apm_service_context';
import { UrlParamsProvider } from '../../../context/url_params_context/url_params_context';
import { IUrlParams } from '../../../context/url_params_context/types';
diff --git a/x-pack/plugins/apm/public/components/app/transaction_overview/user_experience_callout.tsx b/x-pack/plugins/apm/public/components/app/transaction_overview/user_experience_callout.tsx
index 76dcc7f329b2b..6e1154a458d6e 100644
--- a/x-pack/plugins/apm/public/components/app/transaction_overview/user_experience_callout.tsx
+++ b/x-pack/plugins/apm/public/components/app/transaction_overview/user_experience_callout.tsx
@@ -7,7 +7,7 @@
import React from 'react';
import { EuiButton, EuiCallOut, EuiSpacer, EuiText } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
-import { useApmPluginContext } from '../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
export function UserExperienceCallout() {
const { core } = useApmPluginContext();
diff --git a/x-pack/plugins/apm/public/components/shared/ApmHeader/apm_header.stories.tsx b/x-pack/plugins/apm/public/components/shared/ApmHeader/apm_header.stories.tsx
index 28a8d46054671..dd88b1ea7eb73 100644
--- a/x-pack/plugins/apm/public/components/shared/ApmHeader/apm_header.stories.tsx
+++ b/x-pack/plugins/apm/public/components/shared/ApmHeader/apm_header.stories.tsx
@@ -8,7 +8,7 @@ import { EuiTitle } from '@elastic/eui';
import React, { ComponentType } from 'react';
import { MemoryRouter } from 'react-router-dom';
import { HttpSetup } from '../../../../../../../src/core/public';
-import { MockApmPluginContextWrapper } from '../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../context/apm_plugin/mock_apm_plugin_context';
import { MockUrlParamsContextProvider } from '../../../context/url_params_context/mock_url_params_context_provider';
import { createCallApmApi } from '../../../services/rest/createCallApmApi';
import { ApmHeader } from './';
diff --git a/x-pack/plugins/apm/public/components/shared/ApmHeader/index.tsx b/x-pack/plugins/apm/public/components/shared/ApmHeader/index.tsx
index 9d4b3e453341c..04e03cda6a61e 100644
--- a/x-pack/plugins/apm/public/components/shared/ApmHeader/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/ApmHeader/index.tsx
@@ -9,7 +9,7 @@ import React, { ReactNode } from 'react';
import styled from 'styled-components';
import { HeaderMenuPortal } from '../../../../../observability/public';
import { ActionMenu } from '../../../application/action_menu';
-import { useApmPluginContext } from '../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
import { EnvironmentFilter } from '../EnvironmentFilter';
const HeaderFlexGroup = styled(EuiFlexGroup)`
diff --git a/x-pack/plugins/apm/public/components/shared/DatePicker/date_picker.test.tsx b/x-pack/plugins/apm/public/components/shared/DatePicker/date_picker.test.tsx
index 97f74d6d1d9b5..222c27cc7ed6d 100644
--- a/x-pack/plugins/apm/public/components/shared/DatePicker/date_picker.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/DatePicker/date_picker.test.tsx
@@ -10,7 +10,7 @@ import { mount } from 'enzyme';
import { createMemoryHistory } from 'history';
import React, { ReactNode } from 'react';
import { Router } from 'react-router-dom';
-import { MockApmPluginContextWrapper } from '../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../context/apm_plugin/mock_apm_plugin_context';
import {
UrlParamsContext,
useUiFilters,
diff --git a/x-pack/plugins/apm/public/components/shared/DatePicker/index.tsx b/x-pack/plugins/apm/public/components/shared/DatePicker/index.tsx
index c378c67a03096..f847ce0b6e96f 100644
--- a/x-pack/plugins/apm/public/components/shared/DatePicker/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/DatePicker/index.tsx
@@ -8,7 +8,7 @@ import { EuiSuperDatePicker } from '@elastic/eui';
import React, { useEffect } from 'react';
import { useHistory, useLocation } from 'react-router-dom';
import { UI_SETTINGS } from '../../../../../../../src/plugins/data/common';
-import { useApmPluginContext } from '../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
import { useUrlParams } from '../../../context/url_params_context/use_url_params';
import { clearCache } from '../../../services/rest/callApi';
import { fromQuery, toQuery } from '../Links/url_helpers';
diff --git a/x-pack/plugins/apm/public/components/shared/KueryBar/index.tsx b/x-pack/plugins/apm/public/components/shared/KueryBar/index.tsx
index e0b7240caa09e..5284e3f6aa011 100644
--- a/x-pack/plugins/apm/public/components/shared/KueryBar/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/KueryBar/index.tsx
@@ -14,7 +14,7 @@ import {
IIndexPattern,
QuerySuggestion,
} from '../../../../../../../src/plugins/data/public';
-import { useApmPluginContext } from '../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
import { useDynamicIndexPatternFetcher } from '../../../hooks/use_dynamic_index_pattern';
import { useUrlParams } from '../../../context/url_params_context/use_url_params';
import { fromQuery, toQuery } from '../Links/url_helpers';
diff --git a/x-pack/plugins/apm/public/components/shared/LicensePrompt/LicensePrompt.stories.tsx b/x-pack/plugins/apm/public/components/shared/LicensePrompt/LicensePrompt.stories.tsx
index 095124ef5ca0d..bd68e7db77714 100644
--- a/x-pack/plugins/apm/public/components/shared/LicensePrompt/LicensePrompt.stories.tsx
+++ b/x-pack/plugins/apm/public/components/shared/LicensePrompt/LicensePrompt.stories.tsx
@@ -9,7 +9,7 @@ import { LicensePrompt } from '.';
import {
ApmPluginContext,
ApmPluginContextValue,
-} from '../../../context/apm_plugin_context/apm_plugin_context';
+} from '../../../context/apm_plugin/apm_plugin_context';
const contextMock = ({
core: { http: { basePath: { prepend: () => {} } } },
diff --git a/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverLink.tsx
index 2bfe3a3fd1ef3..70286655bba88 100644
--- a/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverLink.tsx
@@ -12,7 +12,7 @@ import { useLocation } from 'react-router-dom';
import rison, { RisonValue } from 'rison-node';
import url from 'url';
import { APM_STATIC_INDEX_PATTERN_ID } from '../../../../../../../../src/plugins/apm_oss/public';
-import { useApmPluginContext } from '../../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context';
import { getTimepickerRisonData } from '../rison_helpers';
interface Props {
diff --git a/x-pack/plugins/apm/public/components/shared/Links/ElasticDocsLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/ElasticDocsLink.tsx
index c1f58ef0f772c..e2447cc7a67a5 100644
--- a/x-pack/plugins/apm/public/components/shared/Links/ElasticDocsLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/ElasticDocsLink.tsx
@@ -6,7 +6,7 @@
import { EuiLink, EuiLinkAnchorProps } from '@elastic/eui';
import React from 'react';
-import { useApmPluginContext } from '../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
// union type constisting of valid guide sections that we link to
type DocsSection = '/apm/get-started' | '/x-pack' | '/apm/server' | '/kibana';
diff --git a/x-pack/plugins/apm/public/components/shared/Links/InfraLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/InfraLink.tsx
index 71926c763192c..6d4bbbbfc2f80 100644
--- a/x-pack/plugins/apm/public/components/shared/Links/InfraLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/InfraLink.tsx
@@ -9,7 +9,7 @@ import { IBasePath } from 'kibana/public';
import React from 'react';
import url from 'url';
import { InfraAppId } from '../../../../../infra/public';
-import { useApmPluginContext } from '../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
import { fromQuery } from './url_helpers';
interface InfraQueryParams {
diff --git a/x-pack/plugins/apm/public/components/shared/Links/KibanaLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/KibanaLink.tsx
index 53c2206a87a0b..ab44374f48167 100644
--- a/x-pack/plugins/apm/public/components/shared/Links/KibanaLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/KibanaLink.tsx
@@ -7,7 +7,7 @@
import { EuiLink, EuiLinkAnchorProps } from '@elastic/eui';
import React from 'react';
import url from 'url';
-import { useApmPluginContext } from '../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
interface Props extends EuiLinkAnchorProps {
path?: string;
diff --git a/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLLink.tsx
index 5fa55cde6a224..7bf017fb239e3 100644
--- a/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLLink.tsx
@@ -6,7 +6,7 @@
import { EuiLink } from '@elastic/eui';
import React from 'react';
-import { useApmPluginContext } from '../../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context';
import { useMlHref, ML_PAGES } from '../../../../../../ml/public';
import { useUrlParams } from '../../../../context/url_params_context/use_url_params';
diff --git a/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/useTimeSeriesExplorerHref.ts b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/useTimeSeriesExplorerHref.ts
index 20ed2022355bf..eabef034bf3d9 100644
--- a/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/useTimeSeriesExplorerHref.ts
+++ b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/useTimeSeriesExplorerHref.ts
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { useApmPluginContext } from '../../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context';
import { useMlHref } from '../../../../../../ml/public';
import { useUrlParams } from '../../../../context/url_params_context/use_url_params';
diff --git a/x-pack/plugins/apm/public/components/shared/Links/SetupInstructionsLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/SetupInstructionsLink.tsx
index be968a164285b..68bee36dbe283 100644
--- a/x-pack/plugins/apm/public/components/shared/Links/SetupInstructionsLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/SetupInstructionsLink.tsx
@@ -7,7 +7,7 @@
import { EuiButton, EuiButtonEmpty, EuiLink } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
-import { useApmPluginContext } from '../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
const SETUP_INSTRUCTIONS_LABEL = i18n.translate(
'xpack.apm.setupInstructionsButtonLabel',
diff --git a/x-pack/plugins/apm/public/components/shared/Links/apm/APMLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/APMLink.tsx
index 3c0b6f0cd6fbe..98046193e3807 100644
--- a/x-pack/plugins/apm/public/components/shared/Links/apm/APMLink.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Links/apm/APMLink.tsx
@@ -11,7 +11,7 @@ import React from 'react';
import { useLocation } from 'react-router-dom';
import url from 'url';
import { pickKeys } from '../../../../../common/utils/pick_keys';
-import { useApmPluginContext } from '../../../../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context';
import { useUrlParams } from '../../../../context/url_params_context/use_url_params';
import { APMQueryParams, fromQuery, toQuery } from '../url_helpers';
diff --git a/x-pack/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
index 6af67c70a61c8..8f44d98cecdf7 100644
--- a/x-pack/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
@@ -9,7 +9,7 @@ import React, { ReactNode } from 'react';
import { MemoryRouter } from 'react-router-dom';
import { ErrorMetadata } from '..';
import { APMError } from '../../../../../../typings/es_schemas/ui/apm_error';
-import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin/mock_apm_plugin_context';
import {
expectTextsInDocument,
expectTextsNotInDocument,
diff --git a/x-pack/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
index bccc3f0891d4b..c97e506187347 100644
--- a/x-pack/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
@@ -9,7 +9,7 @@ import React, { ReactNode } from 'react';
import { MemoryRouter } from 'react-router-dom';
import { SpanMetadata } from '..';
import { Span } from '../../../../../../typings/es_schemas/ui/span';
-import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin/mock_apm_plugin_context';
import {
expectTextsInDocument,
expectTextsNotInDocument,
diff --git a/x-pack/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
index 0fde9096af726..4080a300ba17f 100644
--- a/x-pack/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
@@ -9,7 +9,7 @@ import React, { ReactNode } from 'react';
import { MemoryRouter } from 'react-router-dom';
import { TransactionMetadata } from '..';
import { Transaction } from '../../../../../../typings/es_schemas/ui/transaction';
-import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin/mock_apm_plugin_context';
import {
expectTextsInDocument,
expectTextsNotInDocument,
diff --git a/x-pack/plugins/apm/public/components/shared/MetadataTable/__test__/MetadataTable.test.tsx b/x-pack/plugins/apm/public/components/shared/MetadataTable/__test__/MetadataTable.test.tsx
index 29c387424788f..8a4cd588c8260 100644
--- a/x-pack/plugins/apm/public/components/shared/MetadataTable/__test__/MetadataTable.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/MetadataTable/__test__/MetadataTable.test.tsx
@@ -8,7 +8,7 @@ import { render } from '@testing-library/react';
import React, { ReactNode } from 'react';
import { MemoryRouter } from 'react-router-dom';
import { MetadataTable } from '..';
-import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context';
import { expectTextsInDocument } from '../../../../utils/testHelpers';
import { SectionsWithRows } from '../helper';
diff --git a/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLinkMenuSection/CustomLinkToolbar.test.tsx b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLinkMenuSection/CustomLinkToolbar.test.tsx
index 792c506e5a5e0..777200099976e 100644
--- a/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLinkMenuSection/CustomLinkToolbar.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLinkMenuSection/CustomLinkToolbar.test.tsx
@@ -7,7 +7,7 @@
import { act, fireEvent, render } from '@testing-library/react';
import React, { ReactNode } from 'react';
import { MemoryRouter } from 'react-router-dom';
-import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context';
import {
expectTextsInDocument,
expectTextsNotInDocument,
diff --git a/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLinkMenuSection/index.test.tsx b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLinkMenuSection/index.test.tsx
index 476bda7ab5871..c4547595645a2 100644
--- a/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLinkMenuSection/index.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/CustomLinkMenuSection/index.test.tsx
@@ -10,7 +10,7 @@ import { MemoryRouter } from 'react-router-dom';
import { CustomLinkMenuSection } from '.';
import { CustomLink as CustomLinkType } from '../../../../../common/custom_link/custom_link_types';
import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
-import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context';
import * as useFetcher from '../../../../hooks/use_fetcher';
import {
expectTextsInDocument,
diff --git a/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/TransactionActionMenu.tsx b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/TransactionActionMenu.tsx
index 1b01066e12d53..3f74b80bab064 100644
--- a/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/TransactionActionMenu.tsx
+++ b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/TransactionActionMenu.tsx
@@ -18,8 +18,8 @@ import {
SectionTitle,
} from '../../../../../observability/public';
import { Transaction } from '../../../../typings/es_schemas/ui/transaction';
-import { useApmPluginContext } from '../../../context/apm_plugin_context/use_apm_plugin_context';
-import { useLicense } from '../../../context/license_context/use_license';
+import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
+import { useLicenseContext } from '../../../context/license/use_license_context';
import { useUrlParams } from '../../../context/url_params_context/use_url_params';
import { CustomLinkMenuSection } from './CustomLinkMenuSection';
import { getSections } from './sections';
@@ -39,7 +39,7 @@ function ActionMenuButton({ onClick }: { onClick: () => void }) {
}
export function TransactionActionMenu({ transaction }: Props) {
- const license = useLicense();
+ const license = useLicenseContext();
const hasGoldLicense = license?.isActive && license?.hasAtLeast('gold');
const { core } = useApmPluginContext();
diff --git a/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/__test__/TransactionActionMenu.test.tsx b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/__test__/TransactionActionMenu.test.tsx
index 360cb2c8ff521..8cb863c8fc385 100644
--- a/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/__test__/TransactionActionMenu.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/TransactionActionMenu/__test__/TransactionActionMenu.test.tsx
@@ -9,8 +9,8 @@ import React from 'react';
import { MemoryRouter } from 'react-router-dom';
import { License } from '../../../../../../licensing/common/license';
import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
-import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin_context/mock_apm_plugin_context';
-import { LicenseContext } from '../../../../context/license_context/license_context';
+import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context';
+import { LicenseContext } from '../../../../context/license/license_context';
import * as hooks from '../../../../hooks/use_fetcher';
import * as apmApi from '../../../../services/rest/createCallApmApi';
import {
diff --git a/x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/ErrorMarker.test.tsx b/x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/ErrorMarker.test.tsx
index d6155eb76ec36..e69b23cf5f008 100644
--- a/x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/ErrorMarker.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/ErrorMarker.test.tsx
@@ -8,7 +8,7 @@ import { fireEvent } from '@testing-library/react';
import { act } from '@testing-library/react-hooks';
import React, { ReactNode } from 'react';
import { MemoryRouter } from 'react-router-dom';
-import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin/mock_apm_plugin_context';
import {
expectTextsInDocument,
renderWithTheme,
diff --git a/x-pack/plugins/apm/public/components/shared/charts/timeseries_chart.tsx b/x-pack/plugins/apm/public/components/shared/charts/timeseries_chart.tsx
index cb7044d030653..689f80e01247e 100644
--- a/x-pack/plugins/apm/public/components/shared/charts/timeseries_chart.tsx
+++ b/x-pack/plugins/apm/public/components/shared/charts/timeseries_chart.tsx
@@ -32,8 +32,8 @@ import { RectCoordinate, TimeSeries } from '../../../../typings/timeseries';
import { FETCH_STATUS } from '../../../hooks/use_fetcher';
import { useTheme } from '../../../hooks/use_theme';
import { useUrlParams } from '../../../context/url_params_context/use_url_params';
-import { useAnnotations } from '../../../context/annotations/use_annotations';
-import { useChartPointerEvent } from '../../../context/chart_pointer_event/use_chart_pointer_event';
+import { useAnnotationsContext } from '../../../context/annotations/use_annotations_context';
+import { useChartPointerEventContext } from '../../../context/chart_pointer_event/use_chart_pointer_event_context';
import { AnomalySeries } from '../../../selectors/chart_selectors';
import { unit } from '../../../style/variables';
import { ChartContainer } from './chart_container';
@@ -72,9 +72,9 @@ export function TimeseriesChart({
}: Props) {
const history = useHistory();
const chartRef = React.createRef();
- const { annotations } = useAnnotations();
+ const { annotations } = useAnnotationsContext();
const chartTheme = useChartTheme();
- const { pointerEvent, setPointerEvent } = useChartPointerEvent();
+ const { pointerEvent, setPointerEvent } = useChartPointerEventContext();
const { urlParams } = useUrlParams();
const theme = useTheme();
diff --git a/x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/transaction_breakdown_chart_contents.tsx b/x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/transaction_breakdown_chart_contents.tsx
index dfad0a32fab55..0eda922519f85 100644
--- a/x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/transaction_breakdown_chart_contents.tsx
+++ b/x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/transaction_breakdown_chart_contents.tsx
@@ -31,8 +31,8 @@ import { TimeSeries } from '../../../../../typings/timeseries';
import { FETCH_STATUS } from '../../../../hooks/use_fetcher';
import { useTheme } from '../../../../hooks/use_theme';
import { useUrlParams } from '../../../../context/url_params_context/use_url_params';
-import { useAnnotations } from '../../../../context/annotations/use_annotations';
-import { useChartPointerEvent } from '../../../../context/chart_pointer_event/use_chart_pointer_event';
+import { useAnnotationsContext } from '../../../../context/annotations/use_annotations_context';
+import { useChartPointerEventContext } from '../../../../context/chart_pointer_event/use_chart_pointer_event_context';
import { unit } from '../../../../style/variables';
import { ChartContainer } from '../../charts/chart_container';
import { onBrushEnd } from '../../charts/helper/helper';
@@ -52,9 +52,9 @@ export function TransactionBreakdownChartContents({
}: Props) {
const history = useHistory();
const chartRef = React.createRef();
- const { annotations } = useAnnotations();
+ const { annotations } = useAnnotationsContext();
const chartTheme = useChartTheme();
- const { pointerEvent, setPointerEvent } = useChartPointerEvent();
+ const { pointerEvent, setPointerEvent } = useChartPointerEventContext();
const { urlParams } = useUrlParams();
const theme = useTheme();
const { start, end } = urlParams;
diff --git a/x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/use_transaction_breakdown.ts b/x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/use_transaction_breakdown.ts
index 768566539f496..ff744d763ecae 100644
--- a/x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/use_transaction_breakdown.ts
+++ b/x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/use_transaction_breakdown.ts
@@ -7,13 +7,13 @@
import { useParams } from 'react-router-dom';
import { useFetcher } from '../../../../hooks/use_fetcher';
import { useUrlParams } from '../../../../context/url_params_context/use_url_params';
-import { useApmService } from '../../../../context/apm_service/use_apm_service';
+import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context';
export function useTransactionBreakdown() {
const { serviceName } = useParams<{ serviceName?: string }>();
const { urlParams, uiFilters } = useUrlParams();
const { start, end, transactionName } = urlParams;
- const { transactionType } = useApmService();
+ const { transactionType } = useApmServiceContext();
const { data = { timeseries: undefined }, error, status } = useFetcher(
(callApmApi) => {
diff --git a/x-pack/plugins/apm/public/components/shared/charts/transaction_charts/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/transaction_charts/index.tsx
index cce6fbb724622..946f4a9355bff 100644
--- a/x-pack/plugins/apm/public/components/shared/charts/transaction_charts/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/charts/transaction_charts/index.tsx
@@ -22,7 +22,7 @@ import {
import { asTransactionRate } from '../../../../../common/utils/formatters';
import { AnnotationsContextProvider } from '../../../../context/annotations/annotations_context';
import { ChartPointerEventContextProvider } from '../../../../context/chart_pointer_event/chart_pointer_event_context';
-import { LicenseContext } from '../../../../context/license_context/license_context';
+import { LicenseContext } from '../../../../context/license/license_context';
import { IUrlParams } from '../../../../context/url_params_context/types';
import { FETCH_STATUS } from '../../../../hooks/use_fetcher';
import { ITransactionChartData } from '../../../../selectors/chart_selectors';
diff --git a/x-pack/plugins/apm/public/context/annotations/use_annotations.ts b/x-pack/plugins/apm/public/context/annotations/use_annotations_context.ts
similarity index 92%
rename from x-pack/plugins/apm/public/context/annotations/use_annotations.ts
rename to x-pack/plugins/apm/public/context/annotations/use_annotations_context.ts
index c0e171c3efc18..7fdc602b1916e 100644
--- a/x-pack/plugins/apm/public/context/annotations/use_annotations.ts
+++ b/x-pack/plugins/apm/public/context/annotations/use_annotations_context.ts
@@ -7,7 +7,7 @@
import { useContext } from 'react';
import { AnnotationsContext } from './annotations_context';
-export function useAnnotations() {
+export function useAnnotationsContext() {
const context = useContext(AnnotationsContext);
if (!context) {
diff --git a/x-pack/plugins/apm/public/context/apm_plugin_context/apm_plugin_context.tsx b/x-pack/plugins/apm/public/context/apm_plugin/apm_plugin_context.tsx
similarity index 100%
rename from x-pack/plugins/apm/public/context/apm_plugin_context/apm_plugin_context.tsx
rename to x-pack/plugins/apm/public/context/apm_plugin/apm_plugin_context.tsx
diff --git a/x-pack/plugins/apm/public/context/apm_plugin_context/mock_apm_plugin_context.tsx b/x-pack/plugins/apm/public/context/apm_plugin/mock_apm_plugin_context.tsx
similarity index 100%
rename from x-pack/plugins/apm/public/context/apm_plugin_context/mock_apm_plugin_context.tsx
rename to x-pack/plugins/apm/public/context/apm_plugin/mock_apm_plugin_context.tsx
diff --git a/x-pack/plugins/apm/public/context/apm_plugin_context/use_apm_plugin_context.ts b/x-pack/plugins/apm/public/context/apm_plugin/use_apm_plugin_context.ts
similarity index 100%
rename from x-pack/plugins/apm/public/context/apm_plugin_context/use_apm_plugin_context.ts
rename to x-pack/plugins/apm/public/context/apm_plugin/use_apm_plugin_context.ts
diff --git a/x-pack/plugins/apm/public/context/apm_service/use_apm_service.ts b/x-pack/plugins/apm/public/context/apm_service/use_apm_service_context.ts
similarity index 90%
rename from x-pack/plugins/apm/public/context/apm_service/use_apm_service.ts
rename to x-pack/plugins/apm/public/context/apm_service/use_apm_service_context.ts
index ec9c42ef2d0c9..85c135f36719f 100644
--- a/x-pack/plugins/apm/public/context/apm_service/use_apm_service.ts
+++ b/x-pack/plugins/apm/public/context/apm_service/use_apm_service_context.ts
@@ -7,6 +7,6 @@
import { useContext } from 'react';
import { APMServiceContext } from './apm_service_context';
-export function useApmService() {
+export function useApmServiceContext() {
return useContext(APMServiceContext);
}
diff --git a/x-pack/plugins/apm/public/context/chart_pointer_event/use_chart_pointer_event.tsx b/x-pack/plugins/apm/public/context/chart_pointer_event/use_chart_pointer_event_context.tsx
similarity index 91%
rename from x-pack/plugins/apm/public/context/chart_pointer_event/use_chart_pointer_event.tsx
rename to x-pack/plugins/apm/public/context/chart_pointer_event/use_chart_pointer_event_context.tsx
index 4dfeb1518c19b..bf53273104d60 100644
--- a/x-pack/plugins/apm/public/context/chart_pointer_event/use_chart_pointer_event.tsx
+++ b/x-pack/plugins/apm/public/context/chart_pointer_event/use_chart_pointer_event_context.tsx
@@ -7,7 +7,7 @@
import { useContext } from 'react';
import { ChartPointerEventContext } from './chart_pointer_event_context';
-export function useChartPointerEvent() {
+export function useChartPointerEventContext() {
const context = useContext(ChartPointerEventContext);
if (!context) {
diff --git a/x-pack/plugins/apm/public/context/license_context/Invalid_license_notification.tsx b/x-pack/plugins/apm/public/context/license/Invalid_license_notification.tsx
similarity index 100%
rename from x-pack/plugins/apm/public/context/license_context/Invalid_license_notification.tsx
rename to x-pack/plugins/apm/public/context/license/Invalid_license_notification.tsx
diff --git a/x-pack/plugins/apm/public/context/license_context/license_context.tsx b/x-pack/plugins/apm/public/context/license/license_context.tsx
similarity index 92%
rename from x-pack/plugins/apm/public/context/license_context/license_context.tsx
rename to x-pack/plugins/apm/public/context/license/license_context.tsx
index 7ae652f95a416..557f135fa4c0e 100644
--- a/x-pack/plugins/apm/public/context/license_context/license_context.tsx
+++ b/x-pack/plugins/apm/public/context/license/license_context.tsx
@@ -7,7 +7,7 @@
import React from 'react';
import useObservable from 'react-use/lib/useObservable';
import { ILicense } from '../../../../licensing/public';
-import { useApmPluginContext } from '../apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../apm_plugin/use_apm_plugin_context';
import { InvalidLicenseNotification } from './Invalid_license_notification';
export const LicenseContext = React.createContext(
diff --git a/x-pack/plugins/apm/public/context/license_context/use_license.ts b/x-pack/plugins/apm/public/context/license/use_license_context.ts
similarity index 90%
rename from x-pack/plugins/apm/public/context/license_context/use_license.ts
rename to x-pack/plugins/apm/public/context/license/use_license_context.ts
index fbd9f6a8b0ffb..e86bb78d127ab 100644
--- a/x-pack/plugins/apm/public/context/license_context/use_license.ts
+++ b/x-pack/plugins/apm/public/context/license/use_license_context.ts
@@ -7,6 +7,6 @@
import { useContext } from 'react';
import { LicenseContext } from './license_context';
-export function useLicense() {
+export function useLicenseContext() {
return useContext(LicenseContext);
}
diff --git a/x-pack/plugins/apm/public/hooks/useCallApi.ts b/x-pack/plugins/apm/public/hooks/useCallApi.ts
index bebc2680022d1..79e439c3f7e7a 100644
--- a/x-pack/plugins/apm/public/hooks/useCallApi.ts
+++ b/x-pack/plugins/apm/public/hooks/useCallApi.ts
@@ -6,7 +6,7 @@
import { useMemo } from 'react';
import { callApi } from '../services/rest/callApi';
-import { useApmPluginContext } from '../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../context/apm_plugin/use_apm_plugin_context';
import { FetchOptions } from '../../common/fetch_options';
export function useCallApi() {
diff --git a/x-pack/plugins/apm/public/hooks/useKibanaUrl.ts b/x-pack/plugins/apm/public/hooks/useKibanaUrl.ts
index 56d77543e4966..66edb84378a45 100644
--- a/x-pack/plugins/apm/public/hooks/useKibanaUrl.ts
+++ b/x-pack/plugins/apm/public/hooks/useKibanaUrl.ts
@@ -5,7 +5,7 @@
*/
import url from 'url';
-import { useApmPluginContext } from '../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../context/apm_plugin/use_apm_plugin_context';
export function useKibanaUrl(
/** The path to the plugin */ path: string,
diff --git a/x-pack/plugins/apm/public/hooks/use_breadcrumbs.test.tsx b/x-pack/plugins/apm/public/hooks/use_breadcrumbs.test.tsx
index 5fc4909c06464..9127bd3adc69e 100644
--- a/x-pack/plugins/apm/public/hooks/use_breadcrumbs.test.tsx
+++ b/x-pack/plugins/apm/public/hooks/use_breadcrumbs.test.tsx
@@ -9,11 +9,11 @@ import produce from 'immer';
import React, { ReactNode } from 'react';
import { MemoryRouter } from 'react-router-dom';
import { routes } from '../components/app/Main/route_config';
-import { ApmPluginContextValue } from '../context/apm_plugin_context/apm_plugin_context';
+import { ApmPluginContextValue } from '../context/apm_plugin/apm_plugin_context';
import {
mockApmPluginContextValue,
MockApmPluginContextWrapper,
-} from '../context/apm_plugin_context/mock_apm_plugin_context';
+} from '../context/apm_plugin/mock_apm_plugin_context';
import { useBreadcrumbs } from './use_breadcrumbs';
function createWrapper(path: string) {
diff --git a/x-pack/plugins/apm/public/hooks/use_breadcrumbs.ts b/x-pack/plugins/apm/public/hooks/use_breadcrumbs.ts
index b93b66d492fad..089381cbe05b5 100644
--- a/x-pack/plugins/apm/public/hooks/use_breadcrumbs.ts
+++ b/x-pack/plugins/apm/public/hooks/use_breadcrumbs.ts
@@ -16,7 +16,7 @@ import {
} from 'react-router-dom';
import { APMRouteDefinition, BreadcrumbTitle } from '../application/routes';
import { getAPMHref } from '../components/shared/Links/apm/APMLink';
-import { useApmPluginContext } from '../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../context/apm_plugin/use_apm_plugin_context';
interface BreadcrumbWithoutLink extends ChromeBreadcrumb {
match: Match>;
diff --git a/x-pack/plugins/apm/public/hooks/use_fetcher.integration.test.tsx b/x-pack/plugins/apm/public/hooks/use_fetcher.integration.test.tsx
index 9d75b6f376e09..e6f3b71af8a85 100644
--- a/x-pack/plugins/apm/public/hooks/use_fetcher.integration.test.tsx
+++ b/x-pack/plugins/apm/public/hooks/use_fetcher.integration.test.tsx
@@ -8,7 +8,7 @@ import { render, waitFor } from '@testing-library/react';
import React from 'react';
import { delay } from '../utils/testHelpers';
import { useFetcher } from './use_fetcher';
-import { MockApmPluginContextWrapper } from '../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../context/apm_plugin/mock_apm_plugin_context';
const wrapper = MockApmPluginContextWrapper;
diff --git a/x-pack/plugins/apm/public/hooks/use_fetcher.test.tsx b/x-pack/plugins/apm/public/hooks/use_fetcher.test.tsx
index fc56e84bbad5b..9b4ad6bc9bb51 100644
--- a/x-pack/plugins/apm/public/hooks/use_fetcher.test.tsx
+++ b/x-pack/plugins/apm/public/hooks/use_fetcher.test.tsx
@@ -7,8 +7,8 @@
import { renderHook, RenderHookResult } from '@testing-library/react-hooks';
import { delay } from '../utils/testHelpers';
import { FetcherResult, useFetcher } from './use_fetcher';
-import { MockApmPluginContextWrapper } from '../context/apm_plugin_context/mock_apm_plugin_context';
-import { ApmPluginContextValue } from '../context/apm_plugin_context/apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../context/apm_plugin/mock_apm_plugin_context';
+import { ApmPluginContextValue } from '../context/apm_plugin/apm_plugin_context';
// Wrap the hook with a provider so it can useApmPluginContext
const wrapper = MockApmPluginContextWrapper;
diff --git a/x-pack/plugins/apm/public/hooks/use_fetcher.tsx b/x-pack/plugins/apm/public/hooks/use_fetcher.tsx
index bc5d644635603..a9a4871dc8707 100644
--- a/x-pack/plugins/apm/public/hooks/use_fetcher.tsx
+++ b/x-pack/plugins/apm/public/hooks/use_fetcher.tsx
@@ -9,7 +9,7 @@ import React, { useEffect, useMemo, useState } from 'react';
import { IHttpFetchError } from 'src/core/public';
import { toMountPoint } from '../../../../../src/plugins/kibana_react/public';
import { APMClient, callApmApi } from '../services/rest/createCallApmApi';
-import { useApmPluginContext } from '../context/apm_plugin_context/use_apm_plugin_context';
+import { useApmPluginContext } from '../context/apm_plugin/use_apm_plugin_context';
export enum FETCH_STATUS {
LOADING = 'loading',
diff --git a/x-pack/plugins/apm/public/hooks/use_service_metric_charts_fetcher.ts b/x-pack/plugins/apm/public/hooks/use_service_metric_charts_fetcher.ts
index 311055bfe032e..c888c51589563 100644
--- a/x-pack/plugins/apm/public/hooks/use_service_metric_charts_fetcher.ts
+++ b/x-pack/plugins/apm/public/hooks/use_service_metric_charts_fetcher.ts
@@ -8,7 +8,7 @@ import { useParams } from 'react-router-dom';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { MetricsChartsByAgentAPIResponse } from '../../server/lib/metrics/get_metrics_chart_data_by_agent';
import { useUrlParams } from '../context/url_params_context/use_url_params';
-import { useApmService } from '../context/apm_service/use_apm_service';
+import { useApmServiceContext } from '../context/apm_service/use_apm_service_context';
import { useFetcher } from './use_fetcher';
const INITIAL_DATA: MetricsChartsByAgentAPIResponse = {
@@ -21,7 +21,7 @@ export function useServiceMetricChartsFetcher({
serviceNodeName: string | undefined;
}) {
const { urlParams, uiFilters } = useUrlParams();
- const { agentName } = useApmService();
+ const { agentName } = useApmServiceContext();
const { serviceName } = useParams<{ serviceName?: string }>();
const { start, end } = urlParams;
const { data = INITIAL_DATA, error, status } = useFetcher(
diff --git a/x-pack/plugins/apm/public/utils/testHelpers.tsx b/x-pack/plugins/apm/public/utils/testHelpers.tsx
index 3dfd6898ac81c..21c87c18be363 100644
--- a/x-pack/plugins/apm/public/utils/testHelpers.tsx
+++ b/x-pack/plugins/apm/public/utils/testHelpers.tsx
@@ -24,7 +24,7 @@ import { PromiseReturnType } from '../../../observability/typings/common';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { APMConfig } from '../../server';
import { UIFilters } from '../../typings/ui_filters';
-import { MockApmPluginContextWrapper } from '../context/apm_plugin_context/mock_apm_plugin_context';
+import { MockApmPluginContextWrapper } from '../context/apm_plugin/mock_apm_plugin_context';
import { UrlParamsProvider } from '../context/url_params_context/url_params_context';
const originalConsoleWarn = console.warn; // eslint-disable-line no-console