diff --git a/x-pack/legacy/plugins/apm/index.ts b/x-pack/legacy/plugins/apm/index.ts index fa22dca58a08b..2efa13a0bbc8d 100644 --- a/x-pack/legacy/plugins/apm/index.ts +++ b/x-pack/legacy/plugins/apm/index.ts @@ -11,7 +11,6 @@ import { APMPluginContract } from '../../../plugins/apm/server'; import { LegacyPluginInitializer } from '../../../../src/legacy/types'; import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils'; import mappings from './mappings.json'; -import { makeApmUsageCollector } from './server/lib/apm_telemetry'; export const apm: LegacyPluginInitializer = kibana => { return new kibana.Plugin({ @@ -108,11 +107,9 @@ export const apm: LegacyPluginInitializer = kibana => { } } }); - const { usageCollection } = server.newPlatform.setup.plugins; - makeApmUsageCollector(usageCollection, server); + const apmPlugin = server.newPlatform.setup.plugins .apm as APMPluginContract; - apmPlugin.registerLegacyAPI({ server }); } }); diff --git a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/ErrorTabs.tsx b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/ErrorTabs.tsx index ab61ce444232d..33774c941ffd6 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/ErrorTabs.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/ErrorTabs.tsx @@ -6,7 +6,7 @@ import { i18n } from '@kbn/i18n'; import { isEmpty } from 'lodash'; -import { APMError } from '../../../../../typings/es_schemas/ui/APMError'; +import { APMError } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error'; export interface ErrorTab { key: 'log_stacktrace' | 'exception_stacktrace' | 'metadata'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/ExceptionStacktrace.tsx b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/ExceptionStacktrace.tsx index 0b91bddf862bc..75e518a278aea 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/ExceptionStacktrace.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/ExceptionStacktrace.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { EuiTitle } from '@elastic/eui'; -import { Exception } from '../../../../../typings/es_schemas/raw/ErrorRaw'; +import { Exception } from '../../../../../../../../plugins/apm/typings/es_schemas/raw/error_raw'; import { Stacktrace } from '../../../shared/Stacktrace'; import { CauseStacktrace } from '../../../shared/Stacktrace/CauseStacktrace'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/index.tsx index 29c5d3329d16b..490bf472065e3 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/index.tsx @@ -19,8 +19,9 @@ import { Location } from 'history'; import React from 'react'; import styled from 'styled-components'; import { first } from 'lodash'; -import { ErrorGroupAPIResponse } from '../../../../../server/lib/errors/get_error_group'; -import { APMError } from '../../../../../typings/es_schemas/ui/APMError'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { ErrorGroupAPIResponse } from '../../../../../../../../plugins/apm/server/lib/errors/get_error_group'; +import { APMError } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error'; import { IUrlParams } from '../../../../context/UrlParamsContext/types'; import { px, unit, units } from '../../../../style/variables'; import { DiscoverErrorLink } from '../../../shared/Links/DiscoverLinks/DiscoverErrorLink'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/index.tsx index d79f2a4ed481d..ccd720ceee075 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/index.tsx @@ -17,7 +17,7 @@ import theme from '@elastic/eui/dist/eui_theme_light.json'; import { i18n } from '@kbn/i18n'; import React, { Fragment } from 'react'; import styled from 'styled-components'; -import { NOT_AVAILABLE_LABEL } from '../../../../common/i18n'; +import { NOT_AVAILABLE_LABEL } from '../../../../../../../plugins/apm/common/i18n'; import { useFetcher } from '../../../hooks/useFetcher'; import { fontFamilyCode, fontSizes, px, units } from '../../../style/variables'; import { ApmHeader } from '../../shared/ApmHeader'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/List/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/List/index.tsx index e0d6e9108d3c0..b26833c02fe22 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/List/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/List/index.tsx @@ -9,8 +9,9 @@ import numeral from '@elastic/numeral'; import { i18n } from '@kbn/i18n'; import React, { useMemo } from 'react'; import styled from 'styled-components'; -import { NOT_AVAILABLE_LABEL } from '../../../../../common/i18n'; -import { ErrorGroupListAPIResponse } from '../../../../../server/lib/errors/get_error_groups'; +import { NOT_AVAILABLE_LABEL } from '../../../../../../../../plugins/apm/common/i18n'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { ErrorGroupListAPIResponse } from '../../../../../../../../plugins/apm/server/lib/errors/get_error_groups'; import { fontFamilyCode, fontSizes, diff --git a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/index.tsx index 9f7ff65d37d36..8c5a4545f1043 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/index.tsx @@ -18,7 +18,7 @@ import { ErrorDistribution } from '../ErrorGroupDetails/Distribution'; import { ErrorGroupList } from './List'; import { useUrlParams } from '../../../hooks/useUrlParams'; import { useTrackPageview } from '../../../../../../../plugins/observability/public'; -import { PROJECTION } from '../../../../common/projections/typings'; +import { PROJECTION } from '../../../../../../../plugins/apm/common/projections/typings'; import { LocalUIFilters } from '../../shared/LocalUIFilters'; const ErrorGroupOverview: React.FC = () => { diff --git a/x-pack/legacy/plugins/apm/public/components/app/Main/route_config/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/Main/route_config/index.tsx index 3be096d9db2bc..2e737382c67a5 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/Main/route_config/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/Main/route_config/index.tsx @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; import React from 'react'; import { Redirect, RouteComponentProps } from 'react-router-dom'; -import { SERVICE_NODE_NAME_MISSING } from '../../../../../common/service_nodes'; +import { SERVICE_NODE_NAME_MISSING } from '../../../../../../../../plugins/apm/common/service_nodes'; import { ErrorGroupDetails } from '../../ErrorGroupDetails'; import { ServiceDetails } from '../../ServiceDetails'; import { TransactionDetails } from '../../TransactionDetails'; @@ -20,7 +20,7 @@ import { ApmIndices } from '../../Settings/ApmIndices'; import { toQuery } from '../../../shared/Links/url_helpers'; import { ServiceNodeMetrics } from '../../ServiceNodeMetrics'; import { resolveUrlParams } from '../../../../context/UrlParamsContext/resolveUrlParams'; -import { UNIDENTIFIED_SERVICE_NODES_LABEL } from '../../../../../common/i18n'; +import { UNIDENTIFIED_SERVICE_NODES_LABEL } from '../../../../../../../../plugins/apm/common/i18n'; import { TraceLink } from '../../TraceLink'; import { CustomizeUI } from '../../Settings/CustomizeUI'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceDetails/ServiceDetailTabs.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceDetails/ServiceDetailTabs.tsx index 7ab2f7bac8ae2..131bb7f65d4b3 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceDetails/ServiceDetailTabs.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceDetails/ServiceDetailTabs.tsx @@ -7,7 +7,10 @@ import { EuiTabs } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; -import { isJavaAgentName, isRumAgentName } from '../../../../common/agent_name'; +import { + isJavaAgentName, + isRumAgentName +} from '../../../../../../../plugins/apm/common/agent_name'; import { useAgentName } from '../../../hooks/useAgentName'; import { useApmPluginContext } from '../../../hooks/useApmPluginContext'; import { useUrlParams } from '../../../hooks/useUrlParams'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceDetails/ServiceIntegrations/createErrorGroupWatch.ts b/x-pack/legacy/plugins/apm/public/components/app/ServiceDetails/ServiceIntegrations/createErrorGroupWatch.ts index d45453e24f1c9..690db9fcdd8d6 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceDetails/ServiceIntegrations/createErrorGroupWatch.ts +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceDetails/ServiceIntegrations/createErrorGroupWatch.ts @@ -17,7 +17,7 @@ import { ERROR_LOG_MESSAGE, PROCESSOR_EVENT, SERVICE_NAME -} from '../../../../../common/elasticsearch_fieldnames'; +} from '../../../../../../../../plugins/apm/common/elasticsearch_fieldnames'; import { createWatch } from '../../../../services/rest/watcher'; function getSlackPathUrl(slackUrl?: string) { diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Popover/ServiceMetricList.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Popover/ServiceMetricList.tsx index 8ce6d9d57c4ac..e91eb5e006d82 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Popover/ServiceMetricList.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Popover/ServiceMetricList.tsx @@ -15,7 +15,8 @@ import { i18n } from '@kbn/i18n'; import { isNumber } from 'lodash'; import React from 'react'; import styled from 'styled-components'; -import { ServiceNodeMetrics } from '../../../../../server/lib/service_map/get_service_map_service_node_info'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { ServiceNodeMetrics } from '../../../../../../../../plugins/apm/server/lib/service_map/get_service_map_service_node_info'; import { asDuration, asPercent, diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/get_cytoscape_elements.ts b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/get_cytoscape_elements.ts index 106e9a1d82f29..2403ed047cbc0 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/get_cytoscape_elements.ts +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/get_cytoscape_elements.ts @@ -5,8 +5,12 @@ */ import { ValuesType } from 'utility-types'; import { sortBy, isEqual } from 'lodash'; -import { Connection, ConnectionNode } from '../../../../common/service_map'; -import { ServiceMapAPIResponse } from '../../../../server/lib/service_map/get_service_map'; +import { + Connection, + ConnectionNode +} from '../../../../../../../plugins/apm/common/service_map'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { ServiceMapAPIResponse } from '../../../../../../../plugins/apm/server/lib/service_map/get_service_map'; import { getAPMHref } from '../../shared/Links/apm/APMLink'; function getConnectionNodeId(node: ConnectionNode): string { diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/index.tsx index 4e24460f80ec1..5fea4be9ca0da 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/index.tsx @@ -17,7 +17,8 @@ import React, { useState } from 'react'; import { toMountPoint } from '../../../../../../../../src/plugins/kibana_react/public'; -import { ServiceMapAPIResponse } from '../../../../server/lib/service_map/get_service_map'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { ServiceMapAPIResponse } from '../../../../../../../plugins/apm/server/lib/service_map/get_service_map'; import { useApmPluginContext } from '../../../hooks/useApmPluginContext'; import { useCallApmApi } from '../../../hooks/useCallApmApi'; import { useDeepObjectIdentity } from '../../../hooks/useDeepObjectIdentity'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceMetrics/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceMetrics/index.tsx index 0fb8c00a2b162..060e635e83549 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceMetrics/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceMetrics/index.tsx @@ -16,7 +16,7 @@ import { useServiceMetricCharts } from '../../../hooks/useServiceMetricCharts'; import { MetricsChart } from '../../shared/charts/MetricsChart'; import { useUrlParams } from '../../../hooks/useUrlParams'; import { ChartsSyncContextProvider } from '../../../context/ChartsSyncContext'; -import { PROJECTION } from '../../../../common/projections/typings'; +import { PROJECTION } from '../../../../../../../plugins/apm/common/projections/typings'; import { LocalUIFilters } from '../../shared/LocalUIFilters'; interface ServiceMetricsProps { diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceNodeMetrics/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceNodeMetrics/index.tsx index 3929c153ae419..2bf26946932ea 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceNodeMetrics/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceNodeMetrics/index.tsx @@ -20,7 +20,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import styled from 'styled-components'; import { FormattedMessage } from '@kbn/i18n/react'; -import { SERVICE_NODE_NAME_MISSING } from '../../../../common/service_nodes'; +import { SERVICE_NODE_NAME_MISSING } from '../../../../../../../plugins/apm/common/service_nodes'; import { ApmHeader } from '../../shared/ApmHeader'; import { useUrlParams } from '../../../hooks/useUrlParams'; import { useAgentName } from '../../../hooks/useAgentName'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceNodeOverview/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceNodeOverview/index.tsx index 4e57cb47691be..3af1a70ef3fdc 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceNodeOverview/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceNodeOverview/index.tsx @@ -13,9 +13,9 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import styled from 'styled-components'; -import { UNIDENTIFIED_SERVICE_NODES_LABEL } from '../../../../common/i18n'; -import { SERVICE_NODE_NAME_MISSING } from '../../../../common/service_nodes'; -import { PROJECTION } from '../../../../common/projections/typings'; +import { UNIDENTIFIED_SERVICE_NODES_LABEL } from '../../../../../../../plugins/apm/common/i18n'; +import { SERVICE_NODE_NAME_MISSING } from '../../../../../../../plugins/apm/common/service_nodes'; +import { PROJECTION } from '../../../../../../../plugins/apm/common/projections/typings'; import { LocalUIFilters } from '../../shared/LocalUIFilters'; import { useUrlParams } from '../../../hooks/useUrlParams'; import { ManagedTable, ITableColumn } from '../../shared/ManagedTable'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/ServiceList/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/ServiceList/index.tsx index 13e7a5bfd894e..1ac29c5626e3a 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/ServiceList/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/ServiceList/index.tsx @@ -8,8 +8,9 @@ import { EuiToolTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; import styled from 'styled-components'; -import { ServiceListAPIResponse } from '../../../../../server/lib/services/get_services'; -import { NOT_AVAILABLE_LABEL } from '../../../../../common/i18n'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { ServiceListAPIResponse } from '../../../../../../../../plugins/apm/server/lib/services/get_services'; +import { NOT_AVAILABLE_LABEL } from '../../../../../../../../plugins/apm/common/i18n'; import { fontSizes, truncate } from '../../../../style/variables'; import { asDecimal, convertTo } from '../../../../utils/formatters'; import { ManagedTable } from '../../../shared/ManagedTable'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/index.tsx index 762c10c0f48a7..52bc414a93a23 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/index.tsx @@ -15,7 +15,7 @@ import { NoServicesMessage } from './NoServicesMessage'; import { ServiceList } from './ServiceList'; import { useUrlParams } from '../../../hooks/useUrlParams'; import { useTrackPageview } from '../../../../../../../plugins/observability/public'; -import { PROJECTION } from '../../../../common/projections/typings'; +import { PROJECTION } from '../../../../../../../plugins/apm/common/projections/typings'; import { LocalUIFilters } from '../../shared/LocalUIFilters'; import { useApmPluginContext } from '../../../hooks/useApmPluginContext'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/DeleteButton.tsx b/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/DeleteButton.tsx index b5a59aea3286d..496147b02589b 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/DeleteButton.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/DeleteButton.tsx @@ -10,7 +10,7 @@ import { NotificationsStart } from 'kibana/public'; import { i18n } from '@kbn/i18n'; import { useCallApmApi } from '../../../../../hooks/useCallApmApi'; import { Config } from '../index'; -import { getOptionLabel } from '../../../../../../common/agent_configuration_constants'; +import { getOptionLabel } from '../../../../../../../../../plugins/apm/common/agent_configuration_constants'; import { APMClient } from '../../../../../services/rest/createCallApmApi'; import { useApmPluginContext } from '../../../../../hooks/useApmPluginContext'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/index.tsx index 4f808b3b4b5d9..653dedea733f2 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/index.tsx @@ -23,15 +23,15 @@ import React, { useState } from 'react'; import { i18n } from '@kbn/i18n'; import { isRight } from 'fp-ts/lib/Either'; import { useCallApmApi } from '../../../../../hooks/useCallApmApi'; -import { transactionSampleRateRt } from '../../../../../../common/runtime_types/transaction_sample_rate_rt'; +import { transactionSampleRateRt } from '../../../../../../../../../plugins/apm/common/runtime_types/transaction_sample_rate_rt'; import { Config } from '../index'; import { SettingsSection } from './SettingsSection'; import { ServiceForm } from '../../../../shared/ServiceForm'; import { DeleteButton } from './DeleteButton'; -import { transactionMaxSpansRt } from '../../../../../../common/runtime_types/transaction_max_spans_rt'; +import { transactionMaxSpansRt } from '../../../../../../../../../plugins/apm/common/runtime_types/transaction_max_spans_rt'; import { useFetcher } from '../../../../../hooks/useFetcher'; -import { isRumAgentName } from '../../../../../../common/agent_name'; -import { ALL_OPTION_VALUE } from '../../../../../../common/agent_configuration_constants'; +import { isRumAgentName } from '../../../../../../../../../plugins/apm/common/agent_name'; +import { ALL_OPTION_VALUE } from '../../../../../../../../../plugins/apm/common/agent_configuration_constants'; import { saveConfig } from './saveConfig'; import { useApmPluginContext } from '../../../../../hooks/useApmPluginContext'; import { useUiTracker } from '../../../../../../../../../plugins/observability/public'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/saveConfig.ts b/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/saveConfig.ts index a0c7c97e012a4..19934cafb4694 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/saveConfig.ts +++ b/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/saveConfig.ts @@ -7,11 +7,11 @@ import { i18n } from '@kbn/i18n'; import { NotificationsStart } from 'kibana/public'; import { APMClient } from '../../../../../services/rest/createCallApmApi'; -import { isRumAgentName } from '../../../../../../common/agent_name'; +import { isRumAgentName } from '../../../../../../../../../plugins/apm/common/agent_name'; import { getOptionLabel, omitAllOption -} from '../../../../../../common/agent_configuration_constants'; +} from '../../../../../../../../../plugins/apm/common/agent_configuration_constants'; import { UiTracker } from '../../../../../../../../../plugins/observability/public'; interface Settings { diff --git a/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AgentConfigurationList.tsx b/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AgentConfigurationList.tsx index c660455e1eed8..557945e9ba67a 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AgentConfigurationList.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AgentConfigurationList.tsx @@ -18,11 +18,12 @@ import theme from '@elastic/eui/dist/eui_theme_light.json'; import { FETCH_STATUS } from '../../../../hooks/useFetcher'; import { ITableColumn, ManagedTable } from '../../../shared/ManagedTable'; import { LoadingStatePrompt } from '../../../shared/LoadingStatePrompt'; -import { AgentConfigurationListAPIResponse } from '../../../../../server/lib/settings/agent_configuration/list_configurations'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { AgentConfigurationListAPIResponse } from '../../../../../../../../plugins/apm/server/lib/settings/agent_configuration/list_configurations'; import { Config } from '.'; import { TimestampTooltip } from '../../../shared/TimestampTooltip'; import { px, units } from '../../../../style/variables'; -import { getOptionLabel } from '../../../../../common/agent_configuration_constants'; +import { getOptionLabel } from '../../../../../../../../plugins/apm/common/agent_configuration_constants'; export function AgentConfigurationList({ status, diff --git a/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/index.tsx index 8812cccd2edaf..35cc68547d337 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/index.tsx @@ -16,7 +16,8 @@ import { } from '@elastic/eui'; import { isEmpty } from 'lodash'; import { useFetcher } from '../../../../hooks/useFetcher'; -import { AgentConfigurationListAPIResponse } from '../../../../../server/lib/settings/agent_configuration/list_configurations'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { AgentConfigurationListAPIResponse } from '../../../../../../../../plugins/apm/server/lib/settings/agent_configuration/list_configurations'; import { AgentConfigurationList } from './AgentConfigurationList'; import { useTrackPageview } from '../../../../../../../../plugins/observability/public'; import { AddEditFlyout } from './AddEditFlyout'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/TraceLink/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/TraceLink/index.tsx index b0489d58830d2..f0301f8917d10 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TraceLink/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TraceLink/index.tsx @@ -9,8 +9,8 @@ import React from 'react'; import { Redirect } from 'react-router-dom'; import styled from 'styled-components'; import url from 'url'; -import { TRACE_ID } from '../../../../common/elasticsearch_fieldnames'; -import { Transaction } from '../../../../typings/es_schemas/ui/Transaction'; +import { TRACE_ID } from '../../../../../../../plugins/apm/common/elasticsearch_fieldnames'; +import { Transaction } from '../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { FETCH_STATUS, useFetcher } from '../../../hooks/useFetcher'; import { useUrlParams } from '../../../hooks/useUrlParams'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/TraceList.tsx b/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/TraceList.tsx index 9116e02870a80..91f3051acf077 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/TraceList.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/TraceList.tsx @@ -8,7 +8,8 @@ import { EuiIcon, EuiToolTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; import styled from 'styled-components'; -import { ITransactionGroup } from '../../../../server/lib/transaction_groups/transform'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { ITransactionGroup } from '../../../../../../../plugins/apm/server/lib/transaction_groups/transform'; import { fontSizes, truncate } from '../../../style/variables'; import { convertTo } from '../../../utils/formatters'; import { EmptyMessage } from '../../shared/EmptyMessage'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/index.tsx index 3bdcc3231cddc..bfbad78a5c026 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/index.tsx @@ -11,7 +11,7 @@ import { TraceList } from './TraceList'; import { useUrlParams } from '../../../hooks/useUrlParams'; import { useTrackPageview } from '../../../../../../../plugins/observability/public'; import { LocalUIFilters } from '../../shared/LocalUIFilters'; -import { PROJECTION } from '../../../../common/projections/typings'; +import { PROJECTION } from '../../../../../../../plugins/apm/common/projections/typings'; export function TraceOverview() { const { urlParams, uiFilters } = useUrlParams(); diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Distribution/__test__/distribution.test.ts b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Distribution/__test__/distribution.test.ts index 85398a1324f7b..08682fb3be842 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Distribution/__test__/distribution.test.ts +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Distribution/__test__/distribution.test.ts @@ -5,7 +5,8 @@ */ import { getFormattedBuckets } from '../index'; -import { IBucket } from '../../../../../../server/lib/transactions/distribution/get_buckets/transform'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { IBucket } from '../../../../../../../../../plugins/apm/server/lib/transactions/distribution/get_buckets/transform'; describe('Distribution', () => { it('getFormattedBuckets', () => { diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Distribution/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Distribution/index.tsx index acd50438b4d54..e70133aabb679 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Distribution/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Distribution/index.tsx @@ -9,8 +9,10 @@ import { i18n } from '@kbn/i18n'; import d3 from 'd3'; import React, { FunctionComponent, useCallback } from 'react'; import { isEmpty } from 'lodash'; -import { TransactionDistributionAPIResponse } from '../../../../../server/lib/transactions/distribution'; -import { IBucket } from '../../../../../server/lib/transactions/distribution/get_buckets/transform'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { TransactionDistributionAPIResponse } from '../../../../../../../../plugins/apm/server/lib/transactions/distribution'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { IBucket } from '../../../../../../../../plugins/apm/server/lib/transactions/distribution/get_buckets/transform'; import { IUrlParams } from '../../../../context/UrlParamsContext/types'; import { getDurationFormatter } from '../../../../utils/formatters'; // @ts-ignore diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/MaybeViewTraceLink.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/MaybeViewTraceLink.tsx index 322ec7c422571..4e105957f5f9d 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/MaybeViewTraceLink.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/MaybeViewTraceLink.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { EuiButton, EuiFlexItem, EuiToolTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { Transaction as ITransaction } from '../../../../../typings/es_schemas/ui/Transaction'; +import { Transaction as ITransaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { TransactionDetailLink } from '../../../shared/Links/apm/TransactionDetailLink'; import { IWaterfall } from './WaterfallContainer/Waterfall/waterfall_helpers/waterfall_helpers'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/TransactionTabs.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/TransactionTabs.tsx index f8318b9ae97e6..9026dd90ddceb 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/TransactionTabs.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/TransactionTabs.tsx @@ -8,7 +8,7 @@ import { EuiSpacer, EuiTab, EuiTabs } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { Location } from 'history'; import React from 'react'; -import { Transaction } from '../../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { IUrlParams } from '../../../../context/UrlParamsContext/types'; import { fromQuery, toQuery } from '../../../shared/Links/url_helpers'; import { history } from '../../../../utils/history'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Marks/__test__/get_agent_marks.test.ts b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Marks/__test__/get_agent_marks.test.ts index 784c5fbebf3c2..030729522f35e 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Marks/__test__/get_agent_marks.test.ts +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Marks/__test__/get_agent_marks.test.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { Transaction } from '../../../../../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { getAgentMarks } from '../get_agent_marks'; describe('getAgentMarks', () => { diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Marks/get_agent_marks.ts b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Marks/get_agent_marks.ts index 7798d716cb219..1dcb1598662c9 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Marks/get_agent_marks.ts +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Marks/get_agent_marks.ts @@ -5,7 +5,7 @@ */ import { sortBy } from 'lodash'; -import { Transaction } from '../../../../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { Mark } from '.'; // Extends Mark without adding new properties to it. diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Marks/get_error_marks.ts b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Marks/get_error_marks.ts index e2b00c13c5c1f..a9694efcbcae7 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Marks/get_error_marks.ts +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Marks/get_error_marks.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import { isEmpty } from 'lodash'; -import { ErrorRaw } from '../../../../../../../typings/es_schemas/raw/ErrorRaw'; +import { ErrorRaw } from '../../../../../../../../../../plugins/apm/typings/es_schemas/raw/error_raw'; import { IWaterfallError, IServiceColors diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/FlyoutTopLevelProperties.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/FlyoutTopLevelProperties.tsx index a49a557127be6..6e58dbc5b6ea3 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/FlyoutTopLevelProperties.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/FlyoutTopLevelProperties.tsx @@ -9,8 +9,8 @@ import React from 'react'; import { SERVICE_NAME, TRANSACTION_NAME -} from '../../../../../../../common/elasticsearch_fieldnames'; -import { Transaction } from '../../../../../../../typings/es_schemas/ui/Transaction'; +} from '../../../../../../../../../../plugins/apm/common/elasticsearch_fieldnames'; +import { Transaction } from '../../../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { TransactionDetailLink } from '../../../../../shared/Links/apm/TransactionDetailLink'; import { StickyProperties } from '../../../../../shared/StickyProperties'; import { TransactionOverviewLink } from '../../../../../shared/Links/apm/TransactionOverviewLink'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/DatabaseContext.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/DatabaseContext.tsx index 1a3f1f6831ff3..6200d5f098ad5 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/DatabaseContext.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/DatabaseContext.tsx @@ -18,7 +18,7 @@ import SyntaxHighlighter, { // @ts-ignore import { xcode } from 'react-syntax-highlighter/dist/styles'; import styled from 'styled-components'; -import { Span } from '../../../../../../../../typings/es_schemas/ui/Span'; +import { Span } from '../../../../../../../../../../../plugins/apm/typings/es_schemas/ui/span'; import { borderRadius, fontFamilyCode, diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/HttpContext.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/HttpContext.tsx index f767ce2e9f0d8..438e88df3351d 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/HttpContext.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/HttpContext.tsx @@ -17,7 +17,7 @@ import { unit, units } from '../../../../../../../style/variables'; -import { Span } from '../../../../../../../../typings/es_schemas/ui/Span'; +import { Span } from '../../../../../../../../../../../plugins/apm/typings/es_schemas/ui/span'; const ContextUrl = styled.div` padding: ${px(units.half)} ${px(unit)}; diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/StickySpanProperties.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/StickySpanProperties.tsx index 12cd9fe86c8c7..621497a0b22e0 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/StickySpanProperties.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/StickySpanProperties.tsx @@ -6,14 +6,14 @@ import { i18n } from '@kbn/i18n'; import React from 'react'; -import { Transaction } from '../../../../../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { SPAN_NAME, TRANSACTION_NAME, SERVICE_NAME -} from '../../../../../../../../common/elasticsearch_fieldnames'; -import { NOT_AVAILABLE_LABEL } from '../../../../../../../../common/i18n'; -import { Span } from '../../../../../../../../typings/es_schemas/ui/Span'; +} from '../../../../../../../../../../../plugins/apm/common/elasticsearch_fieldnames'; +import { NOT_AVAILABLE_LABEL } from '../../../../../../../../../../../plugins/apm/common/i18n'; +import { Span } from '../../../../../../../../../../../plugins/apm/typings/es_schemas/ui/span'; import { StickyProperties } from '../../../../../../shared/StickyProperties'; import { TransactionOverviewLink } from '../../../../../../shared/Links/apm/TransactionOverviewLink'; import { TransactionDetailLink } from '../../../../../../shared/Links/apm/TransactionDetailLink'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/index.tsx index 6f93762e11a82..87102a486ab5f 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/index.tsx @@ -25,8 +25,8 @@ import { px, units } from '../../../../../../../style/variables'; import { Summary } from '../../../../../../shared/Summary'; import { TimestampTooltip } from '../../../../../../shared/TimestampTooltip'; import { DurationSummaryItem } from '../../../../../../shared/Summary/DurationSummaryItem'; -import { Span } from '../../../../../../../../typings/es_schemas/ui/Span'; -import { Transaction } from '../../../../../../../../typings/es_schemas/ui/Transaction'; +import { Span } from '../../../../../../../../../../../plugins/apm/typings/es_schemas/ui/span'; +import { Transaction } from '../../../../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { DiscoverSpanLink } from '../../../../../../shared/Links/DiscoverLinks/DiscoverSpanLink'; import { Stacktrace } from '../../../../../../shared/Stacktrace'; import { ResponsiveFlyout } from '../ResponsiveFlyout'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/TransactionFlyout/DroppedSpansWarning.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/TransactionFlyout/DroppedSpansWarning.tsx index f3e29d7c75717..85cf0b642530f 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/TransactionFlyout/DroppedSpansWarning.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/TransactionFlyout/DroppedSpansWarning.tsx @@ -7,7 +7,7 @@ import { EuiCallOut, EuiHorizontalRule } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; -import { Transaction } from '../../../../../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { ElasticDocsLink } from '../../../../../../shared/Links/ElasticDocsLink'; export function DroppedSpansWarning({ diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/TransactionFlyout/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/TransactionFlyout/index.tsx index df95577c81eff..e24414bb28d52 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/TransactionFlyout/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/TransactionFlyout/index.tsx @@ -16,7 +16,7 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; -import { Transaction } from '../../../../../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { TransactionActionMenu } from '../../../../../../shared/TransactionActionMenu/TransactionActionMenu'; import { TransactionSummary } from '../../../../../../shared/Summary/TransactionSummary'; import { FlyoutTopLevelProperties } from '../FlyoutTopLevelProperties'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/WaterfallItem.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/WaterfallItem.tsx index f57ccc3c34467..b7b3e8d82ce61 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/WaterfallItem.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/WaterfallItem.tsx @@ -10,13 +10,13 @@ import styled from 'styled-components'; import { EuiIcon, EuiText, EuiTitle, EuiToolTip } from '@elastic/eui'; import theme from '@elastic/eui/dist/eui_theme_light.json'; import { i18n } from '@kbn/i18n'; -import { isRumAgentName } from '../../../../../../../common/agent_name'; +import { isRumAgentName } from '../../../../../../../../../../plugins/apm/common/agent_name'; import { px, unit, units } from '../../../../../../style/variables'; import { asDuration } from '../../../../../../utils/formatters'; import { ErrorCount } from '../../ErrorCount'; import { IWaterfallItem } from './waterfall_helpers/waterfall_helpers'; import { ErrorOverviewLink } from '../../../../../shared/Links/apm/ErrorOverviewLink'; -import { TRACE_ID } from '../../../../../../../common/elasticsearch_fieldnames'; +import { TRACE_ID } from '../../../../../../../../../../plugins/apm/common/elasticsearch_fieldnames'; import { SyncBadge } from './SyncBadge'; type ItemType = 'transaction' | 'span' | 'error'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/waterfall_helpers/waterfall_helpers.test.ts b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/waterfall_helpers/waterfall_helpers.test.ts index 6b13b93200c61..416eb879d5974 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/waterfall_helpers/waterfall_helpers.test.ts +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/waterfall_helpers/waterfall_helpers.test.ts @@ -5,8 +5,8 @@ */ import { groupBy } from 'lodash'; -import { Span } from '../../../../../../../../typings/es_schemas/ui/Span'; -import { Transaction } from '../../../../../../../../typings/es_schemas/ui/Transaction'; +import { Span } from '../../../../../../../../../../../plugins/apm/typings/es_schemas/ui/span'; +import { Transaction } from '../../../../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { getClockSkew, getOrderedWaterfallItems, @@ -15,7 +15,7 @@ import { IWaterfallTransaction, IWaterfallError } from './waterfall_helpers'; -import { APMError } from '../../../../../../../../typings/es_schemas/ui/APMError'; +import { APMError } from '../../../../../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error'; describe('waterfall_helpers', () => { describe('getWaterfall', () => { diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/waterfall_helpers/waterfall_helpers.ts b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/waterfall_helpers/waterfall_helpers.ts index 3b52163aa7fa4..58d9134c4d787 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/waterfall_helpers/waterfall_helpers.ts +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/waterfall_helpers/waterfall_helpers.ts @@ -15,10 +15,11 @@ import { uniq, zipObject } from 'lodash'; -import { TraceAPIResponse } from '../../../../../../../../server/lib/traces/get_trace'; -import { APMError } from '../../../../../../../../typings/es_schemas/ui/APMError'; -import { Span } from '../../../../../../../../typings/es_schemas/ui/Span'; -import { Transaction } from '../../../../../../../../typings/es_schemas/ui/Transaction'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { TraceAPIResponse } from '../../../../../../../../../../../plugins/apm/server/lib/traces/get_trace'; +import { APMError } from '../../../../../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error'; +import { Span } from '../../../../../../../../../../../plugins/apm/typings/es_schemas/ui/span'; +import { Transaction } from '../../../../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; interface IWaterfallGroup { [key: string]: IWaterfallItem[]; diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/index.tsx index 69557241c42aa..1082052c6929d 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/index.tsx @@ -16,7 +16,8 @@ import { import { i18n } from '@kbn/i18n'; import { Location } from 'history'; import React, { useEffect, useState } from 'react'; -import { IBucket } from '../../../../../server/lib/transactions/distribution/get_buckets/transform'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { IBucket } from '../../../../../../../../plugins/apm/server/lib/transactions/distribution/get_buckets/transform'; import { IUrlParams } from '../../../../context/UrlParamsContext/types'; import { history } from '../../../../utils/history'; import { fromQuery, toQuery } from '../../../shared/Links/url_helpers'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/index.tsx index a6712becf7968..e2634be0e0be8 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/index.tsx @@ -27,7 +27,7 @@ import { FETCH_STATUS } from '../../../hooks/useFetcher'; import { TransactionBreakdown } from '../../shared/TransactionBreakdown'; import { ChartsSyncContextProvider } from '../../../context/ChartsSyncContext'; import { useTrackPageview } from '../../../../../../../plugins/observability/public'; -import { PROJECTION } from '../../../../common/projections/typings'; +import { PROJECTION } from '../../../../../../../plugins/apm/common/projections/typings'; import { LocalUIFilters } from '../../shared/LocalUIFilters'; import { HeightRetainer } from '../../shared/HeightRetainer'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionOverview/List/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionOverview/List/index.tsx index 3d75011f52f19..16fda7c600906 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionOverview/List/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionOverview/List/index.tsx @@ -8,8 +8,9 @@ import { EuiIcon, EuiToolTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React, { useMemo } from 'react'; import styled from 'styled-components'; -import { NOT_AVAILABLE_LABEL } from '../../../../../common/i18n'; -import { ITransactionGroup } from '../../../../../server/lib/transaction_groups/transform'; +import { NOT_AVAILABLE_LABEL } from '../../../../../../../../plugins/apm/common/i18n'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { ITransactionGroup } from '../../../../../../../../plugins/apm/server/lib/transaction_groups/transform'; import { fontFamilyCode, truncate } from '../../../../style/variables'; import { asDecimal, convertTo } from '../../../../utils/formatters'; import { ImpactBar } from '../../../shared/ImpactBar'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionOverview/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionOverview/index.tsx index 73824f235ab02..b008c98417867 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionOverview/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionOverview/index.tsx @@ -30,7 +30,7 @@ import { ChartsSyncContextProvider } from '../../../context/ChartsSyncContext'; import { useTrackPageview } from '../../../../../../../plugins/observability/public'; import { fromQuery, toQuery } from '../../shared/Links/url_helpers'; import { LocalUIFilters } from '../../shared/LocalUIFilters'; -import { PROJECTION } from '../../../../common/projections/typings'; +import { PROJECTION } from '../../../../../../../plugins/apm/common/projections/typings'; import { useUrlParams } from '../../../hooks/useUrlParams'; import { useServiceTransactionTypes } from '../../../hooks/useServiceTransactionTypes'; import { TransactionTypeFilter } from '../../shared/LocalUIFilters/TransactionTypeFilter'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/EnvironmentFilter/index.tsx b/x-pack/legacy/plugins/apm/public/components/shared/EnvironmentFilter/index.tsx index d17b3b7689b19..e911011f0979c 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/EnvironmentFilter/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/EnvironmentFilter/index.tsx @@ -15,7 +15,7 @@ import { fromQuery, toQuery } from '../Links/url_helpers'; import { ENVIRONMENT_ALL, ENVIRONMENT_NOT_DEFINED -} from '../../../../common/environment_filter_values'; +} from '../../../../../../../plugins/apm/common/environment_filter_values'; function updateEnvironmentUrl( location: ReturnType, diff --git a/x-pack/legacy/plugins/apm/public/components/shared/KeyValueTable/FormattedValue.tsx b/x-pack/legacy/plugins/apm/public/components/shared/KeyValueTable/FormattedValue.tsx index d33960fe5196b..4de07f75ff84f 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/KeyValueTable/FormattedValue.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/KeyValueTable/FormattedValue.tsx @@ -8,7 +8,7 @@ import theme from '@elastic/eui/dist/eui_theme_light.json'; import { isBoolean, isNumber, isObject } from 'lodash'; import React from 'react'; import styled from 'styled-components'; -import { NOT_AVAILABLE_LABEL } from '../../../../common/i18n'; +import { NOT_AVAILABLE_LABEL } from '../../../../../../../plugins/apm/common/i18n'; const EmptyValue = styled.span` color: ${theme.euiColorMediumShade}; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/KueryBar/get_bool_filter.ts b/x-pack/legacy/plugins/apm/public/components/shared/KueryBar/get_bool_filter.ts index 23feeed4b0418..19a9ae9538ad6 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/KueryBar/get_bool_filter.ts +++ b/x-pack/legacy/plugins/apm/public/components/shared/KueryBar/get_bool_filter.ts @@ -11,7 +11,7 @@ import { PROCESSOR_EVENT, TRANSACTION_NAME, SERVICE_NAME -} from '../../../../common/elasticsearch_fieldnames'; +} from '../../../../../../../plugins/apm/common/elasticsearch_fieldnames'; import { IUrlParams } from '../../../context/UrlParamsContext/types'; export function getBoolFilter(urlParams: IUrlParams) { diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverErrorLink.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverErrorLink.tsx index 38f7046685636..806d9f73369c3 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverErrorLink.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverErrorLink.tsx @@ -8,8 +8,8 @@ import React from 'react'; import { ERROR_GROUP_ID, SERVICE_NAME -} from '../../../../../common/elasticsearch_fieldnames'; -import { APMError } from '../../../../../typings/es_schemas/ui/APMError'; +} from '../../../../../../../../plugins/apm/common/elasticsearch_fieldnames'; +import { APMError } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error'; import { DiscoverLink } from './DiscoverLink'; function getDiscoverQuery(error: APMError, kuery?: string) { diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverLink.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverLink.tsx index b58a450d26644..6dc93292956fa 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverLink.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverLink.tsx @@ -11,7 +11,7 @@ import url from 'url'; import rison, { RisonValue } from 'rison-node'; import { useLocation } from '../../../../hooks/useLocation'; import { getTimepickerRisonData } from '../rison_helpers'; -import { APM_STATIC_INDEX_PATTERN_ID } from '../../../../../common/index_pattern_constants'; +import { APM_STATIC_INDEX_PATTERN_ID } from '../../../../../../../../plugins/apm/common/index_pattern_constants'; import { useApmPluginContext } from '../../../../hooks/useApmPluginContext'; import { AppMountContextBasePath } from '../../../../context/ApmPluginContext'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverSpanLink.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverSpanLink.tsx index 374454b74fce4..8fe5be28def22 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverSpanLink.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverSpanLink.tsx @@ -5,8 +5,8 @@ */ import React from 'react'; -import { SPAN_ID } from '../../../../../common/elasticsearch_fieldnames'; -import { Span } from '../../../../../typings/es_schemas/ui/Span'; +import { SPAN_ID } from '../../../../../../../../plugins/apm/common/elasticsearch_fieldnames'; +import { Span } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/span'; import { DiscoverLink } from './DiscoverLink'; function getDiscoverQuery(span: Span) { diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverTransactionLink.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverTransactionLink.tsx index 0e381c490f8b4..b0af33fd7d7f7 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverTransactionLink.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverTransactionLink.tsx @@ -9,8 +9,8 @@ import { PROCESSOR_EVENT, TRACE_ID, TRANSACTION_ID -} from '../../../../../common/elasticsearch_fieldnames'; -import { Transaction } from '../../../../../typings/es_schemas/ui/Transaction'; +} from '../../../../../../../../plugins/apm/common/elasticsearch_fieldnames'; +import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { DiscoverLink } from './DiscoverLink'; export function getDiscoverQuery(transaction: Transaction) { diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorButton.test.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorButton.test.tsx index 33cf05401a729..eeb9fd20a4bcb 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorButton.test.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorButton.test.tsx @@ -6,7 +6,7 @@ import { shallow, ShallowWrapper } from 'enzyme'; import React from 'react'; -import { APMError } from '../../../../../../typings/es_schemas/ui/APMError'; +import { APMError } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error'; import { DiscoverErrorLink } from '../DiscoverErrorLink'; describe('DiscoverErrorLink without kuery', () => { diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorLink.test.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorLink.test.tsx index 33cf05401a729..eeb9fd20a4bcb 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorLink.test.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverErrorLink.test.tsx @@ -6,7 +6,7 @@ import { shallow, ShallowWrapper } from 'enzyme'; import React from 'react'; -import { APMError } from '../../../../../../typings/es_schemas/ui/APMError'; +import { APMError } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error'; import { DiscoverErrorLink } from '../DiscoverErrorLink'; describe('DiscoverErrorLink without kuery', () => { diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverLinks.integration.test.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverLinks.integration.test.tsx index 2f49e476ef610..759caa785c1af 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverLinks.integration.test.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverLinks.integration.test.tsx @@ -6,9 +6,9 @@ import { Location } from 'history'; import React from 'react'; -import { APMError } from '../../../../../../typings/es_schemas/ui/APMError'; -import { Span } from '../../../../../../typings/es_schemas/ui/Span'; -import { Transaction } from '../../../../../../typings/es_schemas/ui/Transaction'; +import { APMError } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error'; +import { Span } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/span'; +import { Transaction } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { getRenderedHref } from '../../../../../utils/testHelpers'; import { DiscoverErrorLink } from '../DiscoverErrorLink'; import { DiscoverSpanLink } from '../DiscoverSpanLink'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionButton.test.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionButton.test.tsx index a16bf389f177c..d72925c1956a4 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionButton.test.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionButton.test.tsx @@ -6,7 +6,7 @@ import { shallow } from 'enzyme'; import React from 'react'; -import { Transaction } from '../../../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { DiscoverTransactionLink, getDiscoverQuery diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionLink.test.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionLink.test.tsx index 3b876aa5950b4..15a92474fcc6d 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionLink.test.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionLink.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { Transaction } from '../../../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; // @ts-ignore import configureStore from '../../../../../store/config/configureStore'; import { getDiscoverQuery } from '../DiscoverTransactionLink'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLJobLink.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLJobLink.tsx index 81c5d17d491c0..ecf788ddd2e69 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLJobLink.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLJobLink.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { getMlJobId } from '../../../../../common/ml_job_constants'; +import { getMlJobId } from '../../../../../../../../plugins/apm/common/ml_job_constants'; import { MLLink } from './MLLink'; interface Props { diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/url_helpers.ts b/x-pack/legacy/plugins/apm/public/components/shared/Links/url_helpers.ts index 36465309b736e..c7d71d0b6dac5 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Links/url_helpers.ts +++ b/x-pack/legacy/plugins/apm/public/components/shared/Links/url_helpers.ts @@ -5,7 +5,8 @@ */ import { parse, stringify } from 'query-string'; -import { LocalUIFilterName } from '../../../../server/lib/ui_filters/local_ui_filters/config'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { LocalUIFilterName } from '../../../../../../../plugins/apm/server/lib/ui_filters/local_ui_filters/config'; import { url } from '../../../../../../../../src/plugins/kibana_utils/public'; export function toQuery(search?: string): APMQueryParamsRaw { diff --git a/x-pack/legacy/plugins/apm/public/components/shared/LocalUIFilters/index.tsx b/x-pack/legacy/plugins/apm/public/components/shared/LocalUIFilters/index.tsx index 737e78a223ae2..cede3e394cfab 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/LocalUIFilters/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/LocalUIFilters/index.tsx @@ -13,10 +13,11 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import styled from 'styled-components'; -import { LocalUIFilterName } from '../../../../server/lib/ui_filters/local_ui_filters/config'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { LocalUIFilterName } from '../../../../../../../plugins/apm/server/lib/ui_filters/local_ui_filters/config'; import { Filter } from './Filter'; import { useLocalUIFilters } from '../../../hooks/useLocalUIFilters'; -import { PROJECTION } from '../../../../common/projections/typings'; +import { PROJECTION } from '../../../../../../../plugins/apm/common/projections/typings'; interface Props { projection: PROJECTION; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/__test__/ErrorMetadata.test.tsx b/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/__test__/ErrorMetadata.test.tsx index 5bbc194e35992..0c60d523b8f3f 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/__test__/ErrorMetadata.test.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/__test__/ErrorMetadata.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { ErrorMetadata } from '..'; import { render } from '@testing-library/react'; -import { APMError } from '../../../../../../typings/es_schemas/ui/APMError'; +import { APMError } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error'; import { expectTextsInDocument, expectTextsNotInDocument, diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/index.tsx b/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/index.tsx index 04a5b60467730..ce991d8b0dc00 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/index.tsx @@ -6,7 +6,7 @@ import React, { useMemo } from 'react'; import { ERROR_METADATA_SECTIONS } from './sections'; -import { APMError } from '../../../../../typings/es_schemas/ui/APMError'; +import { APMError } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error'; import { getSectionsWithRows } from '../helper'; import { MetadataTable } from '..'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/__test__/SpanMetadata.test.tsx b/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/__test__/SpanMetadata.test.tsx index 99d8a0790a816..ee66636d88ba9 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/__test__/SpanMetadata.test.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/__test__/SpanMetadata.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { render } from '@testing-library/react'; import { SpanMetadata } from '..'; -import { Span } from '../../../../../../typings/es_schemas/ui/Span'; +import { Span } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/span'; import { expectTextsInDocument, expectTextsNotInDocument, diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/index.tsx b/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/index.tsx index 03182062d324a..2134f12531a7a 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/index.tsx @@ -6,7 +6,7 @@ import React, { useMemo } from 'react'; import { SPAN_METADATA_SECTIONS } from './sections'; -import { Span } from '../../../../../typings/es_schemas/ui/Span'; +import { Span } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/span'; import { getSectionsWithRows } from '../helper'; import { MetadataTable } from '..'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/__test__/TransactionMetadata.test.tsx b/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/__test__/TransactionMetadata.test.tsx index 93e87e884ea76..f426074fbef80 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/__test__/TransactionMetadata.test.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/__test__/TransactionMetadata.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { TransactionMetadata } from '..'; import { render } from '@testing-library/react'; -import { Transaction } from '../../../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { expectTextsInDocument, expectTextsNotInDocument, diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/index.tsx b/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/index.tsx index 4216e37e0cb27..6f93de4e87e49 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/index.tsx @@ -6,7 +6,7 @@ import React, { useMemo } from 'react'; import { TRANSACTION_METADATA_SECTIONS } from './sections'; -import { Transaction } from '../../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { getSectionsWithRows } from '../helper'; import { MetadataTable } from '..'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/__test__/helper.test.ts b/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/__test__/helper.test.ts index aaf73619e481a..b65b52bf30a5c 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/__test__/helper.test.ts +++ b/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/__test__/helper.test.ts @@ -6,7 +6,7 @@ import { getSectionsWithRows, filterSectionsByTerm } from '../helper'; import { LABELS, HTTP, SERVICE } from '../sections'; -import { Transaction } from '../../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; describe('MetadataTable Helper', () => { const sections = [ diff --git a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/helper.ts b/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/helper.ts index c272790826d8d..ef329abafa61b 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/helper.ts +++ b/x-pack/legacy/plugins/apm/public/components/shared/MetadataTable/helper.ts @@ -6,9 +6,9 @@ import { get, pick, isEmpty } from 'lodash'; import { Section } from './sections'; -import { Transaction } from '../../../../typings/es_schemas/ui/Transaction'; -import { APMError } from '../../../../typings/es_schemas/ui/APMError'; -import { Span } from '../../../../typings/es_schemas/ui/Span'; +import { Transaction } from '../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; +import { APMError } from '../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error'; +import { Span } from '../../../../../../../plugins/apm/typings/es_schemas/ui/span'; import { flattenObject, KeyValuePair } from '../../../utils/flattenObject'; export type SectionsWithRows = ReturnType; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/ServiceForm/index.tsx b/x-pack/legacy/plugins/apm/public/components/shared/ServiceForm/index.tsx index 58a203bded715..ab3accec90d1d 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/ServiceForm/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/ServiceForm/index.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import { omitAllOption, getOptionLabel -} from '../../../../common/agent_configuration_constants'; +} from '../../../../../../../plugins/apm/common/agent_configuration_constants'; import { useFetcher } from '../../../hooks/useFetcher'; import { SelectWithPlaceholder } from '../SelectWithPlaceholder'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/CauseStacktrace.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/CauseStacktrace.tsx index 52f2ba4586718..eab414ad47c2c 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/CauseStacktrace.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/CauseStacktrace.tsx @@ -11,7 +11,7 @@ import { i18n } from '@kbn/i18n'; import { EuiAccordion, EuiTitle } from '@elastic/eui'; import { px, unit } from '../../../style/variables'; import { Stacktrace } from '.'; -import { IStackframe } from '../../../../typings/es_schemas/raw/fields/Stackframe'; +import { IStackframe } from '../../../../../../../plugins/apm/typings/es_schemas/raw/fields/stackframe'; // @ts-ignore Styled Components has trouble inferring the types of the default props here. const Accordion = styled(EuiAccordion)` diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Context.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Context.tsx index 4320156fad003..d289539ca44b1 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Context.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Context.tsx @@ -22,7 +22,7 @@ import { registerLanguage } from 'react-syntax-highlighter/dist/light'; // @ts-ignore import { xcode } from 'react-syntax-highlighter/dist/styles'; import styled from 'styled-components'; -import { IStackframeWithLineContext } from '../../../../typings/es_schemas/raw/fields/Stackframe'; +import { IStackframeWithLineContext } from '../../../../../../../plugins/apm/typings/es_schemas/raw/fields/stackframe'; import { borderRadius, px, unit, units } from '../../../style/variables'; registerLanguage('javascript', javascript); diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/FrameHeading.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/FrameHeading.tsx index 94cad732d5a94..daa722255bdf3 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/FrameHeading.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/FrameHeading.tsx @@ -7,7 +7,7 @@ import theme from '@elastic/eui/dist/eui_theme_light.json'; import React, { Fragment } from 'react'; import styled from 'styled-components'; -import { IStackframe } from '../../../../typings/es_schemas/raw/fields/Stackframe'; +import { IStackframe } from '../../../../../../../plugins/apm/typings/es_schemas/raw/fields/stackframe'; import { fontFamilyCode, fontSize, px, units } from '../../../style/variables'; const FileDetails = styled.div` diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/LibraryStacktrace.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/LibraryStacktrace.tsx index f62ba95407893..be6595153aa77 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/LibraryStacktrace.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/LibraryStacktrace.tsx @@ -8,7 +8,7 @@ import { EuiAccordion } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; import styled from 'styled-components'; -import { IStackframe } from '../../../../typings/es_schemas/raw/fields/Stackframe'; +import { IStackframe } from '../../../../../../../plugins/apm/typings/es_schemas/raw/fields/stackframe'; import { Stackframe } from './Stackframe'; import { px, unit } from '../../../style/variables'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Stackframe.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Stackframe.tsx index 3586368db84fc..404d474a7960a 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Stackframe.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Stackframe.tsx @@ -11,7 +11,7 @@ import { EuiAccordion } from '@elastic/eui'; import { IStackframe, IStackframeWithLineContext -} from '../../../../typings/es_schemas/raw/fields/Stackframe'; +} from '../../../../../../../plugins/apm/typings/es_schemas/raw/fields/stackframe'; import { borderRadius, fontFamilyCode, diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Variables.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Variables.tsx index 6d1b10c90a999..0786116a659c7 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Variables.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Variables.tsx @@ -10,7 +10,7 @@ import { EuiAccordion } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; import { borderRadius, px, unit, units } from '../../../style/variables'; -import { IStackframe } from '../../../../typings/es_schemas/raw/fields/Stackframe'; +import { IStackframe } from '../../../../../../../plugins/apm/typings/es_schemas/raw/fields/stackframe'; import { KeyValueTable } from '../KeyValueTable'; import { flattenObject } from '../../../utils/flattenObject'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/Stackframe.test.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/Stackframe.test.tsx index b485b4f844f64..1b2268326e6be 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/Stackframe.test.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/Stackframe.test.tsx @@ -6,7 +6,7 @@ import { mount, ReactWrapper, shallow } from 'enzyme'; import React from 'react'; -import { IStackframe } from '../../../../../typings/es_schemas/raw/fields/Stackframe'; +import { IStackframe } from '../../../../../../../../plugins/apm/typings/es_schemas/raw/fields/stackframe'; import { Stackframe } from '../Stackframe'; import stacktracesMock from './stacktraces.json'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/index.test.ts b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/index.test.ts index a6db266e657ce..9b6d74033e1c5 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/index.test.ts +++ b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/__test__/index.test.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { IStackframe } from '../../../../../typings/es_schemas/raw/fields/Stackframe'; +import { IStackframe } from '../../../../../../../../plugins/apm/typings/es_schemas/raw/fields/stackframe'; import { getGroupedStackframes } from '../index'; import stacktracesMock from './stacktraces.json'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/index.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/index.tsx index b7963b5c75a92..141ed544a6166 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/index.tsx @@ -8,7 +8,7 @@ import { EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { isEmpty, last } from 'lodash'; import React, { Fragment } from 'react'; -import { IStackframe } from '../../../../typings/es_schemas/raw/fields/Stackframe'; +import { IStackframe } from '../../../../../../../plugins/apm/typings/es_schemas/raw/fields/stackframe'; import { EmptyMessage } from '../../shared/EmptyMessage'; import { LibraryStacktrace } from './LibraryStacktrace'; import { Stackframe } from './Stackframe'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/StickyProperties/StickyProperties.test.js b/x-pack/legacy/plugins/apm/public/components/shared/StickyProperties/StickyProperties.test.js index b6acb6904f865..08283dee3825d 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/StickyProperties/StickyProperties.test.js +++ b/x-pack/legacy/plugins/apm/public/components/shared/StickyProperties/StickyProperties.test.js @@ -7,7 +7,10 @@ import React from 'react'; import { StickyProperties } from './index'; import { shallow } from 'enzyme'; -import { USER_ID, URL_FULL } from '../../../../common/elasticsearch_fieldnames'; +import { + USER_ID, + URL_FULL +} from '../../../../../../../plugins/apm/common/elasticsearch_fieldnames'; import { mockMoment } from '../../../utils/testHelpers'; describe('StickyProperties', () => { diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/TransactionSummary.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Summary/TransactionSummary.tsx index 51da61cd7c1a6..f0fe57e46f2fe 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Summary/TransactionSummary.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Summary/TransactionSummary.tsx @@ -4,12 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { Transaction } from '../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { Summary } from './'; import { TimestampTooltip } from '../TimestampTooltip'; import { DurationSummaryItem } from './DurationSummaryItem'; import { ErrorCountSummaryItemBadge } from './ErrorCountSummaryItemBadge'; -import { isRumAgentName } from '../../../../common/agent_name'; +import { isRumAgentName } from '../../../../../../../plugins/apm/common/agent_name'; import { HttpInfoSummaryItem } from './HttpInfoSummaryItem'; import { TransactionResultSummaryItem } from './TransactionResultSummaryItem'; import { UserAgentSummaryItem } from './UserAgentSummaryItem'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/UserAgentSummaryItem.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Summary/UserAgentSummaryItem.tsx index 1a019ae0a5e42..10a6bcc1ef7bd 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Summary/UserAgentSummaryItem.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Summary/UserAgentSummaryItem.tsx @@ -9,7 +9,7 @@ import styled from 'styled-components'; import theme from '@elastic/eui/dist/eui_theme_light.json'; import { EuiToolTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { UserAgent } from '../../../../typings/es_schemas/raw/fields/UserAgent'; +import { UserAgent } from '../../../../../../../plugins/apm/typings/es_schemas/raw/fields/user_agent'; type UserAgentSummaryItemProps = UserAgent; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/__fixtures__/transactions.ts b/x-pack/legacy/plugins/apm/public/components/shared/Summary/__fixtures__/transactions.ts index f4346e47f23c2..05fb73a9e2749 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Summary/__fixtures__/transactions.ts +++ b/x-pack/legacy/plugins/apm/public/components/shared/Summary/__fixtures__/transactions.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { Transaction } from '../../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; export const httpOk: Transaction = { '@timestamp': '0', diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Summary/index.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Summary/index.tsx index ce6935d1858aa..ef99f3a4933a7 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Summary/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Summary/index.tsx @@ -8,7 +8,7 @@ import { EuiFlexGrid, EuiFlexItem } from '@elastic/eui'; import styled from 'styled-components'; import euiLightVars from '@elastic/eui/dist/eui_theme_light.json'; import { px, units } from '../../../../public/style/variables'; -import { Maybe } from '../../../../typings/common'; +import { Maybe } from '../../../../../../../plugins/apm/typings/common'; interface Props { items: Array>; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/TransactionActionMenu.tsx b/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/TransactionActionMenu.tsx index 99f0b0d4fc223..dd022626807d0 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/TransactionActionMenu.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/TransactionActionMenu.tsx @@ -16,7 +16,7 @@ import { SectionSubtitle, SectionTitle } from '../../../../../../../plugins/observability/public'; -import { Transaction } from '../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { useApmPluginContext } from '../../../hooks/useApmPluginContext'; import { useLocation } from '../../../hooks/useLocation'; import { useUrlParams } from '../../../hooks/useUrlParams'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/TransactionActionMenu.test.tsx b/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/TransactionActionMenu.test.tsx index e9f89034f58ee..ac3616e8c134c 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/TransactionActionMenu.test.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/TransactionActionMenu.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { render, fireEvent } from '@testing-library/react'; import { TransactionActionMenu } from '../TransactionActionMenu'; -import { Transaction } from '../../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import * as Transactions from './mockData'; import { MockApmPluginContextWrapper } from '../../../../utils/testHelpers'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/sections.test.ts b/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/sections.test.ts index 9f07bd508c95c..3032dd1704f4e 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/sections.test.ts +++ b/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/sections.test.ts @@ -5,7 +5,7 @@ */ import { Location } from 'history'; import { getSections } from '../sections'; -import { Transaction } from '../../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { AppMountContextBasePath } from '../../../../context/ApmPluginContext'; describe('Transaction action menu', () => { diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/sections.ts b/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/sections.ts index 31efdb6355563..ffdf0b485da64 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/sections.ts +++ b/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/sections.ts @@ -8,7 +8,7 @@ import { Location } from 'history'; import { pick, isEmpty } from 'lodash'; import moment from 'moment'; import url from 'url'; -import { Transaction } from '../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../../../plugins/apm/typings/es_schemas/ui/transaction'; import { IUrlParams } from '../../../context/UrlParamsContext/types'; import { getDiscoverHref } from '../Links/DiscoverLinks/DiscoverLink'; import { getDiscoverQuery } from '../Links/DiscoverLinks/DiscoverTransactionLink'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownGraph/index.tsx b/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownGraph/index.tsx index a964b425073b5..50ea169c017f9 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownGraph/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownGraph/index.tsx @@ -7,9 +7,12 @@ import React, { useMemo } from 'react'; import numeral from '@elastic/numeral'; import { throttle } from 'lodash'; -import { NOT_AVAILABLE_LABEL } from '../../../../../common/i18n'; -import { Coordinate, TimeSeries } from '../../../../../typings/timeseries'; -import { Maybe } from '../../../../../typings/common'; +import { NOT_AVAILABLE_LABEL } from '../../../../../../../../plugins/apm/common/i18n'; +import { + Coordinate, + TimeSeries +} from '../../../../../../../../plugins/apm/typings/timeseries'; +import { Maybe } from '../../../../../../../../plugins/apm/typings/common'; import { TransactionLineChart } from '../../charts/TransactionCharts/TransactionLineChart'; import { asPercent } from '../../../../utils/formatters'; import { unit } from '../../../../style/variables'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/AnnotationsPlot.tsx b/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/AnnotationsPlot.tsx index 6eff4759b2e7c..ec6168df5b134 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/AnnotationsPlot.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/AnnotationsPlot.tsx @@ -14,8 +14,8 @@ import { EuiText } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { Maybe } from '../../../../../typings/common'; -import { Annotation } from '../../../../../common/annotations'; +import { Maybe } from '../../../../../../../../plugins/apm/typings/common'; +import { Annotation } from '../../../../../../../../plugins/apm/common/annotations'; import { PlotValues, SharedPlot } from './plotUtils'; import { asAbsoluteDateTime } from '../../../../utils/formatters'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.test.ts b/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.test.ts index b130deed7f098..bfc5c7c243f31 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.test.ts +++ b/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.test.ts @@ -6,7 +6,10 @@ // @ts-ignore import * as plotUtils from './plotUtils'; -import { TimeSeries, Coordinate } from '../../../../../typings/timeseries'; +import { + TimeSeries, + Coordinate +} from '../../../../../../../../plugins/apm/typings/timeseries'; describe('plotUtils', () => { describe('getPlotValues', () => { diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.tsx b/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.tsx index 64350a5741647..c489c270d19ac 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/plotUtils.tsx @@ -11,7 +11,10 @@ import d3 from 'd3'; import PropTypes from 'prop-types'; import React from 'react'; -import { TimeSeries, Coordinate } from '../../../../../typings/timeseries'; +import { + TimeSeries, + Coordinate +} from '../../../../../../../../plugins/apm/typings/timeseries'; import { unit } from '../../../../style/variables'; import { getDomainTZ, getTimeTicksTZ } from '../helper/timezone'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/MetricsChart/index.tsx b/x-pack/legacy/plugins/apm/public/components/shared/charts/MetricsChart/index.tsx index 30dcc99af31b9..2ceac87d9aab3 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/charts/MetricsChart/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/charts/MetricsChart/index.tsx @@ -5,7 +5,8 @@ */ import { EuiTitle } from '@elastic/eui'; import React from 'react'; -import { GenericMetricsChart } from '../../../../../server/lib/metrics/transform_metrics_chart'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { GenericMetricsChart } from '../../../../../../../../plugins/apm/server/lib/metrics/transform_metrics_chart'; // @ts-ignore import CustomPlot from '../CustomPlot'; import { @@ -16,10 +17,10 @@ import { getFixedByteFormatter, asDuration } from '../../../../utils/formatters'; -import { Coordinate } from '../../../../../typings/timeseries'; +import { Coordinate } from '../../../../../../../../plugins/apm/typings/timeseries'; import { isValidCoordinateValue } from '../../../../utils/isValidCoordinateValue'; import { useChartsSync } from '../../../../hooks/useChartsSync'; -import { Maybe } from '../../../../../typings/common'; +import { Maybe } from '../../../../../../../../plugins/apm/typings/common'; interface Props { start: Maybe; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/ErrorMarker.tsx b/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/ErrorMarker.tsx index 51368a4fb946d..48265ce7c80a8 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/ErrorMarker.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/charts/Timeline/Marker/ErrorMarker.tsx @@ -11,7 +11,7 @@ import styled from 'styled-components'; import { TRACE_ID, TRANSACTION_ID -} from '../../../../../../common/elasticsearch_fieldnames'; +} from '../../../../../../../../../plugins/apm/common/elasticsearch_fieldnames'; import { useUrlParams } from '../../../../../hooks/useUrlParams'; import { px, unit, units } from '../../../../../style/variables'; import { asDuration } from '../../../../../utils/formatters'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/TransactionLineChart/index.tsx b/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/TransactionLineChart/index.tsx index 27c829f63cf0a..c9c31b05e264c 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/TransactionLineChart/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/TransactionLineChart/index.tsx @@ -8,7 +8,7 @@ import React, { useCallback } from 'react'; import { Coordinate, RectCoordinate -} from '../../../../../../typings/timeseries'; +} from '../../../../../../../../../plugins/apm/typings/timeseries'; import { useChartsSync } from '../../../../../hooks/useChartsSync'; // @ts-ignore import CustomPlot from '../../CustomPlot'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/index.tsx b/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/index.tsx index b0555da705a30..368a39e4ad228 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/index.tsx @@ -19,8 +19,11 @@ import { Location } from 'history'; import React, { Component } from 'react'; import { isEmpty, flatten } from 'lodash'; import styled from 'styled-components'; -import { NOT_AVAILABLE_LABEL } from '../../../../../common/i18n'; -import { Coordinate, TimeSeries } from '../../../../../typings/timeseries'; +import { NOT_AVAILABLE_LABEL } from '../../../../../../../../plugins/apm/common/i18n'; +import { + Coordinate, + TimeSeries +} from '../../../../../../../../plugins/apm/typings/timeseries'; import { ITransactionChartData } from '../../../../selectors/chartSelectors'; import { IUrlParams } from '../../../../context/UrlParamsContext/types'; import { @@ -39,7 +42,7 @@ import { TRANSACTION_PAGE_LOAD, TRANSACTION_ROUTE_CHANGE, TRANSACTION_REQUEST -} from '../../../../../common/transaction_types'; +} from '../../../../../../../../plugins/apm/common/transaction_types'; interface TransactionChartProps { hasMLJob: boolean; diff --git a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/helpers.ts b/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/helpers.ts index f1e45fe45255d..b80db0e9ae073 100644 --- a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/helpers.ts +++ b/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/helpers.ts @@ -7,7 +7,7 @@ import { compact, pick } from 'lodash'; import datemath from '@elastic/datemath'; import { IUrlParams } from './types'; -import { ProcessorEvent } from '../../../common/processor_event'; +import { ProcessorEvent } from '../../../../../../plugins/apm/common/processor_event'; interface PathParams { processorEvent?: ProcessorEvent; diff --git a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/index.tsx b/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/index.tsx index 58057b2a9a201..588936039c2bc 100644 --- a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/index.tsx +++ b/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/index.tsx @@ -16,11 +16,12 @@ import { uniqueId, mapValues } from 'lodash'; import { IUrlParams } from './types'; import { getParsedDate } from './helpers'; import { resolveUrlParams } from './resolveUrlParams'; -import { UIFilters } from '../../../typings/ui-filters'; +import { UIFilters } from '../../../../../../plugins/apm/typings/ui_filters'; import { localUIFilterNames, LocalUIFilterName -} from '../../../server/lib/ui_filters/local_ui_filters/config'; + // eslint-disable-next-line @kbn/eslint/no-restricted-paths +} from '../../../../../../plugins/apm/server/lib/ui_filters/local_ui_filters/config'; import { pickKeys } from '../../utils/pickKeys'; import { useDeepObjectIdentity } from '../../hooks/useDeepObjectIdentity'; diff --git a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/resolveUrlParams.ts b/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/resolveUrlParams.ts index 887b45e73462c..f022d2084583b 100644 --- a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/resolveUrlParams.ts +++ b/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/resolveUrlParams.ts @@ -17,7 +17,8 @@ import { } from './helpers'; import { toQuery } from '../../components/shared/Links/url_helpers'; import { TIMEPICKER_DEFAULTS } from './constants'; -import { localUIFilterNames } from '../../../server/lib/ui_filters/local_ui_filters/config'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { localUIFilterNames } from '../../../../../../plugins/apm/server/lib/ui_filters/local_ui_filters/config'; import { pickKeys } from '../../utils/pickKeys'; type TimeUrlParams = Pick< diff --git a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/types.ts b/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/types.ts index 496b28e168089..acde09308ab46 100644 --- a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/types.ts +++ b/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/types.ts @@ -4,8 +4,9 @@ * you may not use this file except in compliance with the Elastic License. */ -import { LocalUIFilterName } from '../../../server/lib/ui_filters/local_ui_filters/config'; -import { ProcessorEvent } from '../../../common/processor_event'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { LocalUIFilterName } from '../../../../../../plugins/apm/server/lib/ui_filters/local_ui_filters/config'; +import { ProcessorEvent } from '../../../../../../plugins/apm/common/processor_event'; export type IUrlParams = { detailTab?: string; diff --git a/x-pack/legacy/plugins/apm/public/hooks/useAvgDurationByBrowser.ts b/x-pack/legacy/plugins/apm/public/hooks/useAvgDurationByBrowser.ts index a1e9294455d54..256c2fa68bfbc 100644 --- a/x-pack/legacy/plugins/apm/public/hooks/useAvgDurationByBrowser.ts +++ b/x-pack/legacy/plugins/apm/public/hooks/useAvgDurationByBrowser.ts @@ -7,9 +7,10 @@ import theme from '@elastic/eui/dist/eui_theme_light.json'; import { useFetcher } from './useFetcher'; import { useUrlParams } from './useUrlParams'; -import { AvgDurationByBrowserAPIResponse } from '../../server/lib/transactions/avg_duration_by_browser'; -import { TimeSeries } from '../../typings/timeseries'; -import { getVizColorForIndex } from '../../common/viz_colors'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { AvgDurationByBrowserAPIResponse } from '../../../../../plugins/apm/server/lib/transactions/avg_duration_by_browser'; +import { TimeSeries } from '../../../../../plugins/apm/typings/timeseries'; +import { getVizColorForIndex } from '../../../../../plugins/apm/common/viz_colors'; function toTimeSeries(data?: AvgDurationByBrowserAPIResponse): TimeSeries[] { if (!data) { diff --git a/x-pack/legacy/plugins/apm/public/hooks/useDynamicIndexPattern.ts b/x-pack/legacy/plugins/apm/public/hooks/useDynamicIndexPattern.ts index c369806a4616f..747144690bb24 100644 --- a/x-pack/legacy/plugins/apm/public/hooks/useDynamicIndexPattern.ts +++ b/x-pack/legacy/plugins/apm/public/hooks/useDynamicIndexPattern.ts @@ -5,7 +5,7 @@ */ import { useFetcher } from './useFetcher'; -import { ProcessorEvent } from '../../common/processor_event'; +import { ProcessorEvent } from '../../../../../plugins/apm/common/processor_event'; export function useDynamicIndexPattern( processorEvent: ProcessorEvent | undefined diff --git a/x-pack/legacy/plugins/apm/public/hooks/useLocalUIFilters.ts b/x-pack/legacy/plugins/apm/public/hooks/useLocalUIFilters.ts index 39164e8a5eff4..9f14b2b25fc94 100644 --- a/x-pack/legacy/plugins/apm/public/hooks/useLocalUIFilters.ts +++ b/x-pack/legacy/plugins/apm/public/hooks/useLocalUIFilters.ts @@ -6,16 +6,18 @@ import { omit } from 'lodash'; import { useFetcher } from './useFetcher'; -import { LocalUIFiltersAPIResponse } from '../../server/lib/ui_filters/local_ui_filters'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { LocalUIFiltersAPIResponse } from '../../../../../plugins/apm/server/lib/ui_filters/local_ui_filters'; import { useUrlParams } from './useUrlParams'; import { LocalUIFilterName, localUIFilters -} from '../../server/lib/ui_filters/local_ui_filters/config'; + // eslint-disable-next-line @kbn/eslint/no-restricted-paths +} from '../../../../../plugins/apm/server/lib/ui_filters/local_ui_filters/config'; import { history } from '../utils/history'; import { toQuery, fromQuery } from '../components/shared/Links/url_helpers'; import { removeUndefinedProps } from '../context/UrlParamsContext/helpers'; -import { PROJECTION } from '../../common/projections/typings'; +import { PROJECTION } from '../../../../../plugins/apm/common/projections/typings'; import { pickKeys } from '../utils/pickKeys'; import { useCallApi } from './useCallApi'; diff --git a/x-pack/legacy/plugins/apm/public/hooks/useServiceMetricCharts.ts b/x-pack/legacy/plugins/apm/public/hooks/useServiceMetricCharts.ts index 51a632ac5f0a6..72618a6254f4c 100644 --- a/x-pack/legacy/plugins/apm/public/hooks/useServiceMetricCharts.ts +++ b/x-pack/legacy/plugins/apm/public/hooks/useServiceMetricCharts.ts @@ -4,7 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import { MetricsChartsByAgentAPIResponse } from '../../server/lib/metrics/get_metrics_chart_data_by_agent'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { MetricsChartsByAgentAPIResponse } from '../../../../../plugins/apm/server/lib/metrics/get_metrics_chart_data_by_agent'; import { IUrlParams } from '../context/UrlParamsContext/types'; import { useUiFilters } from '../context/UrlParamsContext'; import { useFetcher } from './useFetcher'; diff --git a/x-pack/legacy/plugins/apm/public/hooks/useTransactionDistribution.ts b/x-pack/legacy/plugins/apm/public/hooks/useTransactionDistribution.ts index e50ea7eab187f..9a93a2334924a 100644 --- a/x-pack/legacy/plugins/apm/public/hooks/useTransactionDistribution.ts +++ b/x-pack/legacy/plugins/apm/public/hooks/useTransactionDistribution.ts @@ -7,7 +7,8 @@ import { IUrlParams } from '../context/UrlParamsContext/types'; import { useFetcher } from './useFetcher'; import { useUiFilters } from '../context/UrlParamsContext'; -import { TransactionDistributionAPIResponse } from '../../server/lib/transactions/distribution'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { TransactionDistributionAPIResponse } from '../../../../../plugins/apm/server/lib/transactions/distribution'; const INITIAL_DATA = { buckets: [] as TransactionDistributionAPIResponse['buckets'], diff --git a/x-pack/legacy/plugins/apm/public/hooks/useTransactionList.ts b/x-pack/legacy/plugins/apm/public/hooks/useTransactionList.ts index 15356139dd607..6ede77023790b 100644 --- a/x-pack/legacy/plugins/apm/public/hooks/useTransactionList.ts +++ b/x-pack/legacy/plugins/apm/public/hooks/useTransactionList.ts @@ -8,7 +8,8 @@ import { useMemo } from 'react'; import { IUrlParams } from '../context/UrlParamsContext/types'; import { useUiFilters } from '../context/UrlParamsContext'; import { useFetcher } from './useFetcher'; -import { TransactionGroupListAPIResponse } from '../../server/lib/transaction_groups'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { TransactionGroupListAPIResponse } from '../../../../../plugins/apm/server/lib/transaction_groups'; const getRelativeImpact = ( impact: number, diff --git a/x-pack/legacy/plugins/apm/public/selectors/chartSelectors.ts b/x-pack/legacy/plugins/apm/public/selectors/chartSelectors.ts index 75a558ac81a54..d60b63e243d71 100644 --- a/x-pack/legacy/plugins/apm/public/selectors/chartSelectors.ts +++ b/x-pack/legacy/plugins/apm/public/selectors/chartSelectors.ts @@ -9,13 +9,15 @@ import { i18n } from '@kbn/i18n'; import { difference, zipObject } from 'lodash'; import mean from 'lodash.mean'; import { rgba } from 'polished'; -import { TimeSeriesAPIResponse } from '../../server/lib/transactions/charts'; -import { ApmTimeSeriesResponse } from '../../server/lib/transactions/charts/get_timeseries_data/transform'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { TimeSeriesAPIResponse } from '../../../../../plugins/apm/server/lib/transactions/charts'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { ApmTimeSeriesResponse } from '../../../../../plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform'; import { Coordinate, RectCoordinate, TimeSeries -} from '../../typings/timeseries'; +} from '../../../../../plugins/apm/typings/timeseries'; import { asDecimal, tpmUnit, convertTo } from '../utils/formatters'; import { IUrlParams } from '../context/UrlParamsContext/types'; import { getEmptySeries } from '../components/shared/charts/CustomPlot/getEmptySeries'; diff --git a/x-pack/legacy/plugins/apm/public/services/rest/createCallApmApi.ts b/x-pack/legacy/plugins/apm/public/services/rest/createCallApmApi.ts index b4d060adec5a1..220320216788a 100644 --- a/x-pack/legacy/plugins/apm/public/services/rest/createCallApmApi.ts +++ b/x-pack/legacy/plugins/apm/public/services/rest/createCallApmApi.ts @@ -5,8 +5,10 @@ */ import { HttpSetup } from 'kibana/public'; import { callApi, FetchOptions } from './callApi'; -import { APMAPI } from '../../../server/routes/create_apm_api'; -import { Client } from '../../../server/routes/typings'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { APMAPI } from '../../../../../../plugins/apm/server/routes/create_apm_api'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { Client } from '../../../../../../plugins/apm/server/routes/typings'; export type APMClient = Client; export type APMClientOptions = Omit & { diff --git a/x-pack/legacy/plugins/apm/public/services/rest/ml.ts b/x-pack/legacy/plugins/apm/public/services/rest/ml.ts index 187a051b1b044..5e64d7e1ce716 100644 --- a/x-pack/legacy/plugins/apm/public/services/rest/ml.ts +++ b/x-pack/legacy/plugins/apm/public/services/rest/ml.ts @@ -9,8 +9,11 @@ import { PROCESSOR_EVENT, SERVICE_NAME, TRANSACTION_TYPE -} from '../../../common/elasticsearch_fieldnames'; -import { getMlJobId, getMlPrefix } from '../../../common/ml_job_constants'; +} from '../../../../../../plugins/apm/common/elasticsearch_fieldnames'; +import { + getMlJobId, + getMlPrefix +} from '../../../../../../plugins/apm/common/ml_job_constants'; import { callApi } from './callApi'; import { ESFilter } from '../../../../../../plugins/apm/typings/elasticsearch'; import { createCallApmApi, APMClient } from './createCallApmApi'; diff --git a/x-pack/legacy/plugins/apm/public/utils/flattenObject.ts b/x-pack/legacy/plugins/apm/public/utils/flattenObject.ts index 295ea1f9f900f..020bfec2cbd6a 100644 --- a/x-pack/legacy/plugins/apm/public/utils/flattenObject.ts +++ b/x-pack/legacy/plugins/apm/public/utils/flattenObject.ts @@ -5,7 +5,7 @@ */ import { compact, isObject } from 'lodash'; -import { Maybe } from '../../typings/common'; +import { Maybe } from '../../../../../plugins/apm/typings/common'; export interface KeyValuePair { key: string; diff --git a/x-pack/legacy/plugins/apm/public/utils/formatters/duration.ts b/x-pack/legacy/plugins/apm/public/utils/formatters/duration.ts index 39341e1ff4443..681d876ca3beb 100644 --- a/x-pack/legacy/plugins/apm/public/utils/formatters/duration.ts +++ b/x-pack/legacy/plugins/apm/public/utils/formatters/duration.ts @@ -7,10 +7,10 @@ import { i18n } from '@kbn/i18n'; import moment from 'moment'; import { memoize } from 'lodash'; -import { NOT_AVAILABLE_LABEL } from '../../../common/i18n'; +import { NOT_AVAILABLE_LABEL } from '../../../../../../plugins/apm/common/i18n'; import { asDecimal, asInteger } from './formatters'; import { TimeUnit } from './datetime'; -import { Maybe } from '../../../typings/common'; +import { Maybe } from '../../../../../../plugins/apm/typings/common'; interface FormatterOptions { defaultValue?: string; diff --git a/x-pack/legacy/plugins/apm/public/utils/formatters/size.ts b/x-pack/legacy/plugins/apm/public/utils/formatters/size.ts index 2cdf8af1d46de..8fe6ebf3e573d 100644 --- a/x-pack/legacy/plugins/apm/public/utils/formatters/size.ts +++ b/x-pack/legacy/plugins/apm/public/utils/formatters/size.ts @@ -5,7 +5,7 @@ */ import { memoize } from 'lodash'; import { asDecimal } from './formatters'; -import { Maybe } from '../../../typings/common'; +import { Maybe } from '../../../../../../plugins/apm/typings/common'; function asKilobytes(value: number) { return `${asDecimal(value / 1000)} KB`; diff --git a/x-pack/legacy/plugins/apm/public/utils/getRangeFromTimeSeries.ts b/x-pack/legacy/plugins/apm/public/utils/getRangeFromTimeSeries.ts index 1865d5ae574a7..4301ead2fc79f 100644 --- a/x-pack/legacy/plugins/apm/public/utils/getRangeFromTimeSeries.ts +++ b/x-pack/legacy/plugins/apm/public/utils/getRangeFromTimeSeries.ts @@ -5,7 +5,7 @@ */ import { flatten } from 'lodash'; -import { TimeSeries } from '../../typings/timeseries'; +import { TimeSeries } from '../../../../../plugins/apm/typings/timeseries'; export const getRangeFromTimeSeries = (timeseries: TimeSeries[]) => { const dataPoints = flatten(timeseries.map(series => series.data)); diff --git a/x-pack/legacy/plugins/apm/public/utils/isValidCoordinateValue.ts b/x-pack/legacy/plugins/apm/public/utils/isValidCoordinateValue.ts index c36efc232b782..f7c13603c3535 100644 --- a/x-pack/legacy/plugins/apm/public/utils/isValidCoordinateValue.ts +++ b/x-pack/legacy/plugins/apm/public/utils/isValidCoordinateValue.ts @@ -3,7 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { Maybe } from '../../typings/common'; +import { Maybe } from '../../../../../plugins/apm/typings/common'; export const isValidCoordinateValue = (value: Maybe): value is number => value !== null && value !== undefined; diff --git a/x-pack/legacy/plugins/apm/public/utils/testHelpers.tsx b/x-pack/legacy/plugins/apm/public/utils/testHelpers.tsx index bcdeaa6d5ac23..dec2257746e50 100644 --- a/x-pack/legacy/plugins/apm/public/utils/testHelpers.tsx +++ b/x-pack/legacy/plugins/apm/public/utils/testHelpers.tsx @@ -18,7 +18,7 @@ import { MemoryRouter } from 'react-router-dom'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { APMConfig } from '../../../../../plugins/apm/server'; import { LocationProvider } from '../context/LocationContext'; -import { PromiseReturnType } from '../../typings/common'; +import { PromiseReturnType } from '../../../../../plugins/apm/typings/common'; import { ESFilter, ESSearchResponse, diff --git a/x-pack/legacy/plugins/apm/server/lib/helpers/saved_objects_client.test.ts b/x-pack/legacy/plugins/apm/server/lib/helpers/saved_objects_client.test.ts deleted file mode 100644 index c685ffdd801dc..0000000000000 --- a/x-pack/legacy/plugins/apm/server/lib/helpers/saved_objects_client.test.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { getInternalSavedObjectsClient } from './saved_objects_client'; - -describe('saved_objects/client', () => { - describe('getSavedObjectsClient', () => { - let server: any; - let savedObjectsClientInstance: any; - let callWithInternalUser: any; - let internalRepository: any; - - beforeEach(() => { - savedObjectsClientInstance = { create: jest.fn() }; - callWithInternalUser = jest.fn(); - internalRepository = jest.fn(); - server = { - savedObjects: { - SavedObjectsClient: jest.fn(() => savedObjectsClientInstance), - getSavedObjectsRepository: jest.fn(() => internalRepository) - }, - plugins: { - elasticsearch: { - getCluster: jest.fn(() => ({ callWithInternalUser })) - } - } - }; - }); - - it('should use internal user "admin"', () => { - getInternalSavedObjectsClient(server); - - expect(server.plugins.elasticsearch.getCluster).toHaveBeenCalledWith( - 'admin' - ); - }); - - it('should call getSavedObjectsRepository with a cluster using the internal user context', () => { - getInternalSavedObjectsClient(server); - - expect( - server.savedObjects.getSavedObjectsRepository - ).toHaveBeenCalledWith(callWithInternalUser); - }); - - it('should return a SavedObjectsClient initialized with the saved objects internal repository', () => { - const internalSavedObjectsClient = getInternalSavedObjectsClient(server); - - expect(internalSavedObjectsClient).toBe(savedObjectsClientInstance); - expect(server.savedObjects.SavedObjectsClient).toHaveBeenCalledWith( - internalRepository - ); - }); - }); -}); diff --git a/x-pack/legacy/plugins/apm/server/lib/helpers/saved_objects_client.ts b/x-pack/legacy/plugins/apm/server/lib/helpers/saved_objects_client.ts deleted file mode 100644 index ced6f77944b6c..0000000000000 --- a/x-pack/legacy/plugins/apm/server/lib/helpers/saved_objects_client.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { APMLegacyServer } from '../../routes/typings'; - -export function getInternalSavedObjectsClient(server: APMLegacyServer) { - const { SavedObjectsClient, getSavedObjectsRepository } = server.savedObjects; - const { callWithInternalUser } = server.plugins.elasticsearch.getCluster( - 'admin' - ); - const internalRepository = getSavedObjectsRepository(callWithInternalUser); - return new SavedObjectsClient(internalRepository); -} diff --git a/x-pack/plugins/apm/.prettierrc b/x-pack/plugins/apm/.prettierrc new file mode 100644 index 0000000000000..650cb880f6f5a --- /dev/null +++ b/x-pack/plugins/apm/.prettierrc @@ -0,0 +1,4 @@ +{ + "singleQuote": true, + "semi": true +} diff --git a/x-pack/legacy/plugins/apm/common/__snapshots__/elasticsearch_fieldnames.test.ts.snap b/x-pack/plugins/apm/common/__snapshots__/elasticsearch_fieldnames.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/common/__snapshots__/elasticsearch_fieldnames.test.ts.snap rename to x-pack/plugins/apm/common/__snapshots__/elasticsearch_fieldnames.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/common/agent_configuration_constants.ts b/x-pack/plugins/apm/common/agent_configuration_constants.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/agent_configuration_constants.ts rename to x-pack/plugins/apm/common/agent_configuration_constants.ts diff --git a/x-pack/legacy/plugins/apm/common/agent_name.ts b/x-pack/plugins/apm/common/agent_name.ts similarity index 94% rename from x-pack/legacy/plugins/apm/common/agent_name.ts rename to x-pack/plugins/apm/common/agent_name.ts index daaeb14dc9eaa..bb68eb88b8e18 100644 --- a/x-pack/legacy/plugins/apm/common/agent_name.ts +++ b/x-pack/plugins/apm/common/agent_name.ts @@ -11,7 +11,7 @@ * definitions in mappings.json (for telemetry), the AgentName type, and the * agentNames object. */ -import { AgentName } from '../typings/es_schemas/ui/fields/Agent'; +import { AgentName } from '../typings/es_schemas/ui/fields/agent'; const agentNames: { [agentName in AgentName]: agentName } = { python: 'python', diff --git a/x-pack/legacy/plugins/apm/common/annotations.ts b/x-pack/plugins/apm/common/annotations.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/annotations.ts rename to x-pack/plugins/apm/common/annotations.ts diff --git a/x-pack/legacy/plugins/apm/common/apm_saved_object_constants.ts b/x-pack/plugins/apm/common/apm_saved_object_constants.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/apm_saved_object_constants.ts rename to x-pack/plugins/apm/common/apm_saved_object_constants.ts diff --git a/x-pack/legacy/plugins/apm/common/elasticsearch_fieldnames.test.ts b/x-pack/plugins/apm/common/elasticsearch_fieldnames.test.ts similarity index 95% rename from x-pack/legacy/plugins/apm/common/elasticsearch_fieldnames.test.ts rename to x-pack/plugins/apm/common/elasticsearch_fieldnames.test.ts index 82a679ccdd32e..1add2427d16a0 100644 --- a/x-pack/legacy/plugins/apm/common/elasticsearch_fieldnames.test.ts +++ b/x-pack/plugins/apm/common/elasticsearch_fieldnames.test.ts @@ -6,9 +6,9 @@ import { get } from 'lodash'; import { AllowUnknownProperties } from '../typings/common'; -import { APMError } from '../typings/es_schemas/ui/APMError'; -import { Span } from '../typings/es_schemas/ui/Span'; -import { Transaction } from '../typings/es_schemas/ui/Transaction'; +import { APMError } from '../typings/es_schemas/ui/apm_error'; +import { Span } from '../typings/es_schemas/ui/span'; +import { Transaction } from '../typings/es_schemas/ui/transaction'; import * as fieldnames from './elasticsearch_fieldnames'; describe('Transaction', () => { diff --git a/x-pack/legacy/plugins/apm/common/elasticsearch_fieldnames.ts b/x-pack/plugins/apm/common/elasticsearch_fieldnames.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/elasticsearch_fieldnames.ts rename to x-pack/plugins/apm/common/elasticsearch_fieldnames.ts diff --git a/x-pack/legacy/plugins/apm/common/environment_filter_values.ts b/x-pack/plugins/apm/common/environment_filter_values.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/environment_filter_values.ts rename to x-pack/plugins/apm/common/environment_filter_values.ts diff --git a/x-pack/legacy/plugins/apm/common/i18n.ts b/x-pack/plugins/apm/common/i18n.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/i18n.ts rename to x-pack/plugins/apm/common/i18n.ts diff --git a/x-pack/legacy/plugins/apm/common/index_pattern_constants.ts b/x-pack/plugins/apm/common/index_pattern_constants.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/index_pattern_constants.ts rename to x-pack/plugins/apm/common/index_pattern_constants.ts diff --git a/x-pack/legacy/plugins/apm/common/ml_job_constants.test.ts b/x-pack/plugins/apm/common/ml_job_constants.test.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/ml_job_constants.test.ts rename to x-pack/plugins/apm/common/ml_job_constants.test.ts diff --git a/x-pack/legacy/plugins/apm/common/ml_job_constants.ts b/x-pack/plugins/apm/common/ml_job_constants.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/ml_job_constants.ts rename to x-pack/plugins/apm/common/ml_job_constants.ts diff --git a/x-pack/legacy/plugins/apm/common/processor_event.ts b/x-pack/plugins/apm/common/processor_event.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/processor_event.ts rename to x-pack/plugins/apm/common/processor_event.ts diff --git a/x-pack/legacy/plugins/apm/common/projections/errors.ts b/x-pack/plugins/apm/common/projections/errors.ts similarity index 90% rename from x-pack/legacy/plugins/apm/common/projections/errors.ts rename to x-pack/plugins/apm/common/projections/errors.ts index 27e1de43a1a94..b8de049f3bce9 100644 --- a/x-pack/legacy/plugins/apm/common/projections/errors.ts +++ b/x-pack/plugins/apm/common/projections/errors.ts @@ -8,12 +8,14 @@ import { Setup, SetupTimeRange, SetupUIFilters + // eslint-disable-next-line @kbn/eslint/no-restricted-paths } from '../../server/lib/helpers/setup_request'; import { PROCESSOR_EVENT, SERVICE_NAME, ERROR_GROUP_ID } from '../elasticsearch_fieldnames'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { rangeFilter } from '../../server/lib/helpers/range_filter'; export function getErrorGroupsProjection({ diff --git a/x-pack/legacy/plugins/apm/common/projections/metrics.ts b/x-pack/plugins/apm/common/projections/metrics.ts similarity index 92% rename from x-pack/legacy/plugins/apm/common/projections/metrics.ts rename to x-pack/plugins/apm/common/projections/metrics.ts index 066f5789752a7..799c84ae3c1c9 100644 --- a/x-pack/legacy/plugins/apm/common/projections/metrics.ts +++ b/x-pack/plugins/apm/common/projections/metrics.ts @@ -8,12 +8,14 @@ import { Setup, SetupTimeRange, SetupUIFilters + // eslint-disable-next-line @kbn/eslint/no-restricted-paths } from '../../server/lib/helpers/setup_request'; import { SERVICE_NAME, PROCESSOR_EVENT, SERVICE_NODE_NAME } from '../elasticsearch_fieldnames'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { rangeFilter } from '../../server/lib/helpers/range_filter'; import { SERVICE_NODE_NAME_MISSING } from '../service_nodes'; diff --git a/x-pack/legacy/plugins/apm/common/projections/service_nodes.ts b/x-pack/plugins/apm/common/projections/service_nodes.ts similarity index 94% rename from x-pack/legacy/plugins/apm/common/projections/service_nodes.ts rename to x-pack/plugins/apm/common/projections/service_nodes.ts index 42fcdd38cc9fd..c65d29e8ea00d 100644 --- a/x-pack/legacy/plugins/apm/common/projections/service_nodes.ts +++ b/x-pack/plugins/apm/common/projections/service_nodes.ts @@ -8,6 +8,7 @@ import { Setup, SetupTimeRange, SetupUIFilters + // eslint-disable-next-line @kbn/eslint/no-restricted-paths } from '../../server/lib/helpers/setup_request'; import { SERVICE_NODE_NAME } from '../elasticsearch_fieldnames'; import { mergeProjection } from './util/merge_projection'; diff --git a/x-pack/legacy/plugins/apm/common/projections/services.ts b/x-pack/plugins/apm/common/projections/services.ts similarity index 90% rename from x-pack/legacy/plugins/apm/common/projections/services.ts rename to x-pack/plugins/apm/common/projections/services.ts index 3531607d59fc4..bdb0c4ef97895 100644 --- a/x-pack/legacy/plugins/apm/common/projections/services.ts +++ b/x-pack/plugins/apm/common/projections/services.ts @@ -8,8 +8,10 @@ import { Setup, SetupUIFilters, SetupTimeRange + // eslint-disable-next-line @kbn/eslint/no-restricted-paths } from '../../server/lib/helpers/setup_request'; import { SERVICE_NAME, PROCESSOR_EVENT } from '../elasticsearch_fieldnames'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { rangeFilter } from '../../server/lib/helpers/range_filter'; export function getServicesProjection({ diff --git a/x-pack/legacy/plugins/apm/common/projections/transaction_groups.ts b/x-pack/plugins/apm/common/projections/transaction_groups.ts similarity index 91% rename from x-pack/legacy/plugins/apm/common/projections/transaction_groups.ts rename to x-pack/plugins/apm/common/projections/transaction_groups.ts index abda606f69384..c19a5d002c015 100644 --- a/x-pack/legacy/plugins/apm/common/projections/transaction_groups.ts +++ b/x-pack/plugins/apm/common/projections/transaction_groups.ts @@ -8,8 +8,10 @@ import { Setup, SetupTimeRange, SetupUIFilters + // eslint-disable-next-line @kbn/eslint/no-restricted-paths } from '../../server/lib/helpers/setup_request'; import { TRANSACTION_NAME, PARENT_ID } from '../elasticsearch_fieldnames'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { Options } from '../../server/lib/transaction_groups/fetcher'; import { getTransactionsProjection } from './transactions'; import { mergeProjection } from './util/merge_projection'; diff --git a/x-pack/legacy/plugins/apm/common/projections/transactions.ts b/x-pack/plugins/apm/common/projections/transactions.ts similarity index 92% rename from x-pack/legacy/plugins/apm/common/projections/transactions.ts rename to x-pack/plugins/apm/common/projections/transactions.ts index ecbd0c8bf1a31..34de5e8d2833a 100644 --- a/x-pack/legacy/plugins/apm/common/projections/transactions.ts +++ b/x-pack/plugins/apm/common/projections/transactions.ts @@ -8,6 +8,7 @@ import { Setup, SetupTimeRange, SetupUIFilters + // eslint-disable-next-line @kbn/eslint/no-restricted-paths } from '../../server/lib/helpers/setup_request'; import { SERVICE_NAME, @@ -15,6 +16,7 @@ import { PROCESSOR_EVENT, TRANSACTION_NAME } from '../elasticsearch_fieldnames'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { rangeFilter } from '../../server/lib/helpers/range_filter'; export function getTransactionsProjection({ diff --git a/x-pack/legacy/plugins/apm/common/projections/typings.ts b/x-pack/plugins/apm/common/projections/typings.ts similarity index 81% rename from x-pack/legacy/plugins/apm/common/projections/typings.ts rename to x-pack/plugins/apm/common/projections/typings.ts index 08a7bee5412a5..2b55395b70c6b 100644 --- a/x-pack/legacy/plugins/apm/common/projections/typings.ts +++ b/x-pack/plugins/apm/common/projections/typings.ts @@ -4,14 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ -import { - ESSearchRequest, - ESSearchBody -} from '../../../../../plugins/apm/typings/elasticsearch'; +import { ESSearchRequest, ESSearchBody } from '../../typings/elasticsearch'; import { AggregationOptionsByType, AggregationInputMap -} from '../../../../../plugins/apm/typings/elasticsearch/aggregations'; +} from '../../typings/elasticsearch/aggregations'; export type Projection = Omit & { body: Omit & { diff --git a/x-pack/legacy/plugins/apm/common/projections/util/merge_projection/index.test.ts b/x-pack/plugins/apm/common/projections/util/merge_projection/index.test.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/projections/util/merge_projection/index.test.ts rename to x-pack/plugins/apm/common/projections/util/merge_projection/index.test.ts diff --git a/x-pack/legacy/plugins/apm/common/projections/util/merge_projection/index.ts b/x-pack/plugins/apm/common/projections/util/merge_projection/index.ts similarity index 87% rename from x-pack/legacy/plugins/apm/common/projections/util/merge_projection/index.ts rename to x-pack/plugins/apm/common/projections/util/merge_projection/index.ts index ef6089872b786..6a5089733bb33 100644 --- a/x-pack/legacy/plugins/apm/common/projections/util/merge_projection/index.ts +++ b/x-pack/plugins/apm/common/projections/util/merge_projection/index.ts @@ -5,11 +5,11 @@ */ import { merge, isPlainObject, cloneDeep } from 'lodash'; import { DeepPartial } from 'utility-types'; -import { AggregationInputMap } from '../../../../../../../plugins/apm/typings/elasticsearch/aggregations'; +import { AggregationInputMap } from '../../../../typings/elasticsearch/aggregations'; import { ESSearchRequest, ESSearchBody -} from '../../../../../../../plugins/apm/typings/elasticsearch'; +} from '../../../../typings/elasticsearch'; import { Projection } from '../../typings'; type PlainObject = Record; diff --git a/x-pack/legacy/plugins/apm/common/runtime_types/date_as_string_rt/index.test.ts b/x-pack/plugins/apm/common/runtime_types/date_as_string_rt/index.test.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/runtime_types/date_as_string_rt/index.test.ts rename to x-pack/plugins/apm/common/runtime_types/date_as_string_rt/index.test.ts diff --git a/x-pack/legacy/plugins/apm/common/runtime_types/date_as_string_rt/index.ts b/x-pack/plugins/apm/common/runtime_types/date_as_string_rt/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/runtime_types/date_as_string_rt/index.ts rename to x-pack/plugins/apm/common/runtime_types/date_as_string_rt/index.ts diff --git a/x-pack/legacy/plugins/apm/common/runtime_types/json_rt/index.test.ts b/x-pack/plugins/apm/common/runtime_types/json_rt/index.test.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/runtime_types/json_rt/index.test.ts rename to x-pack/plugins/apm/common/runtime_types/json_rt/index.test.ts diff --git a/x-pack/legacy/plugins/apm/common/runtime_types/json_rt/index.ts b/x-pack/plugins/apm/common/runtime_types/json_rt/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/runtime_types/json_rt/index.ts rename to x-pack/plugins/apm/common/runtime_types/json_rt/index.ts diff --git a/x-pack/legacy/plugins/apm/common/runtime_types/transaction_max_spans_rt/index.test.ts b/x-pack/plugins/apm/common/runtime_types/transaction_max_spans_rt/index.test.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/runtime_types/transaction_max_spans_rt/index.test.ts rename to x-pack/plugins/apm/common/runtime_types/transaction_max_spans_rt/index.test.ts diff --git a/x-pack/legacy/plugins/apm/common/runtime_types/transaction_max_spans_rt/index.ts b/x-pack/plugins/apm/common/runtime_types/transaction_max_spans_rt/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/runtime_types/transaction_max_spans_rt/index.ts rename to x-pack/plugins/apm/common/runtime_types/transaction_max_spans_rt/index.ts diff --git a/x-pack/legacy/plugins/apm/common/runtime_types/transaction_sample_rate_rt/index.test.ts b/x-pack/plugins/apm/common/runtime_types/transaction_sample_rate_rt/index.test.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/runtime_types/transaction_sample_rate_rt/index.test.ts rename to x-pack/plugins/apm/common/runtime_types/transaction_sample_rate_rt/index.test.ts diff --git a/x-pack/legacy/plugins/apm/common/runtime_types/transaction_sample_rate_rt/index.ts b/x-pack/plugins/apm/common/runtime_types/transaction_sample_rate_rt/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/runtime_types/transaction_sample_rate_rt/index.ts rename to x-pack/plugins/apm/common/runtime_types/transaction_sample_rate_rt/index.ts diff --git a/x-pack/legacy/plugins/apm/common/service_map.ts b/x-pack/plugins/apm/common/service_map.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/service_map.ts rename to x-pack/plugins/apm/common/service_map.ts diff --git a/x-pack/legacy/plugins/apm/common/service_nodes.ts b/x-pack/plugins/apm/common/service_nodes.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/service_nodes.ts rename to x-pack/plugins/apm/common/service_nodes.ts diff --git a/x-pack/legacy/plugins/apm/common/transaction_types.ts b/x-pack/plugins/apm/common/transaction_types.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/transaction_types.ts rename to x-pack/plugins/apm/common/transaction_types.ts diff --git a/x-pack/legacy/plugins/apm/common/viz_colors.ts b/x-pack/plugins/apm/common/viz_colors.ts similarity index 100% rename from x-pack/legacy/plugins/apm/common/viz_colors.ts rename to x-pack/plugins/apm/common/viz_colors.ts diff --git a/x-pack/plugins/apm/kibana.json b/x-pack/plugins/apm/kibana.json index d60846131da74..42232a8b89605 100644 --- a/x-pack/plugins/apm/kibana.json +++ b/x-pack/plugins/apm/kibana.json @@ -6,5 +6,5 @@ "configPath": ["xpack", "apm"], "ui": false, "requiredPlugins": ["apm_oss", "data", "home"], - "optionalPlugins": ["cloud"] + "optionalPlugins": ["cloud", "usageCollection"] } diff --git a/x-pack/plugins/apm/server/index.ts b/x-pack/plugins/apm/server/index.ts index d936e2a467f52..ebd954015c910 100644 --- a/x-pack/plugins/apm/server/index.ts +++ b/x-pack/plugins/apm/server/index.ts @@ -12,7 +12,7 @@ import { APMPlugin } from './plugin'; export const config = { exposeToBrowser: { serviceMapEnabled: true, - ui: true, + ui: true }, schema: schema.object({ enabled: schema.boolean({ defaultValue: true }), @@ -21,14 +21,17 @@ export const config = { ui: schema.object({ enabled: schema.boolean({ defaultValue: true }), transactionGroupBucketSize: schema.number({ defaultValue: 100 }), - maxTraceItems: schema.number({ defaultValue: 1000 }), - }), - }), + maxTraceItems: schema.number({ defaultValue: 1000 }) + }) + }) }; export type APMXPackConfig = TypeOf; -export function mergeConfigs(apmOssConfig: APMOSSConfig, apmConfig: APMXPackConfig) { +export function mergeConfigs( + apmOssConfig: APMOSSConfig, + apmConfig: APMXPackConfig +) { return { 'apm_oss.transactionIndices': apmOssConfig.transactionIndices, 'apm_oss.spanIndices': apmOssConfig.spanIndices, @@ -40,13 +43,15 @@ export function mergeConfigs(apmOssConfig: APMOSSConfig, apmConfig: APMXPackConf 'xpack.apm.serviceMapEnabled': apmConfig.serviceMapEnabled, 'xpack.apm.ui.enabled': apmConfig.ui.enabled, 'xpack.apm.ui.maxTraceItems': apmConfig.ui.maxTraceItems, - 'xpack.apm.ui.transactionGroupBucketSize': apmConfig.ui.transactionGroupBucketSize, - 'xpack.apm.autocreateApmIndexPattern': apmConfig.autocreateApmIndexPattern, + 'xpack.apm.ui.transactionGroupBucketSize': + apmConfig.ui.transactionGroupBucketSize, + 'xpack.apm.autocreateApmIndexPattern': apmConfig.autocreateApmIndexPattern }; } export type APMConfig = ReturnType; -export const plugin = (initContext: PluginInitializerContext) => new APMPlugin(initContext); +export const plugin = (initContext: PluginInitializerContext) => + new APMPlugin(initContext); export { APMPlugin, APMPluginContract } from './plugin'; diff --git a/x-pack/legacy/plugins/apm/server/lib/apm_telemetry/__test__/index.test.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/__test__/index.test.ts similarity index 65% rename from x-pack/legacy/plugins/apm/server/lib/apm_telemetry/__test__/index.test.ts rename to x-pack/plugins/apm/server/lib/apm_telemetry/__test__/index.test.ts index 26cae303542a4..c45c74a791aee 100644 --- a/x-pack/legacy/plugins/apm/server/lib/apm_telemetry/__test__/index.test.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/__test__/index.test.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { SavedObjectAttributes } from 'src/core/server'; +import { SavedObjectAttributes } from '../../../../../../../src/core/server'; import { createApmTelementry, storeApmServicesTelemetry } from '../index'; import { APM_SERVICES_TELEMETRY_SAVED_OBJECT_TYPE, @@ -45,25 +45,10 @@ describe('apm_telemetry', () => { }); describe('storeApmServicesTelemetry', () => { - let server: any; let apmTelemetry: SavedObjectAttributes; - let savedObjectsClientInstance: any; + let savedObjectsClient: any; beforeEach(() => { - savedObjectsClientInstance = { create: jest.fn() }; - const callWithInternalUser = jest.fn(); - const internalRepository = jest.fn(); - server = { - savedObjects: { - SavedObjectsClient: jest.fn(() => savedObjectsClientInstance), - getSavedObjectsRepository: jest.fn(() => internalRepository) - }, - plugins: { - elasticsearch: { - getCluster: jest.fn(() => ({ callWithInternalUser })) - } - } - }; apmTelemetry = { has_any_services: true, services_per_agent: { @@ -72,30 +57,27 @@ describe('apm_telemetry', () => { 'js-base': 1 } }; + savedObjectsClient = { create: jest.fn() }; }); it('should call savedObjectsClient create with the given ApmTelemetry object', () => { - storeApmServicesTelemetry(server, apmTelemetry); - expect(savedObjectsClientInstance.create.mock.calls[0][1]).toBe( - apmTelemetry - ); + storeApmServicesTelemetry(savedObjectsClient, apmTelemetry); + expect(savedObjectsClient.create.mock.calls[0][1]).toBe(apmTelemetry); }); it('should call savedObjectsClient create with the apm-telemetry document type and ID', () => { - storeApmServicesTelemetry(server, apmTelemetry); - expect(savedObjectsClientInstance.create.mock.calls[0][0]).toBe( + storeApmServicesTelemetry(savedObjectsClient, apmTelemetry); + expect(savedObjectsClient.create.mock.calls[0][0]).toBe( APM_SERVICES_TELEMETRY_SAVED_OBJECT_TYPE ); - expect(savedObjectsClientInstance.create.mock.calls[0][2].id).toBe( + expect(savedObjectsClient.create.mock.calls[0][2].id).toBe( APM_SERVICES_TELEMETRY_SAVED_OBJECT_ID ); }); it('should call savedObjectsClient create with overwrite: true', () => { - storeApmServicesTelemetry(server, apmTelemetry); - expect(savedObjectsClientInstance.create.mock.calls[0][2].overwrite).toBe( - true - ); + storeApmServicesTelemetry(savedObjectsClient, apmTelemetry); + expect(savedObjectsClient.create.mock.calls[0][2].overwrite).toBe(true); }); }); }); diff --git a/x-pack/legacy/plugins/apm/server/lib/apm_telemetry/index.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/index.ts similarity index 60% rename from x-pack/legacy/plugins/apm/server/lib/apm_telemetry/index.ts rename to x-pack/plugins/apm/server/lib/apm_telemetry/index.ts index ddfb4144d9636..a2b0494730826 100644 --- a/x-pack/legacy/plugins/apm/server/lib/apm_telemetry/index.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/index.ts @@ -5,15 +5,14 @@ */ import { countBy } from 'lodash'; -import { SavedObjectAttributes } from 'src/core/server'; +import { SavedObjectAttributes } from '../../../../../../src/core/server'; import { isAgentName } from '../../../common/agent_name'; -import { getInternalSavedObjectsClient } from '../helpers/saved_objects_client'; import { APM_SERVICES_TELEMETRY_SAVED_OBJECT_TYPE, APM_SERVICES_TELEMETRY_SAVED_OBJECT_ID } from '../../../common/apm_saved_object_constants'; -import { APMLegacyServer } from '../../routes/typings'; -import { UsageCollectionSetup } from '../../../../../../../src/plugins/usage_collection/server'; +import { UsageCollectionSetup } from '../../../../../../src/plugins/usage_collection/server'; +import { InternalSavedObjectsClient } from '../helpers/get_internal_saved_objects_client'; export function createApmTelementry( agentNames: string[] = [] @@ -26,34 +25,28 @@ export function createApmTelementry( } export async function storeApmServicesTelemetry( - server: APMLegacyServer, + savedObjectsClient: InternalSavedObjectsClient, apmTelemetry: SavedObjectAttributes ) { - try { - const savedObjectsClient = getInternalSavedObjectsClient(server); - await savedObjectsClient.create( - APM_SERVICES_TELEMETRY_SAVED_OBJECT_TYPE, - apmTelemetry, - { - id: APM_SERVICES_TELEMETRY_SAVED_OBJECT_ID, - overwrite: true - } - ); - } catch (e) { - server.log(['error'], `Unable to save APM telemetry data: ${e.message}`); - } + return savedObjectsClient.create( + APM_SERVICES_TELEMETRY_SAVED_OBJECT_TYPE, + apmTelemetry, + { + id: APM_SERVICES_TELEMETRY_SAVED_OBJECT_ID, + overwrite: true + } + ); } export function makeApmUsageCollector( usageCollector: UsageCollectionSetup, - server: APMLegacyServer + savedObjectsRepository: InternalSavedObjectsClient ) { const apmUsageCollector = usageCollector.makeUsageCollector({ type: 'apm', fetch: async () => { - const internalSavedObjectsClient = getInternalSavedObjectsClient(server); try { - const apmTelemetrySavedObject = await internalSavedObjectsClient.get( + const apmTelemetrySavedObject = await savedObjectsRepository.get( APM_SERVICES_TELEMETRY_SAVED_OBJECT_TYPE, APM_SERVICES_TELEMETRY_SAVED_OBJECT_ID ); diff --git a/x-pack/legacy/plugins/apm/server/lib/errors/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/errors/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/errors/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/lib/errors/__snapshots__/queries.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/errors/distribution/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/errors/distribution/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/errors/distribution/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/lib/errors/distribution/__snapshots__/queries.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/errors/distribution/__tests__/__snapshots__/get_buckets.test.ts.snap b/x-pack/plugins/apm/server/lib/errors/distribution/__tests__/__snapshots__/get_buckets.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/errors/distribution/__tests__/__snapshots__/get_buckets.test.ts.snap rename to x-pack/plugins/apm/server/lib/errors/distribution/__tests__/__snapshots__/get_buckets.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/errors/distribution/__tests__/get_buckets.test.ts b/x-pack/plugins/apm/server/lib/errors/distribution/__tests__/get_buckets.test.ts similarity index 96% rename from x-pack/legacy/plugins/apm/server/lib/errors/distribution/__tests__/get_buckets.test.ts rename to x-pack/plugins/apm/server/lib/errors/distribution/__tests__/get_buckets.test.ts index cf8798d445f8a..3ac47004279b3 100644 --- a/x-pack/legacy/plugins/apm/server/lib/errors/distribution/__tests__/get_buckets.test.ts +++ b/x-pack/plugins/apm/server/lib/errors/distribution/__tests__/get_buckets.test.ts @@ -6,7 +6,7 @@ import { PROCESSOR_EVENT } from '../../../../../common/elasticsearch_fieldnames'; import { getBuckets } from '../get_buckets'; -import { APMConfig } from '../../../../../../../../plugins/apm/server'; +import { APMConfig } from '../../../..'; describe('timeseriesFetcher', () => { let clientSpy: jest.Mock; diff --git a/x-pack/legacy/plugins/apm/server/lib/errors/distribution/get_buckets.ts b/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.ts similarity index 95% rename from x-pack/legacy/plugins/apm/server/lib/errors/distribution/get_buckets.ts rename to x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.ts index 0f6ace39aeca3..9274f96d58d83 100644 --- a/x-pack/legacy/plugins/apm/server/lib/errors/distribution/get_buckets.ts +++ b/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ESFilter } from '../../../../../../../plugins/apm/typings/elasticsearch'; +import { ESFilter } from '../../../../typings/elasticsearch'; import { ERROR_GROUP_ID, PROCESSOR_EVENT, diff --git a/x-pack/legacy/plugins/apm/server/lib/errors/distribution/get_distribution.ts b/x-pack/plugins/apm/server/lib/errors/distribution/get_distribution.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/errors/distribution/get_distribution.ts rename to x-pack/plugins/apm/server/lib/errors/distribution/get_distribution.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/errors/distribution/queries.test.ts b/x-pack/plugins/apm/server/lib/errors/distribution/queries.test.ts similarity index 93% rename from x-pack/legacy/plugins/apm/server/lib/errors/distribution/queries.test.ts rename to x-pack/plugins/apm/server/lib/errors/distribution/queries.test.ts index fcc456c653303..0d539a09f091b 100644 --- a/x-pack/legacy/plugins/apm/server/lib/errors/distribution/queries.test.ts +++ b/x-pack/plugins/apm/server/lib/errors/distribution/queries.test.ts @@ -8,7 +8,7 @@ import { getErrorDistribution } from './get_distribution'; import { SearchParamsMock, inspectSearchParams -} from '../../../../public/utils/testHelpers'; +} from '../../../../../../legacy/plugins/apm/public/utils/testHelpers'; describe('error distribution queries', () => { let mock: SearchParamsMock; diff --git a/x-pack/legacy/plugins/apm/server/lib/errors/get_error_group.ts b/x-pack/plugins/apm/server/lib/errors/get_error_group.ts similarity index 96% rename from x-pack/legacy/plugins/apm/server/lib/errors/get_error_group.ts rename to x-pack/plugins/apm/server/lib/errors/get_error_group.ts index 5d45002b9f3ce..cc090a06c04dc 100644 --- a/x-pack/legacy/plugins/apm/server/lib/errors/get_error_group.ts +++ b/x-pack/plugins/apm/server/lib/errors/get_error_group.ts @@ -11,7 +11,7 @@ import { TRANSACTION_SAMPLED } from '../../../common/elasticsearch_fieldnames'; import { PromiseReturnType } from '../../../typings/common'; -import { APMError } from '../../../typings/es_schemas/ui/APMError'; +import { APMError } from '../../../typings/es_schemas/ui/apm_error'; import { rangeFilter } from '../helpers/range_filter'; import { Setup, diff --git a/x-pack/legacy/plugins/apm/server/lib/errors/get_error_groups.ts b/x-pack/plugins/apm/server/lib/errors/get_error_groups.ts similarity index 95% rename from x-pack/legacy/plugins/apm/server/lib/errors/get_error_groups.ts rename to x-pack/plugins/apm/server/lib/errors/get_error_groups.ts index 92ee6a0a71f00..8ea6df5a9898a 100644 --- a/x-pack/legacy/plugins/apm/server/lib/errors/get_error_groups.ts +++ b/x-pack/plugins/apm/server/lib/errors/get_error_groups.ts @@ -12,7 +12,7 @@ import { ERROR_LOG_MESSAGE } from '../../../common/elasticsearch_fieldnames'; import { PromiseReturnType } from '../../../typings/common'; -import { APMError } from '../../../typings/es_schemas/ui/APMError'; +import { APMError } from '../../../typings/es_schemas/ui/apm_error'; import { Setup, SetupTimeRange, @@ -20,7 +20,7 @@ import { } from '../helpers/setup_request'; import { getErrorGroupsProjection } from '../../../common/projections/errors'; import { mergeProjection } from '../../../common/projections/util/merge_projection'; -import { SortOptions } from '../../../../../../plugins/apm/typings/elasticsearch/aggregations'; +import { SortOptions } from '../../../typings/elasticsearch/aggregations'; export type ErrorGroupListAPIResponse = PromiseReturnType< typeof getErrorGroups diff --git a/x-pack/legacy/plugins/apm/server/lib/errors/queries.test.ts b/x-pack/plugins/apm/server/lib/errors/queries.test.ts similarity index 95% rename from x-pack/legacy/plugins/apm/server/lib/errors/queries.test.ts rename to x-pack/plugins/apm/server/lib/errors/queries.test.ts index f1e5d31efd4bd..5b063c2fb2b61 100644 --- a/x-pack/legacy/plugins/apm/server/lib/errors/queries.test.ts +++ b/x-pack/plugins/apm/server/lib/errors/queries.test.ts @@ -9,7 +9,7 @@ import { getErrorGroups } from './get_error_groups'; import { SearchParamsMock, inspectSearchParams -} from '../../../public/utils/testHelpers'; +} from '../../../../../legacy/plugins/apm/public/utils/testHelpers'; describe('error queries', () => { let mock: SearchParamsMock; diff --git a/x-pack/legacy/plugins/apm/server/lib/helpers/convert_ui_filters/__test__/get_environment_ui_filter_es.test.ts b/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/__test__/get_environment_ui_filter_es.test.ts similarity index 93% rename from x-pack/legacy/plugins/apm/server/lib/helpers/convert_ui_filters/__test__/get_environment_ui_filter_es.test.ts rename to x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/__test__/get_environment_ui_filter_es.test.ts index b5061e303a40d..0f0a11a868d6d 100644 --- a/x-pack/legacy/plugins/apm/server/lib/helpers/convert_ui_filters/__test__/get_environment_ui_filter_es.test.ts +++ b/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/__test__/get_environment_ui_filter_es.test.ts @@ -7,7 +7,7 @@ import { getEnvironmentUiFilterES } from '../get_environment_ui_filter_es'; import { ENVIRONMENT_NOT_DEFINED } from '../../../../../common/environment_filter_values'; import { SERVICE_ENVIRONMENT } from '../../../../../common/elasticsearch_fieldnames'; -import { ESFilter } from '../../../../../../../../plugins/apm/typings/elasticsearch'; +import { ESFilter } from '../../../../../typings/elasticsearch'; describe('getEnvironmentUiFilterES', () => { it('should return undefined, when environment is undefined', () => { diff --git a/x-pack/legacy/plugins/apm/server/lib/helpers/convert_ui_filters/get_environment_ui_filter_es.ts b/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_environment_ui_filter_es.ts similarity index 90% rename from x-pack/legacy/plugins/apm/server/lib/helpers/convert_ui_filters/get_environment_ui_filter_es.ts rename to x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_environment_ui_filter_es.ts index dcf2334ab4de2..57feaf6a6fd0e 100644 --- a/x-pack/legacy/plugins/apm/server/lib/helpers/convert_ui_filters/get_environment_ui_filter_es.ts +++ b/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_environment_ui_filter_es.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ESFilter } from '../../../../../../../plugins/apm/typings/elasticsearch'; +import { ESFilter } from '../../../../typings/elasticsearch'; import { ENVIRONMENT_NOT_DEFINED } from '../../../../common/environment_filter_values'; import { SERVICE_ENVIRONMENT } from '../../../../common/elasticsearch_fieldnames'; diff --git a/x-pack/legacy/plugins/apm/server/lib/helpers/convert_ui_filters/get_ui_filters_es.ts b/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_ui_filters_es.ts similarity index 88% rename from x-pack/legacy/plugins/apm/server/lib/helpers/convert_ui_filters/get_ui_filters_es.ts rename to x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_ui_filters_es.ts index 126ee49fd4218..020c8cd80afa8 100644 --- a/x-pack/legacy/plugins/apm/server/lib/helpers/convert_ui_filters/get_ui_filters_es.ts +++ b/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_ui_filters_es.ts @@ -4,8 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ESFilter } from '../../../../../../../plugins/apm/typings/elasticsearch'; -import { UIFilters } from '../../../../typings/ui-filters'; +import { ESFilter } from '../../../../typings/elasticsearch'; +import { UIFilters } from '../../../../typings/ui_filters'; import { getEnvironmentUiFilterES } from './get_environment_ui_filter_es'; import { localUIFilters, @@ -14,7 +14,7 @@ import { import { esKuery, IIndexPattern -} from '../../../../../../../../src/plugins/data/server'; +} from '../../../../../../../src/plugins/data/server'; export function getUiFiltersES( indexPattern: IIndexPattern | undefined, diff --git a/x-pack/legacy/plugins/apm/server/lib/helpers/es_client.test.ts b/x-pack/plugins/apm/server/lib/helpers/es_client.test.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/helpers/es_client.test.ts rename to x-pack/plugins/apm/server/lib/helpers/es_client.test.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/helpers/es_client.ts b/x-pack/plugins/apm/server/lib/helpers/es_client.ts similarity index 97% rename from x-pack/legacy/plugins/apm/server/lib/helpers/es_client.ts rename to x-pack/plugins/apm/server/lib/helpers/es_client.ts index 06cf0047b0286..8ada02d085631 100644 --- a/x-pack/legacy/plugins/apm/server/lib/helpers/es_client.ts +++ b/x-pack/plugins/apm/server/lib/helpers/es_client.ts @@ -16,9 +16,9 @@ import { KibanaRequest } from 'src/core/server'; import { ESSearchRequest, ESSearchResponse -} from '../../../../../../plugins/apm/typings/elasticsearch'; +} from '../../../typings/elasticsearch'; import { OBSERVER_VERSION_MAJOR } from '../../../common/elasticsearch_fieldnames'; -import { pickKeys } from '../../../public/utils/pickKeys'; +import { pickKeys } from '../../../../../legacy/plugins/apm/public/utils/pickKeys'; import { APMRequestHandlerContext } from '../../routes/typings'; import { getApmIndices } from '../settings/apm_indices/get_apm_indices'; diff --git a/x-pack/legacy/plugins/apm/server/lib/helpers/get_bucket_size/calculate_auto.js b/x-pack/plugins/apm/server/lib/helpers/get_bucket_size/calculate_auto.js similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/helpers/get_bucket_size/calculate_auto.js rename to x-pack/plugins/apm/server/lib/helpers/get_bucket_size/calculate_auto.js diff --git a/x-pack/legacy/plugins/apm/server/lib/helpers/get_bucket_size/index.ts b/x-pack/plugins/apm/server/lib/helpers/get_bucket_size/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/helpers/get_bucket_size/index.ts rename to x-pack/plugins/apm/server/lib/helpers/get_bucket_size/index.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/helpers/get_bucket_size/unit_to_seconds.js b/x-pack/plugins/apm/server/lib/helpers/get_bucket_size/unit_to_seconds.js similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/helpers/get_bucket_size/unit_to_seconds.js rename to x-pack/plugins/apm/server/lib/helpers/get_bucket_size/unit_to_seconds.js diff --git a/x-pack/plugins/apm/server/lib/helpers/get_internal_saved_objects_client.ts b/x-pack/plugins/apm/server/lib/helpers/get_internal_saved_objects_client.ts new file mode 100644 index 0000000000000..e0bb9ad354f58 --- /dev/null +++ b/x-pack/plugins/apm/server/lib/helpers/get_internal_saved_objects_client.ts @@ -0,0 +1,16 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import { CoreSetup } from 'src/core/server'; +import { PromiseReturnType } from '../../../typings/common'; + +export type InternalSavedObjectsClient = PromiseReturnType< + typeof getInternalSavedObjectsClient +>; +export async function getInternalSavedObjectsClient(core: CoreSetup) { + return core.getStartServices().then(async ([coreStart]) => { + return coreStart.savedObjects.createInternalRepository(); + }); +} diff --git a/x-pack/legacy/plugins/apm/server/lib/helpers/input_validation.ts b/x-pack/plugins/apm/server/lib/helpers/input_validation.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/helpers/input_validation.ts rename to x-pack/plugins/apm/server/lib/helpers/input_validation.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/helpers/metrics.ts b/x-pack/plugins/apm/server/lib/helpers/metrics.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/helpers/metrics.ts rename to x-pack/plugins/apm/server/lib/helpers/metrics.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/helpers/range_filter.ts b/x-pack/plugins/apm/server/lib/helpers/range_filter.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/helpers/range_filter.ts rename to x-pack/plugins/apm/server/lib/helpers/range_filter.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/helpers/round_to_nearest_five_or_ten.test.ts b/x-pack/plugins/apm/server/lib/helpers/round_to_nearest_five_or_ten.test.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/helpers/round_to_nearest_five_or_ten.test.ts rename to x-pack/plugins/apm/server/lib/helpers/round_to_nearest_five_or_ten.test.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/helpers/round_to_nearest_five_or_ten.ts b/x-pack/plugins/apm/server/lib/helpers/round_to_nearest_five_or_ten.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/helpers/round_to_nearest_five_or_ten.ts rename to x-pack/plugins/apm/server/lib/helpers/round_to_nearest_five_or_ten.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/helpers/setup_request.test.ts b/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts similarity index 98% rename from x-pack/legacy/plugins/apm/server/lib/helpers/setup_request.test.ts rename to x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts index 4272bdbddd26b..40a2a0e7216a0 100644 --- a/x-pack/legacy/plugins/apm/server/lib/helpers/setup_request.test.ts +++ b/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts @@ -4,9 +4,9 @@ * you may not use this file except in compliance with the Elastic License. */ import { setupRequest } from './setup_request'; -import { APMConfig } from '../../../../../../plugins/apm/server'; +import { APMConfig } from '../..'; import { APMRequestHandlerContext } from '../../routes/typings'; -import { KibanaRequest } from 'src/core/server'; +import { KibanaRequest } from '../../../../../../src/core/server'; jest.mock('../settings/apm_indices/get_apm_indices', () => ({ getApmIndices: async () => ({ diff --git a/x-pack/legacy/plugins/apm/server/lib/helpers/setup_request.ts b/x-pack/plugins/apm/server/lib/helpers/setup_request.ts similarity index 92% rename from x-pack/legacy/plugins/apm/server/lib/helpers/setup_request.ts rename to x-pack/plugins/apm/server/lib/helpers/setup_request.ts index f8946997e6e18..eeaaddafa8e04 100644 --- a/x-pack/legacy/plugins/apm/server/lib/helpers/setup_request.ts +++ b/x-pack/plugins/apm/server/lib/helpers/setup_request.ts @@ -5,14 +5,14 @@ */ import moment from 'moment'; -import { KibanaRequest } from 'src/core/server'; -import { IIndexPattern } from 'src/plugins/data/common'; -import { APMConfig } from '../../../../../../plugins/apm/server'; +import { KibanaRequest } from '../../../../../../src/core/server'; +import { IIndexPattern } from '../../../../../../src/plugins/data/common'; +import { APMConfig } from '../..'; import { getApmIndices, ApmIndicesConfig } from '../settings/apm_indices/get_apm_indices'; -import { ESFilter } from '../../../../../../plugins/apm/typings/elasticsearch'; +import { ESFilter } from '../../../typings/elasticsearch'; import { ESClient } from './es_client'; import { getUiFiltersES } from './convert_ui_filters/get_ui_filters_es'; import { APMRequestHandlerContext } from '../../routes/typings'; diff --git a/x-pack/legacy/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts b/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts similarity index 65% rename from x-pack/legacy/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts rename to x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts index 2a31563b53c2c..574712cbafd1e 100644 --- a/x-pack/legacy/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts +++ b/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts @@ -6,42 +6,37 @@ import { createStaticIndexPattern } from './create_static_index_pattern'; import { Setup } from '../helpers/setup_request'; -import * as savedObjectsClient from '../helpers/saved_objects_client'; import * as HistoricalAgentData from '../services/get_services/has_historical_agent_data'; import { APMRequestHandlerContext } from '../../routes/typings'; +import { InternalSavedObjectsClient } from '../helpers/get_internal_saved_objects_client'; function getMockContext(config: Record) { return ({ config, - __LEGACY: { - server: { - savedObjects: { - getSavedObjectsRepository: jest.fn() + core: { + savedObjects: { + client: { + create: jest.fn() } } } } as unknown) as APMRequestHandlerContext; } +function getMockSavedObjectsClient() { + return ({ + create: jest.fn() + } as unknown) as InternalSavedObjectsClient; +} describe('createStaticIndexPattern', () => { - let createSavedObject: jest.Mock; - beforeEach(() => { - createSavedObject = jest.fn(); - jest - .spyOn(savedObjectsClient, 'getInternalSavedObjectsClient') - .mockReturnValue({ - create: createSavedObject - } as any); - }); - it(`should not create index pattern if 'xpack.apm.autocreateApmIndexPattern=false'`, async () => { const setup = {} as Setup; const context = getMockContext({ 'xpack.apm.autocreateApmIndexPattern': false }); - await createStaticIndexPattern(setup, context); - - expect(createSavedObject).not.toHaveBeenCalled(); + const savedObjectsClient = getMockSavedObjectsClient(); + await createStaticIndexPattern(setup, context, savedObjectsClient); + expect(savedObjectsClient.create).not.toHaveBeenCalled(); }); it(`should not create index pattern if no APM data is found`, async () => { @@ -55,8 +50,10 @@ describe('createStaticIndexPattern', () => { .spyOn(HistoricalAgentData, 'hasHistoricalAgentData') .mockResolvedValue(false); - await createStaticIndexPattern(setup, context); - expect(createSavedObject).not.toHaveBeenCalled(); + const savedObjectsClient = getMockSavedObjectsClient(); + + await createStaticIndexPattern(setup, context, savedObjectsClient); + expect(savedObjectsClient.create).not.toHaveBeenCalled(); }); it(`should create index pattern`, async () => { @@ -69,8 +66,11 @@ describe('createStaticIndexPattern', () => { jest .spyOn(HistoricalAgentData, 'hasHistoricalAgentData') .mockResolvedValue(true); - await createStaticIndexPattern(setup, context); - expect(createSavedObject).toHaveBeenCalled(); + const savedObjectsClient = getMockSavedObjectsClient(); + + await createStaticIndexPattern(setup, context, savedObjectsClient); + + expect(savedObjectsClient.create).toHaveBeenCalled(); }); }); diff --git a/x-pack/legacy/plugins/apm/server/lib/index_pattern/create_static_index_pattern.ts b/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.ts similarity index 76% rename from x-pack/legacy/plugins/apm/server/lib/index_pattern/create_static_index_pattern.ts rename to x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.ts index fefaa30c8c36b..16546bc6070c2 100644 --- a/x-pack/legacy/plugins/apm/server/lib/index_pattern/create_static_index_pattern.ts +++ b/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.ts @@ -3,19 +3,19 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { getInternalSavedObjectsClient } from '../helpers/saved_objects_client'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import apmIndexPattern from '../../../../../../plugins/apm/server/tutorial/index_pattern.json'; +import apmIndexPattern from '../../tutorial/index_pattern.json'; import { APM_STATIC_INDEX_PATTERN_ID } from '../../../common/index_pattern_constants'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { SavedObjectsErrorHelpers } from '../../../../../../../src/core/server/saved_objects'; +import { SavedObjectsErrorHelpers } from '../../../../../../src/core/server/saved_objects'; import { hasHistoricalAgentData } from '../services/get_services/has_historical_agent_data'; import { Setup } from '../helpers/setup_request'; import { APMRequestHandlerContext } from '../../routes/typings'; +import { InternalSavedObjectsClient } from '../helpers/get_internal_saved_objects_client.js'; export async function createStaticIndexPattern( setup: Setup, - context: APMRequestHandlerContext + context: APMRequestHandlerContext, + savedObjectsClient: InternalSavedObjectsClient ): Promise { const { config } = context; @@ -33,10 +33,7 @@ export async function createStaticIndexPattern( try { const apmIndexPatternTitle = config['apm_oss.indexPattern']; - const internalSavedObjectsClient = getInternalSavedObjectsClient( - context.__LEGACY.server - ); - await internalSavedObjectsClient.create( + await savedObjectsClient.create( 'index-pattern', { ...apmIndexPattern.attributes, diff --git a/x-pack/legacy/plugins/apm/server/lib/index_pattern/get_dynamic_index_pattern.ts b/x-pack/plugins/apm/server/lib/index_pattern/get_dynamic_index_pattern.ts similarity index 96% rename from x-pack/legacy/plugins/apm/server/lib/index_pattern/get_dynamic_index_pattern.ts rename to x-pack/plugins/apm/server/lib/index_pattern/get_dynamic_index_pattern.ts index 9eb99b7c21e75..b1e4906317f81 100644 --- a/x-pack/legacy/plugins/apm/server/lib/index_pattern/get_dynamic_index_pattern.ts +++ b/x-pack/plugins/apm/server/lib/index_pattern/get_dynamic_index_pattern.ts @@ -4,12 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import { APICaller } from 'src/core/server'; import LRU from 'lru-cache'; +import { APICaller } from '../../../../../../src/core/server'; import { IndexPatternsFetcher, IIndexPattern -} from '../../../../../../../src/plugins/data/server'; +} from '../../../../../../src/plugins/data/server'; import { ApmIndicesConfig } from '../settings/apm_indices/get_apm_indices'; import { ProcessorEvent } from '../../../common/processor_event'; import { APMRequestHandlerContext } from '../../routes/typings'; diff --git a/x-pack/legacy/plugins/apm/server/lib/metrics/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/metrics/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/metrics/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/lib/metrics/__snapshots__/queries.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/default.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/default.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/default.ts rename to x-pack/plugins/apm/server/lib/metrics/by_agent/default.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/java/gc/fetchAndTransformGcMetrics.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/java/gc/fetchAndTransformGcMetrics.ts rename to x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/java/gc/getGcRateChart.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_rate_chart.ts similarity index 94% rename from x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/java/gc/getGcRateChart.ts rename to x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_rate_chart.ts index 21417891fa15f..fae15bcade7bc 100644 --- a/x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/java/gc/getGcRateChart.ts +++ b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_rate_chart.ts @@ -12,7 +12,7 @@ import { SetupTimeRange, SetupUIFilters } from '../../../../helpers/setup_request'; -import { fetchAndTransformGcMetrics } from './fetchAndTransformGcMetrics'; +import { fetchAndTransformGcMetrics } from './fetch_and_transform_gc_metrics'; import { ChartBase } from '../../../types'; const series = { diff --git a/x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/java/gc/getGcTimeChart.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_time_chart.ts similarity index 94% rename from x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/java/gc/getGcTimeChart.ts rename to x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_time_chart.ts index ea7557fabacd0..422ce60ca59bc 100644 --- a/x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/java/gc/getGcTimeChart.ts +++ b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_time_chart.ts @@ -12,7 +12,7 @@ import { SetupTimeRange, SetupUIFilters } from '../../../../helpers/setup_request'; -import { fetchAndTransformGcMetrics } from './fetchAndTransformGcMetrics'; +import { fetchAndTransformGcMetrics } from './fetch_and_transform_gc_metrics'; import { ChartBase } from '../../../types'; const series = { diff --git a/x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/java/heap_memory/index.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/heap_memory/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/java/heap_memory/index.ts rename to x-pack/plugins/apm/server/lib/metrics/by_agent/java/heap_memory/index.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/java/index.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/index.ts similarity index 91% rename from x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/java/index.ts rename to x-pack/plugins/apm/server/lib/metrics/by_agent/java/index.ts index 191a7a2c14d23..c089d77828cf4 100644 --- a/x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/java/index.ts +++ b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/index.ts @@ -14,8 +14,8 @@ import { getNonHeapMemoryChart } from './non_heap_memory'; import { getThreadCountChart } from './thread_count'; import { getCPUChartData } from '../shared/cpu'; import { getMemoryChartData } from '../shared/memory'; -import { getGcRateChart } from './gc/getGcRateChart'; -import { getGcTimeChart } from './gc/getGcTimeChart'; +import { getGcRateChart } from './gc/get_gc_rate_chart'; +import { getGcTimeChart } from './gc/get_gc_time_chart'; export async function getJavaMetricsCharts( setup: Setup & SetupTimeRange & SetupUIFilters, diff --git a/x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/java/non_heap_memory/index.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/non_heap_memory/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/java/non_heap_memory/index.ts rename to x-pack/plugins/apm/server/lib/metrics/by_agent/java/non_heap_memory/index.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/java/thread_count/index.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/thread_count/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/java/thread_count/index.ts rename to x-pack/plugins/apm/server/lib/metrics/by_agent/java/thread_count/index.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/shared/cpu/index.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/shared/cpu/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/shared/cpu/index.ts rename to x-pack/plugins/apm/server/lib/metrics/by_agent/shared/cpu/index.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/shared/memory/index.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/shared/memory/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/metrics/by_agent/shared/memory/index.ts rename to x-pack/plugins/apm/server/lib/metrics/by_agent/shared/memory/index.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts b/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts similarity index 94% rename from x-pack/legacy/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts rename to x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts index 410d659a924fd..76460bb40bedb 100644 --- a/x-pack/legacy/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts +++ b/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts @@ -15,7 +15,7 @@ import { ChartBase } from './types'; import { transformDataToMetricsChart } from './transform_metrics_chart'; import { getMetricsProjection } from '../../../common/projections/metrics'; import { mergeProjection } from '../../../common/projections/util/merge_projection'; -import { AggregationOptionsByType } from '../../../../../../plugins/apm/typings/elasticsearch/aggregations'; +import { AggregationOptionsByType } from '../../../typings/elasticsearch/aggregations'; interface Aggs { [key: string]: Unionize<{ diff --git a/x-pack/legacy/plugins/apm/server/lib/metrics/get_metrics_chart_data_by_agent.ts b/x-pack/plugins/apm/server/lib/metrics/get_metrics_chart_data_by_agent.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/metrics/get_metrics_chart_data_by_agent.ts rename to x-pack/plugins/apm/server/lib/metrics/get_metrics_chart_data_by_agent.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/metrics/queries.test.ts b/x-pack/plugins/apm/server/lib/metrics/queries.test.ts similarity index 97% rename from x-pack/legacy/plugins/apm/server/lib/metrics/queries.test.ts rename to x-pack/plugins/apm/server/lib/metrics/queries.test.ts index f276fa69e20e3..ac4e13ae442cf 100644 --- a/x-pack/legacy/plugins/apm/server/lib/metrics/queries.test.ts +++ b/x-pack/plugins/apm/server/lib/metrics/queries.test.ts @@ -12,7 +12,7 @@ import { getThreadCountChart } from './by_agent/java/thread_count'; import { SearchParamsMock, inspectSearchParams -} from '../../../public/utils/testHelpers'; +} from '../../../../../legacy/plugins/apm/public/utils/testHelpers'; import { SERVICE_NODE_NAME_MISSING } from '../../../common/service_nodes'; describe('metrics queries', () => { diff --git a/x-pack/legacy/plugins/apm/server/lib/metrics/transform_metrics_chart.test.ts b/x-pack/plugins/apm/server/lib/metrics/transform_metrics_chart.test.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/metrics/transform_metrics_chart.test.ts rename to x-pack/plugins/apm/server/lib/metrics/transform_metrics_chart.test.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/metrics/transform_metrics_chart.ts b/x-pack/plugins/apm/server/lib/metrics/transform_metrics_chart.ts similarity index 92% rename from x-pack/legacy/plugins/apm/server/lib/metrics/transform_metrics_chart.ts rename to x-pack/plugins/apm/server/lib/metrics/transform_metrics_chart.ts index 8e7c969eec96a..03f21e4f26e7b 100644 --- a/x-pack/legacy/plugins/apm/server/lib/metrics/transform_metrics_chart.ts +++ b/x-pack/plugins/apm/server/lib/metrics/transform_metrics_chart.ts @@ -9,8 +9,8 @@ import { ChartBase } from './types'; import { ESSearchResponse, ESSearchRequest -} from '../../../../../../plugins/apm/typings/elasticsearch'; -import { AggregationOptionsByType } from '../../../../../../plugins/apm/typings/elasticsearch/aggregations'; +} from '../../../typings/elasticsearch'; +import { AggregationOptionsByType } from '../../../typings/elasticsearch/aggregations'; import { getVizColorForIndex } from '../../../common/viz_colors'; export type GenericMetricsChart = ReturnType< diff --git a/x-pack/legacy/plugins/apm/server/lib/metrics/types.ts b/x-pack/plugins/apm/server/lib/metrics/types.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/metrics/types.ts rename to x-pack/plugins/apm/server/lib/metrics/types.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/security/get_indices_privileges.ts b/x-pack/plugins/apm/server/lib/security/get_indices_privileges.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/security/get_indices_privileges.ts rename to x-pack/plugins/apm/server/lib/security/get_indices_privileges.ts diff --git a/x-pack/plugins/apm/server/lib/security/get_permissions.ts b/x-pack/plugins/apm/server/lib/security/get_permissions.ts new file mode 100644 index 0000000000000..ed2a1f64e7f84 --- /dev/null +++ b/x-pack/plugins/apm/server/lib/security/get_permissions.ts @@ -0,0 +1,32 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import { Setup } from '../helpers/setup_request'; + +export async function getPermissions(setup: Setup) { + const { client, indices } = setup; + + const params = { + index: Object.values(indices), + body: { + size: 0, + query: { + match_all: {} + } + } + }; + + try { + await client.search(params); + return { hasPermission: true }; + } catch (e) { + // If 403, it means the user doesnt have permission. + if (e.status === 403) { + return { hasPermission: false }; + } + // if any other error happens, throw it. + throw e; + } +} diff --git a/x-pack/legacy/plugins/apm/server/lib/service_map/get_service_map.ts b/x-pack/plugins/apm/server/lib/service_map/get_service_map.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/service_map/get_service_map.ts rename to x-pack/plugins/apm/server/lib/service_map/get_service_map.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/service_map/get_service_map_from_trace_ids.ts b/x-pack/plugins/apm/server/lib/service_map/get_service_map_from_trace_ids.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/service_map/get_service_map_from_trace_ids.ts rename to x-pack/plugins/apm/server/lib/service_map/get_service_map_from_trace_ids.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/service_map/get_service_map_service_node_info.ts b/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.ts similarity index 98% rename from x-pack/legacy/plugins/apm/server/lib/service_map/get_service_map_service_node_info.ts rename to x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.ts index cff2d8570349e..6c4d540103cec 100644 --- a/x-pack/legacy/plugins/apm/server/lib/service_map/get_service_map_service_node_info.ts +++ b/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.ts @@ -5,7 +5,7 @@ */ import { Setup, SetupTimeRange } from '../helpers/setup_request'; -import { ESFilter } from '../../../../../../plugins/apm/typings/elasticsearch'; +import { ESFilter } from '../../../typings/elasticsearch'; import { rangeFilter } from '../helpers/range_filter'; import { PROCESSOR_EVENT, diff --git a/x-pack/legacy/plugins/apm/server/lib/service_map/get_trace_sample_ids.ts b/x-pack/plugins/apm/server/lib/service_map/get_trace_sample_ids.ts similarity index 98% rename from x-pack/legacy/plugins/apm/server/lib/service_map/get_trace_sample_ids.ts rename to x-pack/plugins/apm/server/lib/service_map/get_trace_sample_ids.ts index 92452c6dafff0..463fe7f2cf640 100644 --- a/x-pack/legacy/plugins/apm/server/lib/service_map/get_trace_sample_ids.ts +++ b/x-pack/plugins/apm/server/lib/service_map/get_trace_sample_ids.ts @@ -10,7 +10,7 @@ import { SetupTimeRange } from '../helpers/setup_request'; import { rangeFilter } from '../helpers/range_filter'; -import { ESFilter } from '../../../../../../plugins/apm/typings/elasticsearch'; +import { ESFilter } from '../../../typings/elasticsearch'; import { PROCESSOR_EVENT, SERVICE_NAME, diff --git a/x-pack/legacy/plugins/apm/server/lib/service_nodes/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/service_nodes/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/service_nodes/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/lib/service_nodes/__snapshots__/queries.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/service_nodes/index.ts b/x-pack/plugins/apm/server/lib/service_nodes/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/service_nodes/index.ts rename to x-pack/plugins/apm/server/lib/service_nodes/index.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/service_nodes/queries.test.ts b/x-pack/plugins/apm/server/lib/service_nodes/queries.test.ts similarity index 95% rename from x-pack/legacy/plugins/apm/server/lib/service_nodes/queries.test.ts rename to x-pack/plugins/apm/server/lib/service_nodes/queries.test.ts index 80cd94b1549d7..672d568b3a5e3 100644 --- a/x-pack/legacy/plugins/apm/server/lib/service_nodes/queries.test.ts +++ b/x-pack/plugins/apm/server/lib/service_nodes/queries.test.ts @@ -13,7 +13,7 @@ import { getServiceNodes } from './'; import { SearchParamsMock, inspectSearchParams -} from '../../../public/utils/testHelpers'; +} from '../../../../../legacy/plugins/apm/public/utils/testHelpers'; import { getServiceNodeMetadata } from '../services/get_service_node_metadata'; import { SERVICE_NODE_NAME_MISSING } from '../../../common/service_nodes'; diff --git a/x-pack/legacy/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/services/annotations/__fixtures__/multiple-versions.json b/x-pack/plugins/apm/server/lib/services/annotations/__fixtures__/multiple_versions.json similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/services/annotations/__fixtures__/multiple-versions.json rename to x-pack/plugins/apm/server/lib/services/annotations/__fixtures__/multiple_versions.json diff --git a/x-pack/legacy/plugins/apm/server/lib/services/annotations/__fixtures__/no-versions.json b/x-pack/plugins/apm/server/lib/services/annotations/__fixtures__/no_versions.json similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/services/annotations/__fixtures__/no-versions.json rename to x-pack/plugins/apm/server/lib/services/annotations/__fixtures__/no_versions.json diff --git a/x-pack/legacy/plugins/apm/server/lib/services/annotations/__fixtures__/one-version.json b/x-pack/plugins/apm/server/lib/services/annotations/__fixtures__/one_version.json similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/services/annotations/__fixtures__/one-version.json rename to x-pack/plugins/apm/server/lib/services/annotations/__fixtures__/one_version.json diff --git a/x-pack/legacy/plugins/apm/server/lib/services/annotations/__fixtures__/versions-first-seen.json b/x-pack/plugins/apm/server/lib/services/annotations/__fixtures__/versions_first_seen.json similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/services/annotations/__fixtures__/versions-first-seen.json rename to x-pack/plugins/apm/server/lib/services/annotations/__fixtures__/versions_first_seen.json diff --git a/x-pack/legacy/plugins/apm/server/lib/services/annotations/index.test.ts b/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts similarity index 87% rename from x-pack/legacy/plugins/apm/server/lib/services/annotations/index.test.ts rename to x-pack/plugins/apm/server/lib/services/annotations/index.test.ts index 75ac0642a1b8c..0e52982c6de28 100644 --- a/x-pack/legacy/plugins/apm/server/lib/services/annotations/index.test.ts +++ b/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts @@ -7,11 +7,11 @@ import { getServiceAnnotations } from '.'; import { SearchParamsMock, inspectSearchParams -} from '../../../../public/utils/testHelpers'; -import noVersions from './__fixtures__/no-versions.json'; -import oneVersion from './__fixtures__/one-version.json'; -import multipleVersions from './__fixtures__/multiple-versions.json'; -import versionsFirstSeen from './__fixtures__/versions-first-seen.json'; +} from '../../../../../../legacy/plugins/apm/public/utils/testHelpers'; +import noVersions from './__fixtures__/no_versions.json'; +import oneVersion from './__fixtures__/one_version.json'; +import multipleVersions from './__fixtures__/multiple_versions.json'; +import versionsFirstSeen from './__fixtures__/versions_first_seen.json'; describe('getServiceAnnotations', () => { let mock: SearchParamsMock; diff --git a/x-pack/legacy/plugins/apm/server/lib/services/annotations/index.ts b/x-pack/plugins/apm/server/lib/services/annotations/index.ts similarity index 97% rename from x-pack/legacy/plugins/apm/server/lib/services/annotations/index.ts rename to x-pack/plugins/apm/server/lib/services/annotations/index.ts index 9c8e4f2281b5e..c03746ca220ee 100644 --- a/x-pack/legacy/plugins/apm/server/lib/services/annotations/index.ts +++ b/x-pack/plugins/apm/server/lib/services/annotations/index.ts @@ -5,7 +5,7 @@ */ import { isNumber } from 'lodash'; import { Annotation, AnnotationType } from '../../../../common/annotations'; -import { ESFilter } from '../../../../../../../plugins/apm/typings/elasticsearch'; +import { ESFilter } from '../../../../typings/elasticsearch'; import { SERVICE_NAME, SERVICE_ENVIRONMENT, diff --git a/x-pack/legacy/plugins/apm/server/lib/services/get_service_agent_name.ts b/x-pack/plugins/apm/server/lib/services/get_service_agent_name.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/services/get_service_agent_name.ts rename to x-pack/plugins/apm/server/lib/services/get_service_agent_name.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/services/get_service_node_metadata.ts b/x-pack/plugins/apm/server/lib/services/get_service_node_metadata.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/services/get_service_node_metadata.ts rename to x-pack/plugins/apm/server/lib/services/get_service_node_metadata.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/services/get_service_transaction_types.ts b/x-pack/plugins/apm/server/lib/services/get_service_transaction_types.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/services/get_service_transaction_types.ts rename to x-pack/plugins/apm/server/lib/services/get_service_transaction_types.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/services/get_services/get_legacy_data_status.ts b/x-pack/plugins/apm/server/lib/services/get_services/get_legacy_data_status.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/services/get_services/get_legacy_data_status.ts rename to x-pack/plugins/apm/server/lib/services/get_services/get_legacy_data_status.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/services/get_services/get_services_items.ts b/x-pack/plugins/apm/server/lib/services/get_services/get_services_items.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/services/get_services/get_services_items.ts rename to x-pack/plugins/apm/server/lib/services/get_services/get_services_items.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/services/get_services/has_historical_agent_data.ts b/x-pack/plugins/apm/server/lib/services/get_services/has_historical_agent_data.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/services/get_services/has_historical_agent_data.ts rename to x-pack/plugins/apm/server/lib/services/get_services/has_historical_agent_data.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/services/get_services/index.ts b/x-pack/plugins/apm/server/lib/services/get_services/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/services/get_services/index.ts rename to x-pack/plugins/apm/server/lib/services/get_services/index.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/services/map.ts b/x-pack/plugins/apm/server/lib/services/map.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/services/map.ts rename to x-pack/plugins/apm/server/lib/services/map.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/services/queries.test.ts b/x-pack/plugins/apm/server/lib/services/queries.test.ts similarity index 96% rename from x-pack/legacy/plugins/apm/server/lib/services/queries.test.ts rename to x-pack/plugins/apm/server/lib/services/queries.test.ts index 16490ace77744..e75d9ad05648c 100644 --- a/x-pack/legacy/plugins/apm/server/lib/services/queries.test.ts +++ b/x-pack/plugins/apm/server/lib/services/queries.test.ts @@ -12,7 +12,7 @@ import { hasHistoricalAgentData } from './get_services/has_historical_agent_data import { SearchParamsMock, inspectSearchParams -} from '../../../public/utils/testHelpers'; +} from '../../../../../legacy/plugins/apm/public/utils/testHelpers'; describe('services queries', () => { let mock: SearchParamsMock; diff --git a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/settings/agent_configuration/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/lib/settings/agent_configuration/__snapshots__/queries.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/configuration_types.d.ts b/x-pack/plugins/apm/server/lib/settings/agent_configuration/configuration_types.d.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/configuration_types.d.ts rename to x-pack/plugins/apm/server/lib/settings/agent_configuration/configuration_types.d.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/create_agent_config_index.ts b/x-pack/plugins/apm/server/lib/settings/agent_configuration/create_agent_config_index.ts similarity index 94% rename from x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/create_agent_config_index.ts rename to x-pack/plugins/apm/server/lib/settings/agent_configuration/create_agent_config_index.ts index 52ba22cbc0b99..af2d2a13eaa2f 100644 --- a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/create_agent_config_index.ts +++ b/x-pack/plugins/apm/server/lib/settings/agent_configuration/create_agent_config_index.ts @@ -5,8 +5,8 @@ */ import { IClusterClient } from 'src/core/server'; -import { APMConfig } from '../../../../../../../plugins/apm/server'; -import { CallCluster } from '../../../../../../../../src/legacy/core_plugins/elasticsearch'; +import { CallCluster } from 'src/legacy/core_plugins/elasticsearch'; +import { APMConfig } from '../../..'; import { getApmIndicesConfig } from '../apm_indices/get_apm_indices'; export async function createApmAgentConfigurationIndex({ diff --git a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/create_or_update_configuration.ts b/x-pack/plugins/apm/server/lib/settings/agent_configuration/create_or_update_configuration.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/create_or_update_configuration.ts rename to x-pack/plugins/apm/server/lib/settings/agent_configuration/create_or_update_configuration.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/delete_configuration.ts b/x-pack/plugins/apm/server/lib/settings/agent_configuration/delete_configuration.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/delete_configuration.ts rename to x-pack/plugins/apm/server/lib/settings/agent_configuration/delete_configuration.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/get_agent_name_by_service.ts b/x-pack/plugins/apm/server/lib/settings/agent_configuration/get_agent_name_by_service.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/get_agent_name_by_service.ts rename to x-pack/plugins/apm/server/lib/settings/agent_configuration/get_agent_name_by_service.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/get_environments/get_all_environments.ts b/x-pack/plugins/apm/server/lib/settings/agent_configuration/get_environments/get_all_environments.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/get_environments/get_all_environments.ts rename to x-pack/plugins/apm/server/lib/settings/agent_configuration/get_environments/get_all_environments.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/get_environments/get_existing_environments_for_service.ts b/x-pack/plugins/apm/server/lib/settings/agent_configuration/get_environments/get_existing_environments_for_service.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/get_environments/get_existing_environments_for_service.ts rename to x-pack/plugins/apm/server/lib/settings/agent_configuration/get_environments/get_existing_environments_for_service.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/get_environments/index.ts b/x-pack/plugins/apm/server/lib/settings/agent_configuration/get_environments/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/get_environments/index.ts rename to x-pack/plugins/apm/server/lib/settings/agent_configuration/get_environments/index.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/get_service_names.ts b/x-pack/plugins/apm/server/lib/settings/agent_configuration/get_service_names.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/get_service_names.ts rename to x-pack/plugins/apm/server/lib/settings/agent_configuration/get_service_names.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/list_configurations.ts b/x-pack/plugins/apm/server/lib/settings/agent_configuration/list_configurations.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/list_configurations.ts rename to x-pack/plugins/apm/server/lib/settings/agent_configuration/list_configurations.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/mark_applied_by_agent.ts b/x-pack/plugins/apm/server/lib/settings/agent_configuration/mark_applied_by_agent.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/mark_applied_by_agent.ts rename to x-pack/plugins/apm/server/lib/settings/agent_configuration/mark_applied_by_agent.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/queries.test.ts b/x-pack/plugins/apm/server/lib/settings/agent_configuration/queries.test.ts similarity index 96% rename from x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/queries.test.ts rename to x-pack/plugins/apm/server/lib/settings/agent_configuration/queries.test.ts index 31b0937a1b957..a82d148781ad8 100644 --- a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/queries.test.ts +++ b/x-pack/plugins/apm/server/lib/settings/agent_configuration/queries.test.ts @@ -12,7 +12,7 @@ import { searchConfigurations } from './search'; import { SearchParamsMock, inspectSearchParams -} from '../../../../public/utils/testHelpers'; +} from '../../../../../../legacy/plugins/apm/public/utils/testHelpers'; describe('agent configuration queries', () => { let mock: SearchParamsMock; diff --git a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/search.ts b/x-pack/plugins/apm/server/lib/settings/agent_configuration/search.ts similarity index 95% rename from x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/search.ts rename to x-pack/plugins/apm/server/lib/settings/agent_configuration/search.ts index 3f4225eaf22d6..766baead006b6 100644 --- a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/search.ts +++ b/x-pack/plugins/apm/server/lib/settings/agent_configuration/search.ts @@ -3,7 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { ESSearchHit } from '../../../../../../../plugins/apm/typings/elasticsearch'; +import { ESSearchHit } from '../../../../typings/elasticsearch'; import { SERVICE_NAME, SERVICE_ENVIRONMENT diff --git a/x-pack/legacy/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts b/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts similarity index 93% rename from x-pack/legacy/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts rename to x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts index e7b2330b472d8..00493e53f06dd 100644 --- a/x-pack/legacy/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts +++ b/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts @@ -6,15 +6,17 @@ import { merge } from 'lodash'; import { Server } from 'hapi'; -import { SavedObjectsClientContract } from 'kibana/server'; +import { SavedObjectsClient } from 'src/core/server'; import { PromiseReturnType } from '../../../../typings/common'; import { APM_INDICES_SAVED_OBJECT_TYPE, APM_INDICES_SAVED_OBJECT_ID } from '../../../../common/apm_saved_object_constants'; -import { APMConfig } from '../../../../../../../plugins/apm/server'; +import { APMConfig } from '../../..'; import { APMRequestHandlerContext } from '../../../routes/typings'; +type ISavedObjectsClient = Pick; + export interface ApmIndicesConfig { 'apm_oss.sourcemapIndices': string; 'apm_oss.errorIndices': string; @@ -32,7 +34,7 @@ export type ScopedSavedObjectsClient = ReturnType< >; async function getApmIndicesSavedObject( - savedObjectsClient: SavedObjectsClientContract + savedObjectsClient: ISavedObjectsClient ) { const apmIndices = await savedObjectsClient.get>( APM_INDICES_SAVED_OBJECT_TYPE, @@ -59,7 +61,7 @@ export async function getApmIndices({ savedObjectsClient }: { config: APMConfig; - savedObjectsClient: SavedObjectsClientContract; + savedObjectsClient: ISavedObjectsClient; }) { try { const apmIndicesSavedObject = await getApmIndicesSavedObject( diff --git a/x-pack/legacy/plugins/apm/server/lib/settings/apm_indices/save_apm_indices.test.ts b/x-pack/plugins/apm/server/lib/settings/apm_indices/save_apm_indices.test.ts similarity index 69% rename from x-pack/legacy/plugins/apm/server/lib/settings/apm_indices/save_apm_indices.test.ts rename to x-pack/plugins/apm/server/lib/settings/apm_indices/save_apm_indices.test.ts index 6567736996502..4849b63ccb7c4 100644 --- a/x-pack/legacy/plugins/apm/server/lib/settings/apm_indices/save_apm_indices.test.ts +++ b/x-pack/plugins/apm/server/lib/settings/apm_indices/save_apm_indices.test.ts @@ -5,18 +5,13 @@ */ import { saveApmIndices } from './save_apm_indices'; +import { SavedObjectsClientContract } from '../../../../../../../src/core/server'; describe('saveApmIndices', () => { it('should trim and strip empty settings', async () => { - const context = { - core: { - savedObjects: { - client: { - create: jest.fn() - } - } - } - } as any; + const savedObjectsClient = ({ + create: jest.fn() + } as unknown) as SavedObjectsClientContract; const apmIndices = { settingA: 'aa', @@ -27,8 +22,8 @@ describe('saveApmIndices', () => { settingF: 'ff', settingG: ' gg ' } as any; - await saveApmIndices(context, apmIndices); - expect(context.core.savedObjects.client.create).toHaveBeenCalledWith( + await saveApmIndices(savedObjectsClient, apmIndices); + expect(savedObjectsClient.create).toHaveBeenCalledWith( expect.any(String), { settingA: 'aa', settingF: 'ff', settingG: 'gg' }, expect.any(Object) diff --git a/x-pack/legacy/plugins/apm/server/lib/settings/apm_indices/save_apm_indices.ts b/x-pack/plugins/apm/server/lib/settings/apm_indices/save_apm_indices.ts similarity index 66% rename from x-pack/legacy/plugins/apm/server/lib/settings/apm_indices/save_apm_indices.ts rename to x-pack/plugins/apm/server/lib/settings/apm_indices/save_apm_indices.ts index 4b68b248d8031..135b054b6f5bd 100644 --- a/x-pack/legacy/plugins/apm/server/lib/settings/apm_indices/save_apm_indices.ts +++ b/x-pack/plugins/apm/server/lib/settings/apm_indices/save_apm_indices.ts @@ -3,19 +3,18 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ - +import { SavedObjectsClientContract } from '../../../../../../../src/core/server'; import { APM_INDICES_SAVED_OBJECT_TYPE, APM_INDICES_SAVED_OBJECT_ID } from '../../../../common/apm_saved_object_constants'; import { ApmIndicesConfig } from './get_apm_indices'; -import { APMRequestHandlerContext } from '../../../routes/typings'; export async function saveApmIndices( - context: APMRequestHandlerContext, + savedObjectsClient: SavedObjectsClientContract, apmIndices: Partial ) { - return await context.core.savedObjects.client.create( + return await savedObjectsClient.create( APM_INDICES_SAVED_OBJECT_TYPE, removeEmpty(apmIndices), { @@ -27,9 +26,8 @@ export async function saveApmIndices( // remove empty/undefined values function removeEmpty(apmIndices: Partial) { - return Object.fromEntries( - Object.entries(apmIndices) - .map(([key, value]) => [key, value?.trim()]) - .filter(([key, value]) => !!value) - ); + return Object.entries(apmIndices) + .map(([key, value]) => [key, value?.trim()]) + .filter(([key, value]) => !!value) + .reduce((obj, [key, value]) => ({ ...obj, [key as string]: value }), {}); } diff --git a/x-pack/legacy/plugins/apm/server/lib/traces/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/traces/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/traces/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/lib/traces/__snapshots__/queries.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/traces/get_trace.ts b/x-pack/plugins/apm/server/lib/traces/get_trace.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/traces/get_trace.ts rename to x-pack/plugins/apm/server/lib/traces/get_trace.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/traces/get_trace_items.ts b/x-pack/plugins/apm/server/lib/traces/get_trace_items.ts similarity index 94% rename from x-pack/legacy/plugins/apm/server/lib/traces/get_trace_items.ts rename to x-pack/plugins/apm/server/lib/traces/get_trace_items.ts index 9d3e0d6db7f16..6ca01858f7ae8 100644 --- a/x-pack/legacy/plugins/apm/server/lib/traces/get_trace_items.ts +++ b/x-pack/plugins/apm/server/lib/traces/get_trace_items.ts @@ -13,9 +13,9 @@ import { TRANSACTION_ID, ERROR_LOG_LEVEL } from '../../../common/elasticsearch_fieldnames'; -import { Span } from '../../../typings/es_schemas/ui/Span'; -import { Transaction } from '../../../typings/es_schemas/ui/Transaction'; -import { APMError } from '../../../typings/es_schemas/ui/APMError'; +import { Span } from '../../../typings/es_schemas/ui/span'; +import { Transaction } from '../../../typings/es_schemas/ui/transaction'; +import { APMError } from '../../../typings/es_schemas/ui/apm_error'; import { rangeFilter } from '../helpers/range_filter'; import { Setup, SetupTimeRange } from '../helpers/setup_request'; import { PromiseValueType } from '../../../typings/common'; diff --git a/x-pack/legacy/plugins/apm/server/lib/traces/queries.test.ts b/x-pack/plugins/apm/server/lib/traces/queries.test.ts similarity index 90% rename from x-pack/legacy/plugins/apm/server/lib/traces/queries.test.ts rename to x-pack/plugins/apm/server/lib/traces/queries.test.ts index 871d0fd1c7fb6..0c2ac4d0f9201 100644 --- a/x-pack/legacy/plugins/apm/server/lib/traces/queries.test.ts +++ b/x-pack/plugins/apm/server/lib/traces/queries.test.ts @@ -8,7 +8,7 @@ import { getTraceItems } from './get_trace_items'; import { SearchParamsMock, inspectSearchParams -} from '../../../public/utils/testHelpers'; +} from '../../../../../legacy/plugins/apm/public/utils/testHelpers'; describe('trace queries', () => { let mock: SearchParamsMock; diff --git a/x-pack/legacy/plugins/apm/server/lib/transaction_groups/__snapshots__/fetcher.test.ts.snap b/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/fetcher.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transaction_groups/__snapshots__/fetcher.test.ts.snap rename to x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/fetcher.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/transaction_groups/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transaction_groups/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/queries.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/transaction_groups/__snapshots__/transform.test.ts.snap b/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/transform.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transaction_groups/__snapshots__/transform.test.ts.snap rename to x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/transform.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/transaction_groups/fetcher.test.ts b/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.test.ts similarity index 96% rename from x-pack/legacy/plugins/apm/server/lib/transaction_groups/fetcher.test.ts rename to x-pack/plugins/apm/server/lib/transaction_groups/fetcher.test.ts index 4121ff74bfacc..c4a0be0f48c14 100644 --- a/x-pack/legacy/plugins/apm/server/lib/transaction_groups/fetcher.test.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.test.ts @@ -5,7 +5,7 @@ */ import { transactionGroupsFetcher } from './fetcher'; -import { APMConfig } from '../../../../../../plugins/apm/server'; +import { APMConfig } from '../..'; function getSetup() { return { diff --git a/x-pack/legacy/plugins/apm/server/lib/transaction_groups/fetcher.ts b/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts similarity index 94% rename from x-pack/legacy/plugins/apm/server/lib/transaction_groups/fetcher.ts rename to x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts index 18c61df0cfa7e..39f2be551ab6e 100644 --- a/x-pack/legacy/plugins/apm/server/lib/transaction_groups/fetcher.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts @@ -13,8 +13,8 @@ import { import { getTransactionGroupsProjection } from '../../../common/projections/transaction_groups'; import { mergeProjection } from '../../../common/projections/util/merge_projection'; import { PromiseReturnType } from '../../../typings/common'; -import { SortOptions } from '../../../../../../plugins/apm/typings/elasticsearch/aggregations'; -import { Transaction } from '../../../typings/es_schemas/ui/Transaction'; +import { SortOptions } from '../../../typings/elasticsearch/aggregations'; +import { Transaction } from '../../../typings/es_schemas/ui/transaction'; import { Setup, SetupTimeRange, diff --git a/x-pack/legacy/plugins/apm/server/lib/transaction_groups/index.ts b/x-pack/plugins/apm/server/lib/transaction_groups/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transaction_groups/index.ts rename to x-pack/plugins/apm/server/lib/transaction_groups/index.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transaction_groups/mock-responses/transactionGroupsResponse.ts b/x-pack/plugins/apm/server/lib/transaction_groups/mock_responses/transaction_groups_response.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transaction_groups/mock-responses/transactionGroupsResponse.ts rename to x-pack/plugins/apm/server/lib/transaction_groups/mock_responses/transaction_groups_response.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transaction_groups/queries.test.ts b/x-pack/plugins/apm/server/lib/transaction_groups/queries.test.ts similarity index 93% rename from x-pack/legacy/plugins/apm/server/lib/transaction_groups/queries.test.ts rename to x-pack/plugins/apm/server/lib/transaction_groups/queries.test.ts index 73122d8580134..8d6495c2e0b5f 100644 --- a/x-pack/legacy/plugins/apm/server/lib/transaction_groups/queries.test.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/queries.test.ts @@ -8,7 +8,7 @@ import { transactionGroupsFetcher } from './fetcher'; import { SearchParamsMock, inspectSearchParams -} from '../../../public/utils/testHelpers'; +} from '../../../../../legacy/plugins/apm/public/utils/testHelpers'; describe('transaction group queries', () => { let mock: SearchParamsMock; diff --git a/x-pack/legacy/plugins/apm/server/lib/transaction_groups/transform.test.ts b/x-pack/plugins/apm/server/lib/transaction_groups/transform.test.ts similarity index 96% rename from x-pack/legacy/plugins/apm/server/lib/transaction_groups/transform.test.ts rename to x-pack/plugins/apm/server/lib/transaction_groups/transform.test.ts index 709fa3afdc128..695d22d428aa2 100644 --- a/x-pack/legacy/plugins/apm/server/lib/transaction_groups/transform.test.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/transform.test.ts @@ -5,7 +5,7 @@ */ import { ESResponse } from './fetcher'; -import { transactionGroupsResponse } from './mock-responses/transactionGroupsResponse'; +import { transactionGroupsResponse } from './mock_responses/transaction_groups_response'; import { transactionGroupsTransformer } from './transform'; describe('transactionGroupsTransformer', () => { diff --git a/x-pack/legacy/plugins/apm/server/lib/transaction_groups/transform.ts b/x-pack/plugins/apm/server/lib/transaction_groups/transform.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transaction_groups/transform.ts rename to x-pack/plugins/apm/server/lib/transaction_groups/transform.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/transactions/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/lib/transactions/__snapshots__/queries.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/avg_duration_by_browser/__fixtures__/responses.ts b/x-pack/plugins/apm/server/lib/transactions/avg_duration_by_browser/__fixtures__/responses.ts similarity index 96% rename from x-pack/legacy/plugins/apm/server/lib/transactions/avg_duration_by_browser/__fixtures__/responses.ts rename to x-pack/plugins/apm/server/lib/transactions/avg_duration_by_browser/__fixtures__/responses.ts index 9a9bfc31c21d4..3f0f8a84dc62f 100644 --- a/x-pack/legacy/plugins/apm/server/lib/transactions/avg_duration_by_browser/__fixtures__/responses.ts +++ b/x-pack/plugins/apm/server/lib/transactions/avg_duration_by_browser/__fixtures__/responses.ts @@ -7,7 +7,7 @@ import { ESSearchResponse, ESSearchRequest -} from '../../../../../../../../plugins/apm/typings/elasticsearch'; +} from '../../../../../typings/elasticsearch'; export const response = ({ hits: { diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/avg_duration_by_browser/fetcher.test.ts b/x-pack/plugins/apm/server/lib/transactions/avg_duration_by_browser/fetcher.test.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/avg_duration_by_browser/fetcher.test.ts rename to x-pack/plugins/apm/server/lib/transactions/avg_duration_by_browser/fetcher.test.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/avg_duration_by_browser/fetcher.ts b/x-pack/plugins/apm/server/lib/transactions/avg_duration_by_browser/fetcher.ts similarity index 96% rename from x-pack/legacy/plugins/apm/server/lib/transactions/avg_duration_by_browser/fetcher.ts rename to x-pack/plugins/apm/server/lib/transactions/avg_duration_by_browser/fetcher.ts index 9b0d704dbb43e..8a96a25aef50e 100644 --- a/x-pack/legacy/plugins/apm/server/lib/transactions/avg_duration_by_browser/fetcher.ts +++ b/x-pack/plugins/apm/server/lib/transactions/avg_duration_by_browser/fetcher.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ESFilter } from '../../../../../../../plugins/apm/typings/elasticsearch'; +import { ESFilter } from '../../../../typings/elasticsearch'; import { PromiseReturnType } from '../../../../typings/common'; import { PROCESSOR_EVENT, diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/avg_duration_by_browser/index.test.ts b/x-pack/plugins/apm/server/lib/transactions/avg_duration_by_browser/index.test.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/avg_duration_by_browser/index.test.ts rename to x-pack/plugins/apm/server/lib/transactions/avg_duration_by_browser/index.test.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/avg_duration_by_browser/index.ts b/x-pack/plugins/apm/server/lib/transactions/avg_duration_by_browser/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/avg_duration_by_browser/index.ts rename to x-pack/plugins/apm/server/lib/transactions/avg_duration_by_browser/index.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/avg_duration_by_browser/transformer.test.ts b/x-pack/plugins/apm/server/lib/transactions/avg_duration_by_browser/transformer.test.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/avg_duration_by_browser/transformer.test.ts rename to x-pack/plugins/apm/server/lib/transactions/avg_duration_by_browser/transformer.test.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/avg_duration_by_browser/transformer.ts b/x-pack/plugins/apm/server/lib/transactions/avg_duration_by_browser/transformer.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/avg_duration_by_browser/transformer.ts rename to x-pack/plugins/apm/server/lib/transactions/avg_duration_by_browser/transformer.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/avg_duration_by_country/index.ts b/x-pack/plugins/apm/server/lib/transactions/avg_duration_by_country/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/avg_duration_by_country/index.ts rename to x-pack/plugins/apm/server/lib/transactions/avg_duration_by_country/index.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/breakdown/constants.ts b/x-pack/plugins/apm/server/lib/transactions/breakdown/constants.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/breakdown/constants.ts rename to x-pack/plugins/apm/server/lib/transactions/breakdown/constants.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/breakdown/index.test.ts b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts similarity index 95% rename from x-pack/legacy/plugins/apm/server/lib/transactions/breakdown/index.test.ts rename to x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts index 476928a5bcb63..9ab31be9f7219 100644 --- a/x-pack/legacy/plugins/apm/server/lib/transactions/breakdown/index.test.ts +++ b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts @@ -6,9 +6,9 @@ import { getTransactionBreakdown } from '.'; import * as constants from './constants'; -import noDataResponse from './mock-responses/noData.json'; -import dataResponse from './mock-responses/data.json'; -import { APMConfig } from '../../../../../../../plugins/apm/server'; +import noDataResponse from './mock_responses/no_data.json'; +import dataResponse from './mock_responses/data.json'; +import { APMConfig } from '../../..'; const mockIndices = { 'apm_oss.sourcemapIndices': 'myIndex', diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/breakdown/index.ts b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/breakdown/index.ts rename to x-pack/plugins/apm/server/lib/transactions/breakdown/index.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/breakdown/mock-responses/data.json b/x-pack/plugins/apm/server/lib/transactions/breakdown/mock_responses/data.json similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/breakdown/mock-responses/data.json rename to x-pack/plugins/apm/server/lib/transactions/breakdown/mock_responses/data.json diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/breakdown/mock-responses/noData.json b/x-pack/plugins/apm/server/lib/transactions/breakdown/mock_responses/no_data.json similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/breakdown/mock-responses/noData.json rename to x-pack/plugins/apm/server/lib/transactions/breakdown/mock_responses/no_data.json diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/fetcher.test.ts.snap b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/fetcher.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/fetcher.test.ts.snap rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/fetcher.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/index.test.ts.snap b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/index.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/index.test.ts.snap rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/index.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/transform.test.ts.snap b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/transform.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/transform.test.ts.snap rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/transform.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.test.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.test.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.test.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.test.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/get_ml_bucket_size.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/get_ml_bucket_size.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/get_ml_bucket_size.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/get_ml_bucket_size.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.test.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.test.ts similarity index 91% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.test.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.test.ts index 2a56f744f2f45..cc8fabe33e63d 100644 --- a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.test.ts +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.test.ts @@ -5,10 +5,10 @@ */ import { getAnomalySeries } from '.'; -import { mlAnomalyResponse } from './mock-responses/mlAnomalyResponse'; -import { mlBucketSpanResponse } from './mock-responses/mlBucketSpanResponse'; +import { mlAnomalyResponse } from './mock_responses/ml_anomaly_response'; +import { mlBucketSpanResponse } from './mock_responses/ml_bucket_span_response'; import { PromiseReturnType } from '../../../../../typings/common'; -import { APMConfig } from '../../../../../../../../plugins/apm/server'; +import { APMConfig } from '../../../..'; describe('getAnomalySeries', () => { let avgAnomalies: PromiseReturnType; diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/mock-responses/mlAnomalyResponse.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/mock_responses/ml_anomaly_response.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/mock-responses/mlAnomalyResponse.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/mock_responses/ml_anomaly_response.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/mock-responses/mlBucketSpanResponse.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/mock_responses/ml_bucket_span_response.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/mock-responses/mlBucketSpanResponse.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/mock_responses/ml_bucket_span_response.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.test.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.test.ts similarity index 98% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.test.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.test.ts index 6f8fb39d89337..233da842c5571 100644 --- a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.test.ts +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.test.ts @@ -5,7 +5,7 @@ */ import { ESResponse } from './fetcher'; -import { mlAnomalyResponse } from './mock-responses/mlAnomalyResponse'; +import { mlAnomalyResponse } from './mock_responses/ml_anomaly_response'; import { anomalySeriesTransform, replaceFirstAndLastBucket } from './transform'; describe('anomalySeriesTransform', () => { diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__snapshots__/fetcher.test.ts.snap b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__snapshots__/fetcher.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__snapshots__/fetcher.test.ts.snap rename to x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__snapshots__/fetcher.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__snapshots__/transform.test.ts.snap b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__snapshots__/transform.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__snapshots__/transform.test.ts.snap rename to x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__snapshots__/transform.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.test.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.test.ts similarity index 96% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.test.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.test.ts index 676ad4ded6b69..1970e39a2752e 100644 --- a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.test.ts +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.test.ts @@ -6,7 +6,7 @@ import { PROCESSOR_EVENT } from '../../../../../common/elasticsearch_fieldnames'; import { ESResponse, timeseriesFetcher } from './fetcher'; -import { APMConfig } from '../../../../../../../../plugins/apm/server'; +import { APMConfig } from '../../../../../server'; describe('timeseriesFetcher', () => { let res: ESResponse; diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.ts similarity index 96% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.ts index 67b807da59b9b..8a2e01c9a7891 100644 --- a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.ts +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ESFilter } from '../../../../../../../../plugins/apm/typings/elasticsearch'; +import { ESFilter } from '../../../../../typings/elasticsearch'; import { PROCESSOR_EVENT, SERVICE_NAME, diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/index.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/index.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/index.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/mock-responses/timeseries_response.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/mock_responses/timeseries_response.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/mock-responses/timeseries_response.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/mock_responses/timeseries_response.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.test.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.test.ts similarity index 97% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.test.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.test.ts index 1da800ae21ab2..0d11fae55f68f 100644 --- a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.test.ts +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.test.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { timeseriesResponse } from './mock-responses/timeseries_response'; +import { timeseriesResponse } from './mock_responses/timeseries_response'; import { ApmTimeSeriesResponse, getTpmBuckets, diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/charts/index.ts b/x-pack/plugins/apm/server/lib/transactions/charts/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/charts/index.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/index.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/constants.ts b/x-pack/plugins/apm/server/lib/transactions/constants.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/constants.ts rename to x-pack/plugins/apm/server/lib/transactions/constants.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/distribution/get_buckets/fetcher.ts b/x-pack/plugins/apm/server/lib/transactions/distribution/get_buckets/fetcher.ts similarity index 99% rename from x-pack/legacy/plugins/apm/server/lib/transactions/distribution/get_buckets/fetcher.ts rename to x-pack/plugins/apm/server/lib/transactions/distribution/get_buckets/fetcher.ts index b2f0834107df4..e6a989b9a6939 100644 --- a/x-pack/legacy/plugins/apm/server/lib/transactions/distribution/get_buckets/fetcher.ts +++ b/x-pack/plugins/apm/server/lib/transactions/distribution/get_buckets/fetcher.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { Transaction } from '../../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../typings/es_schemas/ui/transaction'; import { PROCESSOR_EVENT, SERVICE_NAME, diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/distribution/get_buckets/index.ts b/x-pack/plugins/apm/server/lib/transactions/distribution/get_buckets/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/distribution/get_buckets/index.ts rename to x-pack/plugins/apm/server/lib/transactions/distribution/get_buckets/index.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/distribution/get_buckets/transform.ts b/x-pack/plugins/apm/server/lib/transactions/distribution/get_buckets/transform.ts similarity index 98% rename from x-pack/legacy/plugins/apm/server/lib/transactions/distribution/get_buckets/transform.ts rename to x-pack/plugins/apm/server/lib/transactions/distribution/get_buckets/transform.ts index 2e703dfb19680..9b22e1794f969 100644 --- a/x-pack/legacy/plugins/apm/server/lib/transactions/distribution/get_buckets/transform.ts +++ b/x-pack/plugins/apm/server/lib/transactions/distribution/get_buckets/transform.ts @@ -5,7 +5,7 @@ */ import { PromiseReturnType } from '../../../../../typings/common'; -import { Transaction } from '../../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../../typings/es_schemas/ui/transaction'; import { bucketFetcher } from './fetcher'; type DistributionBucketResponse = PromiseReturnType; diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/distribution/get_distribution_max.ts b/x-pack/plugins/apm/server/lib/transactions/distribution/get_distribution_max.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/distribution/get_distribution_max.ts rename to x-pack/plugins/apm/server/lib/transactions/distribution/get_distribution_max.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/distribution/index.ts b/x-pack/plugins/apm/server/lib/transactions/distribution/index.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/transactions/distribution/index.ts rename to x-pack/plugins/apm/server/lib/transactions/distribution/index.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/get_transaction/index.ts b/x-pack/plugins/apm/server/lib/transactions/get_transaction/index.ts similarity index 95% rename from x-pack/legacy/plugins/apm/server/lib/transactions/get_transaction/index.ts rename to x-pack/plugins/apm/server/lib/transactions/get_transaction/index.ts index e7ba453357a8a..a82109c2340d2 100644 --- a/x-pack/legacy/plugins/apm/server/lib/transactions/get_transaction/index.ts +++ b/x-pack/plugins/apm/server/lib/transactions/get_transaction/index.ts @@ -9,7 +9,7 @@ import { TRACE_ID, TRANSACTION_ID } from '../../../../common/elasticsearch_fieldnames'; -import { Transaction } from '../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../typings/es_schemas/ui/transaction'; import { rangeFilter } from '../../helpers/range_filter'; import { Setup, diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/get_transaction_by_trace/index.ts b/x-pack/plugins/apm/server/lib/transactions/get_transaction_by_trace/index.ts similarity index 95% rename from x-pack/legacy/plugins/apm/server/lib/transactions/get_transaction_by_trace/index.ts rename to x-pack/plugins/apm/server/lib/transactions/get_transaction_by_trace/index.ts index a753908c545c4..f7ced239b7d4b 100644 --- a/x-pack/legacy/plugins/apm/server/lib/transactions/get_transaction_by_trace/index.ts +++ b/x-pack/plugins/apm/server/lib/transactions/get_transaction_by_trace/index.ts @@ -9,7 +9,7 @@ import { TRACE_ID, PARENT_ID } from '../../../../common/elasticsearch_fieldnames'; -import { Transaction } from '../../../../typings/es_schemas/ui/Transaction'; +import { Transaction } from '../../../../typings/es_schemas/ui/transaction'; import { Setup } from '../../helpers/setup_request'; import { ProcessorEvent } from '../../../../common/processor_event'; diff --git a/x-pack/legacy/plugins/apm/server/lib/transactions/queries.test.ts b/x-pack/plugins/apm/server/lib/transactions/queries.test.ts similarity index 97% rename from x-pack/legacy/plugins/apm/server/lib/transactions/queries.test.ts rename to x-pack/plugins/apm/server/lib/transactions/queries.test.ts index a9e4204fde1ad..116738da5ef9b 100644 --- a/x-pack/legacy/plugins/apm/server/lib/transactions/queries.test.ts +++ b/x-pack/plugins/apm/server/lib/transactions/queries.test.ts @@ -11,7 +11,7 @@ import { getTransaction } from './get_transaction'; import { SearchParamsMock, inspectSearchParams -} from '../../../public/utils/testHelpers'; +} from '../../../../../legacy/plugins/apm/public/utils/testHelpers'; describe('transaction queries', () => { let mock: SearchParamsMock; diff --git a/x-pack/legacy/plugins/apm/server/lib/ui_filters/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/ui_filters/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/ui_filters/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/lib/ui_filters/__snapshots__/queries.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/ui_filters/get_environments.ts b/x-pack/plugins/apm/server/lib/ui_filters/get_environments.ts similarity index 95% rename from x-pack/legacy/plugins/apm/server/lib/ui_filters/get_environments.ts rename to x-pack/plugins/apm/server/lib/ui_filters/get_environments.ts index 05985ee95a207..50c1926d1e4a0 100644 --- a/x-pack/legacy/plugins/apm/server/lib/ui_filters/get_environments.ts +++ b/x-pack/plugins/apm/server/lib/ui_filters/get_environments.ts @@ -12,7 +12,7 @@ import { import { rangeFilter } from '../helpers/range_filter'; import { Setup, SetupTimeRange } from '../helpers/setup_request'; import { ENVIRONMENT_NOT_DEFINED } from '../../../common/environment_filter_values'; -import { ESFilter } from '../../../../../../plugins/apm/typings/elasticsearch'; +import { ESFilter } from '../../../typings/elasticsearch'; export async function getEnvironments( setup: Setup & SetupTimeRange, diff --git a/x-pack/legacy/plugins/apm/server/lib/ui_filters/local_ui_filters/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/ui_filters/local_ui_filters/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/__snapshots__/queries.test.ts.snap diff --git a/x-pack/legacy/plugins/apm/server/lib/ui_filters/local_ui_filters/config.ts b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/config.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/lib/ui_filters/local_ui_filters/config.ts rename to x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/config.ts diff --git a/x-pack/legacy/plugins/apm/server/lib/ui_filters/local_ui_filters/get_local_filter_query.ts b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/get_local_filter_query.ts similarity index 96% rename from x-pack/legacy/plugins/apm/server/lib/ui_filters/local_ui_filters/get_local_filter_query.ts rename to x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/get_local_filter_query.ts index 459fd05ae8176..b39a2875b7f3d 100644 --- a/x-pack/legacy/plugins/apm/server/lib/ui_filters/local_ui_filters/get_local_filter_query.ts +++ b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/get_local_filter_query.ts @@ -8,7 +8,7 @@ import { omit } from 'lodash'; import { IIndexPattern } from 'src/plugins/data/server'; import { mergeProjection } from '../../../../common/projections/util/merge_projection'; import { Projection } from '../../../../common/projections/typings'; -import { UIFilters } from '../../../../typings/ui-filters'; +import { UIFilters } from '../../../../typings/ui_filters'; import { getUiFiltersES } from '../../helpers/convert_ui_filters/get_ui_filters_es'; import { localUIFilters, LocalUIFilterName } from './config'; diff --git a/x-pack/legacy/plugins/apm/server/lib/ui_filters/local_ui_filters/index.ts b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/index.ts similarity index 96% rename from x-pack/legacy/plugins/apm/server/lib/ui_filters/local_ui_filters/index.ts rename to x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/index.ts index 39a264b89ed81..1462cf2eeefa4 100644 --- a/x-pack/legacy/plugins/apm/server/lib/ui_filters/local_ui_filters/index.ts +++ b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/index.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import { cloneDeep, sortByOrder } from 'lodash'; -import { UIFilters } from '../../../../typings/ui-filters'; +import { UIFilters } from '../../../../typings/ui_filters'; import { Projection } from '../../../../common/projections/typings'; import { PromiseReturnType } from '../../../../typings/common'; import { getLocalFilterQuery } from './get_local_filter_query'; diff --git a/x-pack/legacy/plugins/apm/server/lib/ui_filters/local_ui_filters/queries.test.ts b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/queries.test.ts similarity index 93% rename from x-pack/legacy/plugins/apm/server/lib/ui_filters/local_ui_filters/queries.test.ts rename to x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/queries.test.ts index b72186f528f28..21cc35da72cb9 100644 --- a/x-pack/legacy/plugins/apm/server/lib/ui_filters/local_ui_filters/queries.test.ts +++ b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/queries.test.ts @@ -8,7 +8,7 @@ import { getLocalUIFilters } from './'; import { SearchParamsMock, inspectSearchParams -} from '../../../../public/utils/testHelpers'; +} from '../../../../../../legacy/plugins/apm/public/utils/testHelpers'; import { getServicesProjection } from '../../../../common/projections/services'; describe('local ui filter queries', () => { diff --git a/x-pack/legacy/plugins/apm/server/lib/ui_filters/queries.test.ts b/x-pack/plugins/apm/server/lib/ui_filters/queries.test.ts similarity index 92% rename from x-pack/legacy/plugins/apm/server/lib/ui_filters/queries.test.ts rename to x-pack/plugins/apm/server/lib/ui_filters/queries.test.ts index 079ab64f32db3..63c8c3e494bb0 100644 --- a/x-pack/legacy/plugins/apm/server/lib/ui_filters/queries.test.ts +++ b/x-pack/plugins/apm/server/lib/ui_filters/queries.test.ts @@ -8,7 +8,7 @@ import { getEnvironments } from './get_environments'; import { SearchParamsMock, inspectSearchParams -} from '../../../public/utils/testHelpers'; +} from '../../../../../legacy/plugins/apm/public/utils/testHelpers'; describe('ui filter queries', () => { let mock: SearchParamsMock; diff --git a/x-pack/plugins/apm/server/plugin.ts b/x-pack/plugins/apm/server/plugin.ts index 83ece92aebe45..de23c4c5dd383 100644 --- a/x-pack/plugins/apm/server/plugin.ts +++ b/x-pack/plugins/apm/server/plugin.ts @@ -3,24 +3,22 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { - PluginInitializerContext, - Plugin, - CoreSetup, - SavedObjectsClientContract, -} from 'src/core/server'; +import { PluginInitializerContext, Plugin, CoreSetup } from 'src/core/server'; import { Observable, combineLatest, AsyncSubject } from 'rxjs'; import { map } from 'rxjs/operators'; import { Server } from 'hapi'; import { once } from 'lodash'; +import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; +import { makeApmUsageCollector } from './lib/apm_telemetry'; import { Plugin as APMOSSPlugin } from '../../../../src/plugins/apm_oss/server'; -import { createApmAgentConfigurationIndex } from '../../../legacy/plugins/apm/server/lib/settings/agent_configuration/create_agent_config_index'; -import { createApmApi } from '../../../legacy/plugins/apm/server/routes/create_apm_api'; -import { getApmIndices } from '../../../legacy/plugins/apm/server/lib/settings/apm_indices/get_apm_indices'; +import { createApmAgentConfigurationIndex } from './lib/settings/agent_configuration/create_agent_config_index'; +import { createApmApi } from './routes/create_apm_api'; +import { getApmIndices } from './lib/settings/apm_indices/get_apm_indices'; import { APMConfig, mergeConfigs, APMXPackConfig } from '.'; import { HomeServerPluginSetup } from '../../../../src/plugins/home/server'; import { tutorialProvider } from './tutorial'; import { CloudSetup } from '../../cloud/server'; +import { getInternalSavedObjectsClient } from './lib/helpers/get_internal_saved_objects_client'; export interface LegacySetup { server: Server; @@ -29,9 +27,7 @@ export interface LegacySetup { export interface APMPluginContract { config$: Observable; registerLegacyAPI: (__LEGACY: LegacySetup) => void; - getApmIndices: ( - savedObjectsClient: SavedObjectsClientContract - ) => ReturnType; + getApmIndices: () => ReturnType; } export class APMPlugin implements Plugin { @@ -49,6 +45,7 @@ export class APMPlugin implements Plugin { apm_oss: APMOSSPlugin extends Plugin ? TSetup : never; home: HomeServerPluginSetup; cloud?: CloudSetup; + usageCollection?: UsageCollectionSetup; } ) { const config$ = this.initContext.config.create(); @@ -67,7 +64,7 @@ export class APMPlugin implements Plugin { this.currentConfig = config; await createApmAgentConfigurationIndex({ esClient: core.elasticsearch.dataClient, - config, + config }); resolve(); }); @@ -83,20 +80,34 @@ export class APMPlugin implements Plugin { metricsIndices: this.currentConfig['apm_oss.metricsIndices'], onboardingIndices: this.currentConfig['apm_oss.onboardingIndices'], sourcemapIndices: this.currentConfig['apm_oss.sourcemapIndices'], - transactionIndices: this.currentConfig['apm_oss.transactionIndices'], - }, + transactionIndices: this.currentConfig['apm_oss.transactionIndices'] + } }) ); + const usageCollection = plugins.usageCollection; + if (usageCollection) { + getInternalSavedObjectsClient(core) + .then(savedObjectsClient => { + makeApmUsageCollector(usageCollection, savedObjectsClient); + }) + .catch(error => { + logger.error('Unable to initialize use collection'); + logger.error(error.message); + }); + } + return { config$: mergedConfig$, registerLegacyAPI: once((__LEGACY: LegacySetup) => { this.legacySetup$.next(__LEGACY); this.legacySetup$.complete(); }), - getApmIndices: async (savedObjectsClient: SavedObjectsClientContract) => { - return getApmIndices({ savedObjectsClient, config: this.currentConfig }); - }, + getApmIndices: async () => + getApmIndices({ + savedObjectsClient: await getInternalSavedObjectsClient(core), + config: this.currentConfig + }) }; } diff --git a/x-pack/legacy/plugins/apm/server/routes/create_api/index.test.ts b/x-pack/plugins/apm/server/routes/create_api/index.test.ts similarity index 98% rename from x-pack/legacy/plugins/apm/server/routes/create_api/index.test.ts rename to x-pack/plugins/apm/server/routes/create_api/index.test.ts index 309e503c4a497..e639bb5101e2f 100644 --- a/x-pack/legacy/plugins/apm/server/routes/create_api/index.test.ts +++ b/x-pack/plugins/apm/server/routes/create_api/index.test.ts @@ -8,8 +8,8 @@ import { createApi } from './index'; import { CoreSetup, Logger } from 'src/core/server'; import { Params } from '../typings'; import { BehaviorSubject } from 'rxjs'; -import { APMConfig } from '../../../../../../plugins/apm/server'; -import { LegacySetup } from '../../../../../../plugins/apm/server/plugin'; +import { APMConfig } from '../..'; +import { LegacySetup } from '../../plugin'; const getCoreMock = () => { const get = jest.fn(); diff --git a/x-pack/legacy/plugins/apm/server/routes/create_api/index.ts b/x-pack/plugins/apm/server/routes/create_api/index.ts similarity index 98% rename from x-pack/legacy/plugins/apm/server/routes/create_api/index.ts rename to x-pack/plugins/apm/server/routes/create_api/index.ts index c1a9838e90406..a84a24cea17d2 100644 --- a/x-pack/legacy/plugins/apm/server/routes/create_api/index.ts +++ b/x-pack/plugins/apm/server/routes/create_api/index.ts @@ -10,7 +10,7 @@ import * as t from 'io-ts'; import { PathReporter } from 'io-ts/lib/PathReporter'; import { isLeft } from 'fp-ts/lib/Either'; import { KibanaResponseFactory, RouteRegistrar } from 'src/core/server'; -import { APMConfig } from '../../../../../../plugins/apm/server'; +import { APMConfig } from '../..'; import { ServerAPI, RouteFactoryFn, diff --git a/x-pack/legacy/plugins/apm/server/routes/create_apm_api.ts b/x-pack/plugins/apm/server/routes/create_apm_api.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/routes/create_apm_api.ts rename to x-pack/plugins/apm/server/routes/create_apm_api.ts diff --git a/x-pack/legacy/plugins/apm/server/routes/create_route.ts b/x-pack/plugins/apm/server/routes/create_route.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/routes/create_route.ts rename to x-pack/plugins/apm/server/routes/create_route.ts diff --git a/x-pack/legacy/plugins/apm/server/routes/default_api_types.ts b/x-pack/plugins/apm/server/routes/default_api_types.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/routes/default_api_types.ts rename to x-pack/plugins/apm/server/routes/default_api_types.ts diff --git a/x-pack/legacy/plugins/apm/server/routes/errors.ts b/x-pack/plugins/apm/server/routes/errors.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/routes/errors.ts rename to x-pack/plugins/apm/server/routes/errors.ts diff --git a/x-pack/legacy/plugins/apm/server/routes/index_pattern.ts b/x-pack/plugins/apm/server/routes/index_pattern.ts similarity index 79% rename from x-pack/legacy/plugins/apm/server/routes/index_pattern.ts rename to x-pack/plugins/apm/server/routes/index_pattern.ts index 539846430c7f8..b7964dc8e91ed 100644 --- a/x-pack/legacy/plugins/apm/server/routes/index_pattern.ts +++ b/x-pack/plugins/apm/server/routes/index_pattern.ts @@ -7,13 +7,15 @@ import * as t from 'io-ts'; import { createStaticIndexPattern } from '../lib/index_pattern/create_static_index_pattern'; import { createRoute } from './create_route'; import { setupRequest } from '../lib/helpers/setup_request'; +import { getInternalSavedObjectsClient } from '../lib/helpers/get_internal_saved_objects_client'; -export const staticIndexPatternRoute = createRoute(() => ({ +export const staticIndexPatternRoute = createRoute(core => ({ method: 'POST', path: '/api/apm/index_pattern/static', handler: async ({ context, request }) => { const setup = await setupRequest(context, request); - await createStaticIndexPattern(setup, context); + const savedObjectsClient = await getInternalSavedObjectsClient(core); + await createStaticIndexPattern(setup, context, savedObjectsClient); // send empty response regardless of outcome return undefined; diff --git a/x-pack/legacy/plugins/apm/server/routes/metrics.ts b/x-pack/plugins/apm/server/routes/metrics.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/routes/metrics.ts rename to x-pack/plugins/apm/server/routes/metrics.ts diff --git a/x-pack/legacy/plugins/apm/server/routes/security.ts b/x-pack/plugins/apm/server/routes/security.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/routes/security.ts rename to x-pack/plugins/apm/server/routes/security.ts diff --git a/x-pack/legacy/plugins/apm/server/routes/service_map.ts b/x-pack/plugins/apm/server/routes/service_map.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/routes/service_map.ts rename to x-pack/plugins/apm/server/routes/service_map.ts diff --git a/x-pack/legacy/plugins/apm/server/routes/service_nodes.ts b/x-pack/plugins/apm/server/routes/service_nodes.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/routes/service_nodes.ts rename to x-pack/plugins/apm/server/routes/service_nodes.ts diff --git a/x-pack/legacy/plugins/apm/server/routes/services.ts b/x-pack/plugins/apm/server/routes/services.ts similarity index 88% rename from x-pack/legacy/plugins/apm/server/routes/services.ts rename to x-pack/plugins/apm/server/routes/services.ts index 18777183ea1de..2d4fae9d2707a 100644 --- a/x-pack/legacy/plugins/apm/server/routes/services.ts +++ b/x-pack/plugins/apm/server/routes/services.ts @@ -5,7 +5,7 @@ */ import * as t from 'io-ts'; -import { AgentName } from '../../typings/es_schemas/ui/fields/Agent'; +import { AgentName } from '../../typings/es_schemas/ui/fields/agent'; import { createApmTelementry, storeApmServicesTelemetry @@ -18,8 +18,9 @@ import { getServiceNodeMetadata } from '../lib/services/get_service_node_metadat import { createRoute } from './create_route'; import { uiFiltersRt, rangeRt } from './default_api_types'; import { getServiceAnnotations } from '../lib/services/annotations'; +import { getInternalSavedObjectsClient } from '../lib/helpers/get_internal_saved_objects_client'; -export const servicesRoute = createRoute(() => ({ +export const servicesRoute = createRoute(core => ({ path: '/api/apm/services', params: { query: t.intersection([uiFiltersRt, rangeRt]) @@ -33,7 +34,10 @@ export const servicesRoute = createRoute(() => ({ ({ agentName }) => agentName as AgentName ); const apmTelemetry = createApmTelementry(agentNames); - storeApmServicesTelemetry(context.__LEGACY.server, apmTelemetry); + const savedObjectsClient = await getInternalSavedObjectsClient(core); + storeApmServicesTelemetry(savedObjectsClient, apmTelemetry).catch(error => { + context.logger.error(error.message); + }); return services; } diff --git a/x-pack/legacy/plugins/apm/server/routes/settings/agent_configuration.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/routes/settings/agent_configuration.ts rename to x-pack/plugins/apm/server/routes/settings/agent_configuration.ts diff --git a/x-pack/legacy/plugins/apm/server/routes/settings/apm_indices.ts b/x-pack/plugins/apm/server/routes/settings/apm_indices.ts similarity index 86% rename from x-pack/legacy/plugins/apm/server/routes/settings/apm_indices.ts rename to x-pack/plugins/apm/server/routes/settings/apm_indices.ts index a69fba52be3f0..4e71a3dc8a0c4 100644 --- a/x-pack/legacy/plugins/apm/server/routes/settings/apm_indices.ts +++ b/x-pack/plugins/apm/server/routes/settings/apm_indices.ts @@ -34,9 +34,12 @@ export const apmIndicesRoute = createRoute(() => ({ })); // save ui indices -export const saveApmIndicesRoute = createRoute(() => ({ +export const saveApmIndicesRoute = createRoute(core => ({ method: 'POST', path: '/api/apm/settings/apm-indices/save', + options: { + tags: ['access:apm', 'access:apm_write'] + }, params: { body: t.partial({ 'apm_oss.sourcemapIndices': t.string, @@ -49,6 +52,7 @@ export const saveApmIndicesRoute = createRoute(() => ({ }, handler: async ({ context, request }) => { const { body } = context.params; - return await saveApmIndices(context, body); + const savedObjectsClient = context.core.savedObjects.client; + return await saveApmIndices(savedObjectsClient, body); } })); diff --git a/x-pack/legacy/plugins/apm/server/routes/traces.ts b/x-pack/plugins/apm/server/routes/traces.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/routes/traces.ts rename to x-pack/plugins/apm/server/routes/traces.ts diff --git a/x-pack/legacy/plugins/apm/server/routes/transaction.ts b/x-pack/plugins/apm/server/routes/transaction.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/routes/transaction.ts rename to x-pack/plugins/apm/server/routes/transaction.ts diff --git a/x-pack/legacy/plugins/apm/server/routes/transaction_groups.ts b/x-pack/plugins/apm/server/routes/transaction_groups.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/routes/transaction_groups.ts rename to x-pack/plugins/apm/server/routes/transaction_groups.ts diff --git a/x-pack/legacy/plugins/apm/server/routes/typings.ts b/x-pack/plugins/apm/server/routes/typings.ts similarity index 97% rename from x-pack/legacy/plugins/apm/server/routes/typings.ts rename to x-pack/plugins/apm/server/routes/typings.ts index 9b114eba72626..3dc485630c180 100644 --- a/x-pack/legacy/plugins/apm/server/routes/typings.ts +++ b/x-pack/plugins/apm/server/routes/typings.ts @@ -14,8 +14,8 @@ import { import { PickByValue, Optional } from 'utility-types'; import { Observable } from 'rxjs'; import { Server } from 'hapi'; -import { FetchOptions } from '../../public/services/rest/callApi'; -import { APMConfig } from '../../../../../plugins/apm/server'; +import { FetchOptions } from '../../../../legacy/plugins/apm/public/services/rest/callApi'; +import { APMConfig } from '..'; export interface Params { query?: t.HasProps; diff --git a/x-pack/legacy/plugins/apm/server/routes/ui_filters.ts b/x-pack/plugins/apm/server/routes/ui_filters.ts similarity index 100% rename from x-pack/legacy/plugins/apm/server/routes/ui_filters.ts rename to x-pack/plugins/apm/server/routes/ui_filters.ts diff --git a/x-pack/plugins/apm/server/tutorial/envs/elastic_cloud.ts b/x-pack/plugins/apm/server/tutorial/envs/elastic_cloud.ts index 9c66dd299b2a5..98294dddbec41 100644 --- a/x-pack/plugins/apm/server/tutorial/envs/elastic_cloud.ts +++ b/x-pack/plugins/apm/server/tutorial/envs/elastic_cloud.ts @@ -16,7 +16,7 @@ import { createJsAgentInstructions, createGoAgentInstructions, createJavaAgentInstructions, - createDotNetAgentInstructions, + createDotNetAgentInstructions } from '../instructions/apm_agent_instructions'; import { CloudSetup } from '../../../../cloud/server'; @@ -31,7 +31,7 @@ export function createElasticCloudInstructions(cloudSetup?: CloudSetup) { instructionSets.push(getApmAgentInstructionSet(cloudSetup)); return { - instructionSets, + instructionSets }; } @@ -39,7 +39,7 @@ function getApmServerInstructionSet(cloudSetup?: CloudSetup) { const cloudId = cloudSetup?.cloudId; return { title: i18n.translate('xpack.apm.tutorial.apmServer.title', { - defaultMessage: 'APM Server', + defaultMessage: 'APM Server' }), instructionVariants: [ { @@ -50,12 +50,12 @@ function getApmServerInstructionSet(cloudSetup?: CloudSetup) { textPre: i18n.translate('xpack.apm.tutorial.elasticCloud.textPre', { defaultMessage: 'To enable the APM Server go to [the Elastic Cloud console](https://cloud.elastic.co/deployments?q={cloudId}) and enable APM in the deployment settings. Once enabled, refresh this page.', - values: { cloudId }, - }), - }, - ], - }, - ], + values: { cloudId } + }) + } + ] + } + ] }; } @@ -65,45 +65,45 @@ function getApmAgentInstructionSet(cloudSetup?: CloudSetup) { return { title: i18n.translate('xpack.apm.tutorial.elasticCloudInstructions.title', { - defaultMessage: 'APM Agents', + defaultMessage: 'APM Agents' }), instructionVariants: [ { id: INSTRUCTION_VARIANT.NODE, - instructions: createNodeAgentInstructions(apmServerUrl, secretToken), + instructions: createNodeAgentInstructions(apmServerUrl, secretToken) }, { id: INSTRUCTION_VARIANT.DJANGO, - instructions: createDjangoAgentInstructions(apmServerUrl, secretToken), + instructions: createDjangoAgentInstructions(apmServerUrl, secretToken) }, { id: INSTRUCTION_VARIANT.FLASK, - instructions: createFlaskAgentInstructions(apmServerUrl, secretToken), + instructions: createFlaskAgentInstructions(apmServerUrl, secretToken) }, { id: INSTRUCTION_VARIANT.RAILS, - instructions: createRailsAgentInstructions(apmServerUrl, secretToken), + instructions: createRailsAgentInstructions(apmServerUrl, secretToken) }, { id: INSTRUCTION_VARIANT.RACK, - instructions: createRackAgentInstructions(apmServerUrl, secretToken), + instructions: createRackAgentInstructions(apmServerUrl, secretToken) }, { id: INSTRUCTION_VARIANT.JS, - instructions: createJsAgentInstructions(apmServerUrl), + instructions: createJsAgentInstructions(apmServerUrl) }, { id: INSTRUCTION_VARIANT.GO, - instructions: createGoAgentInstructions(apmServerUrl, secretToken), + instructions: createGoAgentInstructions(apmServerUrl, secretToken) }, { id: INSTRUCTION_VARIANT.JAVA, - instructions: createJavaAgentInstructions(apmServerUrl, secretToken), + instructions: createJavaAgentInstructions(apmServerUrl, secretToken) }, { id: INSTRUCTION_VARIANT.DOTNET, - instructions: createDotNetAgentInstructions(apmServerUrl, secretToken), - }, - ], + instructions: createDotNetAgentInstructions(apmServerUrl, secretToken) + } + ] }; } diff --git a/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts b/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts index 03cd21119b30b..1f7b7c8344c1d 100644 --- a/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts +++ b/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts @@ -13,7 +13,7 @@ import { createStartServerUnix, createDownloadServerRpm, createDownloadServerDeb, - createDownloadServerOsx, + createDownloadServerOsx } from '../instructions/apm_server_instructions'; import { createNodeAgentInstructions, @@ -24,7 +24,7 @@ import { createJsAgentInstructions, createGoAgentInstructions, createJavaAgentInstructions, - createDotNetAgentInstructions, + createDotNetAgentInstructions } from '../instructions/apm_agent_instructions'; export function onPremInstructions({ @@ -32,7 +32,7 @@ export function onPremInstructions({ transactionIndices, metricsIndices, sourcemapIndices, - onboardingIndices, + onboardingIndices }: { errorIndices: string; transactionIndices: string; @@ -48,139 +48,199 @@ export function onPremInstructions({ instructionSets: [ { title: i18n.translate('xpack.apm.tutorial.apmServer.title', { - defaultMessage: 'APM Server', + defaultMessage: 'APM Server' }), callOut: { title: i18n.translate('xpack.apm.tutorial.apmServer.callOut.title', { - defaultMessage: 'Important: Updating to 7.0 or higher', + defaultMessage: 'Important: Updating to 7.0 or higher' }), - message: i18n.translate('xpack.apm.tutorial.apmServer.callOut.message', { - defaultMessage: `Please make sure your APM Server is updated to 7.0 or higher. \ - You can also migrate your 6.x data with the migration assistant found in Kibana's management section.`, - }), - iconType: 'alert', + message: i18n.translate( + 'xpack.apm.tutorial.apmServer.callOut.message', + { + defaultMessage: `Please make sure your APM Server is updated to 7.0 or higher. \ + You can also migrate your 6.x data with the migration assistant found in Kibana's management section.` + } + ), + iconType: 'alert' }, instructionVariants: [ { id: INSTRUCTION_VARIANT.OSX, - instructions: [createDownloadServerOsx(), EDIT_CONFIG, START_SERVER_UNIX], + instructions: [ + createDownloadServerOsx(), + EDIT_CONFIG, + START_SERVER_UNIX + ] }, { id: INSTRUCTION_VARIANT.DEB, - instructions: [createDownloadServerDeb(), EDIT_CONFIG, START_SERVER_UNIX_SYSV], + instructions: [ + createDownloadServerDeb(), + EDIT_CONFIG, + START_SERVER_UNIX_SYSV + ] }, { id: INSTRUCTION_VARIANT.RPM, - instructions: [createDownloadServerRpm(), EDIT_CONFIG, START_SERVER_UNIX_SYSV], + instructions: [ + createDownloadServerRpm(), + EDIT_CONFIG, + START_SERVER_UNIX_SYSV + ] }, { id: INSTRUCTION_VARIANT.WINDOWS, - instructions: createWindowsServerInstructions(), - }, + instructions: createWindowsServerInstructions() + } ], statusCheck: { - title: i18n.translate('xpack.apm.tutorial.apmServer.statusCheck.title', { - defaultMessage: 'APM Server status', - }), - text: i18n.translate('xpack.apm.tutorial.apmServer.statusCheck.text', { - defaultMessage: - 'Make sure APM Server is running before you start implementing the APM agents.', - }), - btnLabel: i18n.translate('xpack.apm.tutorial.apmServer.statusCheck.btnLabel', { - defaultMessage: 'Check APM Server status', - }), - success: i18n.translate('xpack.apm.tutorial.apmServer.statusCheck.successMessage', { - defaultMessage: 'You have correctly setup APM Server', - }), - error: i18n.translate('xpack.apm.tutorial.apmServer.statusCheck.errorMessage', { - defaultMessage: - 'No APM Server detected. Please make sure it is running and you have updated to 7.0 or higher.', - }), + title: i18n.translate( + 'xpack.apm.tutorial.apmServer.statusCheck.title', + { + defaultMessage: 'APM Server status' + } + ), + text: i18n.translate( + 'xpack.apm.tutorial.apmServer.statusCheck.text', + { + defaultMessage: + 'Make sure APM Server is running before you start implementing the APM agents.' + } + ), + btnLabel: i18n.translate( + 'xpack.apm.tutorial.apmServer.statusCheck.btnLabel', + { + defaultMessage: 'Check APM Server status' + } + ), + success: i18n.translate( + 'xpack.apm.tutorial.apmServer.statusCheck.successMessage', + { + defaultMessage: 'You have correctly setup APM Server' + } + ), + error: i18n.translate( + 'xpack.apm.tutorial.apmServer.statusCheck.errorMessage', + { + defaultMessage: + 'No APM Server detected. Please make sure it is running and you have updated to 7.0 or higher.' + } + ), esHitsCheck: { index: onboardingIndices, query: { bool: { filter: [ { term: { 'processor.event': 'onboarding' } }, - { range: { 'observer.version_major': { gte: 7 } } }, - ], - }, - }, - }, - }, + { range: { 'observer.version_major': { gte: 7 } } } + ] + } + } + } + } }, { title: i18n.translate('xpack.apm.tutorial.apmAgents.title', { - defaultMessage: 'APM Agents', + defaultMessage: 'APM Agents' }), instructionVariants: [ { id: INSTRUCTION_VARIANT.JAVA, - instructions: createJavaAgentInstructions(), + instructions: createJavaAgentInstructions() }, { id: INSTRUCTION_VARIANT.JS, - instructions: createJsAgentInstructions(), + instructions: createJsAgentInstructions() }, { id: INSTRUCTION_VARIANT.NODE, - instructions: createNodeAgentInstructions(), + instructions: createNodeAgentInstructions() }, { id: INSTRUCTION_VARIANT.DJANGO, - instructions: createDjangoAgentInstructions(), + instructions: createDjangoAgentInstructions() }, { id: INSTRUCTION_VARIANT.FLASK, - instructions: createFlaskAgentInstructions(), + instructions: createFlaskAgentInstructions() }, { id: INSTRUCTION_VARIANT.RAILS, - instructions: createRailsAgentInstructions(), + instructions: createRailsAgentInstructions() }, { id: INSTRUCTION_VARIANT.RACK, - instructions: createRackAgentInstructions(), + instructions: createRackAgentInstructions() }, { id: INSTRUCTION_VARIANT.GO, - instructions: createGoAgentInstructions(), + instructions: createGoAgentInstructions() }, { id: INSTRUCTION_VARIANT.DOTNET, - instructions: createDotNetAgentInstructions(), - }, + instructions: createDotNetAgentInstructions() + } ], statusCheck: { - title: i18n.translate('xpack.apm.tutorial.apmAgents.statusCheck.title', { - defaultMessage: 'Agent status', - }), - text: i18n.translate('xpack.apm.tutorial.apmAgents.statusCheck.text', { - defaultMessage: - 'Make sure your application is running and the agents are sending data.', - }), - btnLabel: i18n.translate('xpack.apm.tutorial.apmAgents.statusCheck.btnLabel', { - defaultMessage: 'Check agent status', - }), - success: i18n.translate('xpack.apm.tutorial.apmAgents.statusCheck.successMessage', { - defaultMessage: 'Data successfully received from one or more agents', - }), - error: i18n.translate('xpack.apm.tutorial.apmAgents.statusCheck.errorMessage', { - defaultMessage: 'No data has been received from agents yet', - }), + title: i18n.translate( + 'xpack.apm.tutorial.apmAgents.statusCheck.title', + { + defaultMessage: 'Agent status' + } + ), + text: i18n.translate( + 'xpack.apm.tutorial.apmAgents.statusCheck.text', + { + defaultMessage: + 'Make sure your application is running and the agents are sending data.' + } + ), + btnLabel: i18n.translate( + 'xpack.apm.tutorial.apmAgents.statusCheck.btnLabel', + { + defaultMessage: 'Check agent status' + } + ), + success: i18n.translate( + 'xpack.apm.tutorial.apmAgents.statusCheck.successMessage', + { + defaultMessage: + 'Data successfully received from one or more agents' + } + ), + error: i18n.translate( + 'xpack.apm.tutorial.apmAgents.statusCheck.errorMessage', + { + defaultMessage: 'No data has been received from agents yet' + } + ), esHitsCheck: { - index: [errorIndices, transactionIndices, metricsIndices, sourcemapIndices], + index: [ + errorIndices, + transactionIndices, + metricsIndices, + sourcemapIndices + ], query: { bool: { filter: [ - { terms: { 'processor.event': ['error', 'transaction', 'metric', 'sourcemap'] } }, - { range: { 'observer.version_major': { gte: 7 } } }, - ], - }, - }, - }, - }, - }, - ], + { + terms: { + 'processor.event': [ + 'error', + 'transaction', + 'metric', + 'sourcemap' + ] + } + }, + { range: { 'observer.version_major': { gte: 7 } } } + ] + } + } + } + } + } + ] }; } diff --git a/x-pack/plugins/apm/server/tutorial/index.ts b/x-pack/plugins/apm/server/tutorial/index.ts index 5399d13937179..1fbac0b6495df 100644 --- a/x-pack/plugins/apm/server/tutorial/index.ts +++ b/x-pack/plugins/apm/server/tutorial/index.ts @@ -9,17 +9,21 @@ import { onPremInstructions } from './envs/on_prem'; import { createElasticCloudInstructions } from './envs/elastic_cloud'; import apmIndexPattern from './index_pattern.json'; import { CloudSetup } from '../../../cloud/server'; -import { ArtifactsSchema, TutorialsCategory } from '../../../../../src/plugins/home/server'; +import { + ArtifactsSchema, + TutorialsCategory +} from '../../../../../src/plugins/home/server'; const apmIntro = i18n.translate('xpack.apm.tutorial.introduction', { - defaultMessage: 'Collect in-depth performance metrics and errors from inside your applications.', + defaultMessage: + 'Collect in-depth performance metrics and errors from inside your applications.' }); export const tutorialProvider = ({ isEnabled, indexPatternTitle, cloud, - indices, + indices }: { isEnabled: boolean; indexPatternTitle: string; @@ -37,9 +41,9 @@ export const tutorialProvider = ({ ...apmIndexPattern, attributes: { ...apmIndexPattern.attributes, - title: indexPatternTitle, - }, - }, + title: indexPatternTitle + } + } ]; const artifacts: ArtifactsSchema = { @@ -49,41 +53,47 @@ export const tutorialProvider = ({ linkLabel: i18n.translate( 'xpack.apm.tutorial.specProvider.artifacts.dashboards.linkLabel', { - defaultMessage: 'APM dashboard', + defaultMessage: 'APM dashboard' } ), - isOverview: true, - }, - ], + isOverview: true + } + ] }; if (isEnabled) { artifacts.application = { path: '/app/apm', - label: i18n.translate('xpack.apm.tutorial.specProvider.artifacts.application.label', { - defaultMessage: 'Launch APM', - }), + label: i18n.translate( + 'xpack.apm.tutorial.specProvider.artifacts.application.label', + { + defaultMessage: 'Launch APM' + } + ) }; } return { id: 'apm', name: i18n.translate('xpack.apm.tutorial.specProvider.name', { - defaultMessage: 'APM', + defaultMessage: 'APM' }), category: TutorialsCategory.OTHER, shortDescription: apmIntro, - longDescription: i18n.translate('xpack.apm.tutorial.specProvider.longDescription', { - defaultMessage: - 'Application Performance Monitoring (APM) collects in-depth \ + longDescription: i18n.translate( + 'xpack.apm.tutorial.specProvider.longDescription', + { + defaultMessage: + 'Application Performance Monitoring (APM) collects in-depth \ performance metrics and errors from inside your application. \ It allows you to monitor the performance of thousands of applications in real time. \ [Learn more]({learnMoreLink}).', - values: { - learnMoreLink: - '{config.docs.base_url}guide/en/apm/get-started/{config.docs.version}/index.html', - }, - }), + values: { + learnMoreLink: + '{config.docs.base_url}guide/en/apm/get-started/{config.docs.version}/index.html' + } + } + ), euiIconType: 'apmApp', artifacts, onPrem: onPremInstructions(indices), @@ -93,8 +103,9 @@ It allows you to monitor the performance of thousands of applications in real ti savedObjectsInstallMsg: i18n.translate( 'xpack.apm.tutorial.specProvider.savedObjectsInstallMsg', { - defaultMessage: 'An APM index pattern is required for some features in the APM UI.', + defaultMessage: + 'An APM index pattern is required for some features in the APM UI.' } - ), + ) }; }; diff --git a/x-pack/plugins/apm/server/tutorial/instructions/apm_agent_instructions.ts b/x-pack/plugins/apm/server/tutorial/instructions/apm_agent_instructions.ts index d1ef92df20f6f..54dab4d13845e 100644 --- a/x-pack/plugins/apm/server/tutorial/instructions/apm_agent_instructions.ts +++ b/x-pack/plugins/apm/server/tutorial/instructions/apm_agent_instructions.ts @@ -6,48 +6,56 @@ import { i18n } from '@kbn/i18n'; -export const createNodeAgentInstructions = (apmServerUrl = '', secretToken = '') => [ +export const createNodeAgentInstructions = ( + apmServerUrl = '', + secretToken = '' +) => [ { title: i18n.translate('xpack.apm.tutorial.nodeClient.install.title', { - defaultMessage: 'Install the APM agent', + defaultMessage: 'Install the APM agent' }), textPre: i18n.translate('xpack.apm.tutorial.nodeClient.install.textPre', { - defaultMessage: 'Install the APM agent for Node.js as a dependency to your application.', + defaultMessage: + 'Install the APM agent for Node.js as a dependency to your application.' }), - commands: ['npm install elastic-apm-node --save'], + commands: ['npm install elastic-apm-node --save'] }, { title: i18n.translate('xpack.apm.tutorial.nodeClient.configure.title', { - defaultMessage: 'Configure the agent', + defaultMessage: 'Configure the agent' }), textPre: i18n.translate('xpack.apm.tutorial.nodeClient.configure.textPre', { defaultMessage: 'Agents are libraries that run inside of your application process. \ APM services are created programmatically based on the `serviceName`. \ -This agent supports a vararity of frameworks but can also be used with your custom stack.', +This agent supports a vararity of frameworks but can also be used with your custom stack.' }), commands: `// ${i18n.translate( 'xpack.apm.tutorial.nodeClient.configure.commands.addThisToTheFileTopComment', { - defaultMessage: 'Add this to the VERY top of the first file loaded in your app', + defaultMessage: + 'Add this to the VERY top of the first file loaded in your app' } )} var apm = require('elastic-apm-node').start({curlyOpen} // ${i18n.translate( 'xpack.apm.tutorial.nodeClient.configure.commands.setRequiredServiceNameComment', { - defaultMessage: 'Override service name from package.json', + defaultMessage: 'Override service name from package.json' + } + )} + // ${i18n.translate( + 'xpack.apm.tutorial.nodeClient.configure.commands.allowedCharactersComment', + { + defaultMessage: 'Allowed characters: a-z, A-Z, 0-9, -, _, and space' } )} - // ${i18n.translate('xpack.apm.tutorial.nodeClient.configure.commands.allowedCharactersComment', { - defaultMessage: 'Allowed characters: a-z, A-Z, 0-9, -, _, and space', - })} serviceName: '', // ${i18n.translate( 'xpack.apm.tutorial.nodeClient.configure.commands.useIfApmRequiresTokenComment', { - defaultMessage: 'Use if APM Server requires a token', + defaultMessage: 'Use if APM Server requires a token' } )} secretToken: '${secretToken}', @@ -55,48 +63,59 @@ var apm = require('elastic-apm-node').start({curlyOpen} // ${i18n.translate( 'xpack.apm.tutorial.nodeClient.configure.commands.setCustomApmServerUrlComment', { - defaultMessage: 'Set custom APM Server URL (default: {defaultApmServerUrl})', - values: { defaultApmServerUrl: 'http://localhost:8200' }, + defaultMessage: + 'Set custom APM Server URL (default: {defaultApmServerUrl})', + values: { defaultApmServerUrl: 'http://localhost:8200' } } )} serverUrl: '${apmServerUrl}' {curlyClose})`.split('\n'), - textPost: i18n.translate('xpack.apm.tutorial.nodeClient.configure.textPost', { - defaultMessage: - 'See [the documentation]({documentationLink}) for advanced usage, including how to use with \ + textPost: i18n.translate( + 'xpack.apm.tutorial.nodeClient.configure.textPost', + { + defaultMessage: + 'See [the documentation]({documentationLink}) for advanced usage, including how to use with \ [Babel/ES Modules]({babelEsModulesLink}).', - values: { - documentationLink: '{config.docs.base_url}guide/en/apm/agent/nodejs/current/index.html', - babelEsModulesLink: - '{config.docs.base_url}guide/en/apm/agent/nodejs/current/advanced-setup.html#es-modules', - }, - }), - }, + values: { + documentationLink: + '{config.docs.base_url}guide/en/apm/agent/nodejs/current/index.html', + babelEsModulesLink: + '{config.docs.base_url}guide/en/apm/agent/nodejs/current/advanced-setup.html#es-modules' + } + } + ) + } ]; -export const createDjangoAgentInstructions = (apmServerUrl = '', secretToken = '') => [ +export const createDjangoAgentInstructions = ( + apmServerUrl = '', + secretToken = '' +) => [ { title: i18n.translate('xpack.apm.tutorial.djangoClient.install.title', { - defaultMessage: 'Install the APM agent', + defaultMessage: 'Install the APM agent' }), textPre: i18n.translate('xpack.apm.tutorial.djangoClient.install.textPre', { - defaultMessage: 'Install the APM agent for Python as a dependency.', + defaultMessage: 'Install the APM agent for Python as a dependency.' }), - commands: ['$ pip install elastic-apm'], + commands: ['$ pip install elastic-apm'] }, { title: i18n.translate('xpack.apm.tutorial.djangoClient.configure.title', { - defaultMessage: 'Configure the agent', - }), - textPre: i18n.translate('xpack.apm.tutorial.djangoClient.configure.textPre', { - defaultMessage: - 'Agents are libraries that run inside of your application process. \ -APM services are created programmatically based on the `SERVICE_NAME`.', + defaultMessage: 'Configure the agent' }), + textPre: i18n.translate( + 'xpack.apm.tutorial.djangoClient.configure.textPre', + { + defaultMessage: + 'Agents are libraries that run inside of your application process. \ +APM services are created programmatically based on the `SERVICE_NAME`.' + } + ), commands: `# ${i18n.translate( 'xpack.apm.tutorial.djangoClient.configure.commands.addAgentComment', { - defaultMessage: 'Add the agent to the installed apps', + defaultMessage: 'Add the agent to the installed apps' } )} INSTALLED_APPS = ( @@ -108,13 +127,13 @@ ELASTIC_APM = {curlyOpen} # ${i18n.translate( 'xpack.apm.tutorial.djangoClient.configure.commands.setRequiredServiceNameComment', { - defaultMessage: 'Set required service name. Allowed characters:', + defaultMessage: 'Set required service name. Allowed characters:' } )} # ${i18n.translate( 'xpack.apm.tutorial.djangoClient.configure.commands.allowedCharactersComment', { - defaultMessage: 'a-z, A-Z, 0-9, -, _, and space', + defaultMessage: 'a-z, A-Z, 0-9, -, _, and space' } )} 'SERVICE_NAME': '', @@ -122,7 +141,7 @@ ELASTIC_APM = {curlyOpen} # ${i18n.translate( 'xpack.apm.tutorial.djangoClient.configure.commands.useIfApmServerRequiresTokenComment', { - defaultMessage: 'Use if APM Server requires a token', + defaultMessage: 'Use if APM Server requires a token' } )} 'SECRET_TOKEN': '${secretToken}', @@ -130,8 +149,9 @@ ELASTIC_APM = {curlyOpen} # ${i18n.translate( 'xpack.apm.tutorial.djangoClient.configure.commands.setCustomApmServerUrlComment', { - defaultMessage: 'Set custom APM Server URL (default: {defaultApmServerUrl})', - values: { defaultApmServerUrl: 'http://localhost:8200' }, + defaultMessage: + 'Set custom APM Server URL (default: {defaultApmServerUrl})', + values: { defaultApmServerUrl: 'http://localhost:8200' } } )} 'SERVER_URL': '${apmServerUrl}', @@ -140,72 +160,90 @@ ELASTIC_APM = {curlyOpen} # ${i18n.translate( 'xpack.apm.tutorial.djangoClient.configure.commands.addTracingMiddlewareComment', { - defaultMessage: 'To send performance metrics, add our tracing middleware:', + defaultMessage: + 'To send performance metrics, add our tracing middleware:' } )} MIDDLEWARE = ( 'elasticapm.contrib.django.middleware.TracingMiddleware', #... )`.split('\n'), - textPost: i18n.translate('xpack.apm.tutorial.djangoClient.configure.textPost', { - defaultMessage: 'See the [documentation]({documentationLink}) for advanced usage.', - values: { - documentationLink: - '{config.docs.base_url}guide/en/apm/agent/python/current/django-support.html', - }, - }), - }, + textPost: i18n.translate( + 'xpack.apm.tutorial.djangoClient.configure.textPost', + { + defaultMessage: + 'See the [documentation]({documentationLink}) for advanced usage.', + values: { + documentationLink: + '{config.docs.base_url}guide/en/apm/agent/python/current/django-support.html' + } + } + ) + } ]; -export const createFlaskAgentInstructions = (apmServerUrl = '', secretToken = '') => [ +export const createFlaskAgentInstructions = ( + apmServerUrl = '', + secretToken = '' +) => [ { title: i18n.translate('xpack.apm.tutorial.flaskClient.install.title', { - defaultMessage: 'Install the APM agent', + defaultMessage: 'Install the APM agent' }), textPre: i18n.translate('xpack.apm.tutorial.flaskClient.install.textPre', { - defaultMessage: 'Install the APM agent for Python as a dependency.', + defaultMessage: 'Install the APM agent for Python as a dependency.' }), - commands: ['$ pip install elastic-apm[flask]'], + commands: ['$ pip install elastic-apm[flask]'] }, { title: i18n.translate('xpack.apm.tutorial.flaskClient.configure.title', { - defaultMessage: 'Configure the agent', - }), - textPre: i18n.translate('xpack.apm.tutorial.flaskClient.configure.textPre', { - defaultMessage: - 'Agents are libraries that run inside of your application process. \ -APM services are created programmatically based on the `SERVICE_NAME`.', + defaultMessage: 'Configure the agent' }), + textPre: i18n.translate( + 'xpack.apm.tutorial.flaskClient.configure.textPre', + { + defaultMessage: + 'Agents are libraries that run inside of your application process. \ +APM services are created programmatically based on the `SERVICE_NAME`.' + } + ), commands: `# ${i18n.translate( 'xpack.apm.tutorial.flaskClient.configure.commands.initializeUsingEnvironmentVariablesComment', { - defaultMessage: 'initialize using environment variables', + defaultMessage: 'initialize using environment variables' } )} from elasticapm.contrib.flask import ElasticAPM app = Flask(__name__) apm = ElasticAPM(app) -# ${i18n.translate('xpack.apm.tutorial.flaskClient.configure.commands.configureElasticApmComment', { - defaultMessage: "or configure to use ELASTIC_APM in your application's settings", - })} +# ${i18n.translate( + 'xpack.apm.tutorial.flaskClient.configure.commands.configureElasticApmComment', + { + defaultMessage: + "or configure to use ELASTIC_APM in your application's settings" + } + )} from elasticapm.contrib.flask import ElasticAPM app.config['ELASTIC_APM'] = {curlyOpen} # ${i18n.translate( 'xpack.apm.tutorial.flaskClient.configure.commands.setRequiredServiceNameComment', { - defaultMessage: 'Set required service name. Allowed characters:', + defaultMessage: 'Set required service name. Allowed characters:' + } + )} + # ${i18n.translate( + 'xpack.apm.tutorial.flaskClient.configure.commands.allowedCharactersComment', + { + defaultMessage: 'a-z, A-Z, 0-9, -, _, and space' } )} - # ${i18n.translate('xpack.apm.tutorial.flaskClient.configure.commands.allowedCharactersComment', { - defaultMessage: 'a-z, A-Z, 0-9, -, _, and space', - })} 'SERVICE_NAME': '', # ${i18n.translate( 'xpack.apm.tutorial.flaskClient.configure.commands.useIfApmServerRequiresTokenComment', { - defaultMessage: 'Use if APM Server requires a token', + defaultMessage: 'Use if APM Server requires a token' } )} 'SECRET_TOKEN': '${secretToken}', @@ -213,43 +251,54 @@ app.config['ELASTIC_APM'] = {curlyOpen} # ${i18n.translate( 'xpack.apm.tutorial.flaskClient.configure.commands.setCustomApmServerUrlComment', { - defaultMessage: 'Set custom APM Server URL (default: {defaultApmServerUrl})', - values: { defaultApmServerUrl: 'http://localhost:8200' }, + defaultMessage: + 'Set custom APM Server URL (default: {defaultApmServerUrl})', + values: { defaultApmServerUrl: 'http://localhost:8200' } } )} 'SERVER_URL': '${apmServerUrl}', {curlyClose} apm = ElasticAPM(app)`.split('\n'), - textPost: i18n.translate('xpack.apm.tutorial.flaskClient.configure.textPost', { - defaultMessage: 'See the [documentation]({documentationLink}) for advanced usage.', - values: { - documentationLink: - '{config.docs.base_url}guide/en/apm/agent/python/current/flask-support.html', - }, - }), - }, + textPost: i18n.translate( + 'xpack.apm.tutorial.flaskClient.configure.textPost', + { + defaultMessage: + 'See the [documentation]({documentationLink}) for advanced usage.', + values: { + documentationLink: + '{config.docs.base_url}guide/en/apm/agent/python/current/flask-support.html' + } + } + ) + } ]; -export const createRailsAgentInstructions = (apmServerUrl = '', secretToken = '') => [ +export const createRailsAgentInstructions = ( + apmServerUrl = '', + secretToken = '' +) => [ { title: i18n.translate('xpack.apm.tutorial.railsClient.install.title', { - defaultMessage: 'Install the APM agent', + defaultMessage: 'Install the APM agent' }), textPre: i18n.translate('xpack.apm.tutorial.railsClient.install.textPre', { - defaultMessage: 'Add the agent to your Gemfile.', + defaultMessage: 'Add the agent to your Gemfile.' }), - commands: [`gem 'elastic-apm'`], + commands: [`gem 'elastic-apm'`] }, { title: i18n.translate('xpack.apm.tutorial.railsClient.configure.title', { - defaultMessage: 'Configure the agent', - }), - textPre: i18n.translate('xpack.apm.tutorial.railsClient.configure.textPre', { - defaultMessage: - 'APM is automatically started when your app boots. Configure the agent, by creating the config file {configFile}', - values: { configFile: '`config/elastic_apm.yml`' }, + defaultMessage: 'Configure the agent' }), + textPre: i18n.translate( + 'xpack.apm.tutorial.railsClient.configure.textPre', + { + defaultMessage: + 'APM is automatically started when your app boots. Configure the agent, by creating the config file {configFile}', + values: { configFile: '`config/elastic_apm.yml`' } + } + ), commands: `# config/elastic_apm.yml: # Set service name - allowed characters: a-z, A-Z, 0-9, -, _ and space @@ -261,33 +310,40 @@ export const createRailsAgentInstructions = (apmServerUrl = '', secretToken = '' # Set custom APM Server URL (default: http://localhost:8200) # server_url: '${apmServerUrl || 'http://localhost:8200'}'`.split('\n'), - textPost: i18n.translate('xpack.apm.tutorial.railsClient.configure.textPost', { - defaultMessage: - 'See the [documentation]({documentationLink}) for configuration options and advanced usage.\n\n', - values: { - documentationLink: '{config.docs.base_url}guide/en/apm/agent/ruby/current/index.html', - }, - }), - }, + textPost: i18n.translate( + 'xpack.apm.tutorial.railsClient.configure.textPost', + { + defaultMessage: + 'See the [documentation]({documentationLink}) for configuration options and advanced usage.\n\n', + values: { + documentationLink: + '{config.docs.base_url}guide/en/apm/agent/ruby/current/index.html' + } + } + ) + } ]; -export const createRackAgentInstructions = (apmServerUrl = '', secretToken = '') => [ +export const createRackAgentInstructions = ( + apmServerUrl = '', + secretToken = '' +) => [ { title: i18n.translate('xpack.apm.tutorial.rackClient.install.title', { - defaultMessage: 'Install the APM agent', + defaultMessage: 'Install the APM agent' }), textPre: i18n.translate('xpack.apm.tutorial.rackClient.install.textPre', { - defaultMessage: 'Add the agent to your Gemfile.', + defaultMessage: 'Add the agent to your Gemfile.' }), - commands: [`gem 'elastic-apm'`], + commands: [`gem 'elastic-apm'`] }, { title: i18n.translate('xpack.apm.tutorial.rackClient.configure.title', { - defaultMessage: 'Configure the agent', + defaultMessage: 'Configure the agent' }), textPre: i18n.translate('xpack.apm.tutorial.rackClient.configure.textPre', { defaultMessage: - 'For Rack or a compatible framework (e.g. Sinatra), include the middleware in your app and start the agent.', + 'For Rack or a compatible framework (e.g. Sinatra), include the middleware in your app and start the agent.' }), commands: `# config.ru require 'sinatra/base' @@ -302,38 +358,45 @@ export const createRackAgentInstructions = (apmServerUrl = '', secretToken = '') app: MySinatraApp, # ${i18n.translate( 'xpack.apm.tutorial.rackClient.configure.commands.requiredComment', { - defaultMessage: 'required', + defaultMessage: 'required' } )} config_file: '' # ${i18n.translate( 'xpack.apm.tutorial.rackClient.configure.commands.optionalComment', { - defaultMessage: 'optional, defaults to config/elastic_apm.yml', + defaultMessage: 'optional, defaults to config/elastic_apm.yml' } )} ) run MySinatraApp - at_exit {curlyOpen} ElasticAPM.stop {curlyClose}`.split('\n'), + at_exit {curlyOpen} ElasticAPM.stop {curlyClose}`.split('\n') }, { title: i18n.translate('xpack.apm.tutorial.rackClient.createConfig.title', { - defaultMessage: 'Create config file', - }), - textPre: i18n.translate('xpack.apm.tutorial.rackClient.createConfig.textPre', { - defaultMessage: 'Create a config file {configFile}:', - values: { configFile: '`config/elastic_apm.yml`' }, + defaultMessage: 'Create config file' }), + textPre: i18n.translate( + 'xpack.apm.tutorial.rackClient.createConfig.textPre', + { + defaultMessage: 'Create a config file {configFile}:', + values: { configFile: '`config/elastic_apm.yml`' } + } + ), commands: `# config/elastic_apm.yml: -# ${i18n.translate('xpack.apm.tutorial.rackClient.createConfig.commands.setServiceNameComment', { - defaultMessage: 'Set service name - allowed characters: a-z, A-Z, 0-9, -, _ and space', - })} +# ${i18n.translate( + 'xpack.apm.tutorial.rackClient.createConfig.commands.setServiceNameComment', + { + defaultMessage: + 'Set service name - allowed characters: a-z, A-Z, 0-9, -, _ and space' + } + )} # ${i18n.translate( 'xpack.apm.tutorial.rackClient.createConfig.commands.defaultsToTheNameOfRackAppClassComment', { - defaultMessage: "Defaults to the name of your Rack app's class.", + defaultMessage: "Defaults to the name of your Rack app's class." } )} # service_name: 'my-service' @@ -341,7 +404,7 @@ export const createRackAgentInstructions = (apmServerUrl = '', secretToken = '') # ${i18n.translate( 'xpack.apm.tutorial.rackClient.createConfig.commands.useIfApmServerRequiresTokenComment', { - defaultMessage: 'Use if APM Server requires a token', + defaultMessage: 'Use if APM Server requires a token' } )} # secret_token: '${secretToken}' @@ -349,46 +412,63 @@ export const createRackAgentInstructions = (apmServerUrl = '', secretToken = '') # ${i18n.translate( 'xpack.apm.tutorial.rackClient.createConfig.commands.setCustomApmServerComment', { - defaultMessage: 'Set custom APM Server URL (default: {defaultServerUrl})', - values: { defaultServerUrl: 'http://localhost:8200' }, + defaultMessage: + 'Set custom APM Server URL (default: {defaultServerUrl})', + values: { defaultServerUrl: 'http://localhost:8200' } } )} # server_url: '${apmServerUrl || 'http://localhost:8200'}'`.split('\n'), - textPost: i18n.translate('xpack.apm.tutorial.rackClient.createConfig.textPost', { - defaultMessage: - 'See the [documentation]({documentationLink}) for configuration options and advanced usage.\n\n', - values: { - documentationLink: '{config.docs.base_url}guide/en/apm/agent/ruby/current/index.html', - }, - }), - }, + textPost: i18n.translate( + 'xpack.apm.tutorial.rackClient.createConfig.textPost', + { + defaultMessage: + 'See the [documentation]({documentationLink}) for configuration options and advanced usage.\n\n', + values: { + documentationLink: + '{config.docs.base_url}guide/en/apm/agent/ruby/current/index.html' + } + } + ) + } ]; export const createJsAgentInstructions = (apmServerUrl = '') => [ { - title: i18n.translate('xpack.apm.tutorial.jsClient.enableRealUserMonitoring.title', { - defaultMessage: 'Enable Real User Monitoring support in APM server', - }), - textPre: i18n.translate('xpack.apm.tutorial.jsClient.enableRealUserMonitoring.textPre', { - defaultMessage: - 'APM Server disables RUM support by default. See the [documentation]({documentationLink}) \ + title: i18n.translate( + 'xpack.apm.tutorial.jsClient.enableRealUserMonitoring.title', + { + defaultMessage: 'Enable Real User Monitoring support in APM server' + } + ), + textPre: i18n.translate( + 'xpack.apm.tutorial.jsClient.enableRealUserMonitoring.textPre', + { + defaultMessage: + 'APM Server disables RUM support by default. See the [documentation]({documentationLink}) \ for details on how to enable RUM support.', - values: { - documentationLink: - '{config.docs.base_url}guide/en/apm/server/{config.docs.version}/configuration-rum.html', - }, - }), + values: { + documentationLink: + '{config.docs.base_url}guide/en/apm/server/{config.docs.version}/configuration-rum.html' + } + } + ) }, { - title: i18n.translate('xpack.apm.tutorial.jsClient.installDependency.title', { - defaultMessage: 'Set up the Agent as a dependency', - }), - textPre: i18n.translate('xpack.apm.tutorial.jsClient.installDependency.textPre', { - defaultMessage: - 'You can install the Agent as a dependency to your application with \ + title: i18n.translate( + 'xpack.apm.tutorial.jsClient.installDependency.title', + { + defaultMessage: 'Set up the Agent as a dependency' + } + ), + textPre: i18n.translate( + 'xpack.apm.tutorial.jsClient.installDependency.textPre', + { + defaultMessage: + 'You can install the Agent as a dependency to your application with \ `npm install @elastic/apm-rum --save`.\n\n\ -The Agent can then be initialized and configured in your application like this:', - }), +The Agent can then be initialized and configured in your application like this:' + } + ), commands: `import {curlyOpen} init as initApm {curlyClose} from '@elastic/apm-rum' var apm = initApm({curlyOpen} @@ -396,7 +476,7 @@ var apm = initApm({curlyOpen} 'xpack.apm.tutorial.jsClient.installDependency.commands.setRequiredServiceNameComment', { defaultMessage: - 'Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space)', + 'Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space)' } )} serviceName: 'your-app-name', @@ -404,8 +484,9 @@ var apm = initApm({curlyOpen} // ${i18n.translate( 'xpack.apm.tutorial.jsClient.installDependency.commands.setCustomApmServerUrlComment', { - defaultMessage: 'Set custom APM Server URL (default: {defaultApmServerUrl})', - values: { defaultApmServerUrl: 'http://localhost:8200' }, + defaultMessage: + 'Set custom APM Server URL (default: {defaultApmServerUrl})', + values: { defaultApmServerUrl: 'http://localhost:8200' } } )} serverUrl: '${apmServerUrl}', @@ -413,24 +494,27 @@ var apm = initApm({curlyOpen} // ${i18n.translate( 'xpack.apm.tutorial.jsClient.installDependency.commands.setServiceVersionComment', { - defaultMessage: 'Set service version (required for source map feature)', + defaultMessage: 'Set service version (required for source map feature)' } )} serviceVersion: '' {curlyClose})`.split('\n'), - textPost: i18n.translate('xpack.apm.tutorial.jsClient.installDependency.textPost', { - defaultMessage: - 'Framework integrations, like React or Angular, have custom dependencies. \ + textPost: i18n.translate( + 'xpack.apm.tutorial.jsClient.installDependency.textPost', + { + defaultMessage: + 'Framework integrations, like React or Angular, have custom dependencies. \ See the [integration documentation]({docLink}) for more information.', - values: { - docLink: - '{config.docs.base_url}guide/en/apm/agent/rum-js/{config.docs.version}/framework-integrations.html', - }, - }), + values: { + docLink: + '{config.docs.base_url}guide/en/apm/agent/rum-js/{config.docs.version}/framework-integrations.html' + } + } + ) }, { title: i18n.translate('xpack.apm.tutorial.jsClient.scriptTags.title', { - defaultMessage: 'Set up the Agent with Script Tags', + defaultMessage: 'Set up the Agent with Script Tags' }), textPre: i18n.translate('xpack.apm.tutorial.jsClient.scriptTags.textPre', { defaultMessage: @@ -439,9 +523,11 @@ Add a ` @@ -451,72 +537,91 @@ and host the file on your Server/CDN before deploying to production.", serverUrl: 'http://localhost:8200', {curlyClose}) -`.split('\n'), - }, +`.split('\n') + } ]; -export const createGoAgentInstructions = (apmServerUrl = '', secretToken = '') => [ +export const createGoAgentInstructions = ( + apmServerUrl = '', + secretToken = '' +) => [ { title: i18n.translate('xpack.apm.tutorial.goClient.install.title', { - defaultMessage: 'Install the APM agent', + defaultMessage: 'Install the APM agent' }), textPre: i18n.translate('xpack.apm.tutorial.goClient.install.textPre', { - defaultMessage: 'Install the APM agent packages for Go.', + defaultMessage: 'Install the APM agent packages for Go.' }), - commands: ['go get go.elastic.co/apm'], + commands: ['go get go.elastic.co/apm'] }, { title: i18n.translate('xpack.apm.tutorial.goClient.configure.title', { - defaultMessage: 'Configure the agent', + defaultMessage: 'Configure the agent' }), textPre: i18n.translate('xpack.apm.tutorial.goClient.configure.textPre', { defaultMessage: 'Agents are libraries that run inside of your application process. \ APM services are created programmatically based on the executable \ -file name, or the `ELASTIC_APM_SERVICE_NAME` environment variable.', +file name, or the `ELASTIC_APM_SERVICE_NAME` environment variable.' }), commands: `# ${i18n.translate( 'xpack.apm.tutorial.goClient.configure.commands.initializeUsingEnvironmentVariablesComment', { - defaultMessage: 'Initialize using environment variables:', + defaultMessage: 'Initialize using environment variables:' } )} -# ${i18n.translate('xpack.apm.tutorial.goClient.configure.commands.setServiceNameComment', { - defaultMessage: 'Set the service name. Allowed characters: # a-z, A-Z, 0-9, -, _, and space.', - })} -# ${i18n.translate('xpack.apm.tutorial.goClient.configure.commands.usedExecutableNameComment', { - defaultMessage: - 'If ELASTIC_APM_SERVICE_NAME is not specified, the executable name will be used.', - })} +# ${i18n.translate( + 'xpack.apm.tutorial.goClient.configure.commands.setServiceNameComment', + { + defaultMessage: + 'Set the service name. Allowed characters: # a-z, A-Z, 0-9, -, _, and space.' + } + )} +# ${i18n.translate( + 'xpack.apm.tutorial.goClient.configure.commands.usedExecutableNameComment', + { + defaultMessage: + 'If ELASTIC_APM_SERVICE_NAME is not specified, the executable name will be used.' + } + )} export ELASTIC_APM_SERVICE_NAME= -# ${i18n.translate('xpack.apm.tutorial.goClient.configure.commands.setCustomApmServerUrlComment', { - defaultMessage: 'Set custom APM Server URL (default: {defaultApmServerUrl})', - values: { defaultApmServerUrl: 'http://localhost:8200' }, - })} +# ${i18n.translate( + 'xpack.apm.tutorial.goClient.configure.commands.setCustomApmServerUrlComment', + { + defaultMessage: + 'Set custom APM Server URL (default: {defaultApmServerUrl})', + values: { defaultApmServerUrl: 'http://localhost:8200' } + } + )} export ELASTIC_APM_SERVER_URL=${apmServerUrl} -# ${i18n.translate('xpack.apm.tutorial.goClient.configure.commands.useIfApmRequiresTokenComment', { - defaultMessage: 'Use if APM Server requires a token', - })} +# ${i18n.translate( + 'xpack.apm.tutorial.goClient.configure.commands.useIfApmRequiresTokenComment', + { + defaultMessage: 'Use if APM Server requires a token' + } + )} export ELASTIC_APM_SECRET_TOKEN=${secretToken} `.split('\n'), textPost: i18n.translate('xpack.apm.tutorial.goClient.configure.textPost', { - defaultMessage: 'See the [documentation]({documentationLink}) for advanced configuration.', + defaultMessage: + 'See the [documentation]({documentationLink}) for advanced configuration.', values: { - documentationLink: '{config.docs.base_url}guide/en/apm/agent/go/current/configuration.html', - }, - }), + documentationLink: + '{config.docs.base_url}guide/en/apm/agent/go/current/configuration.html' + } + }) }, { title: i18n.translate('xpack.apm.tutorial.goClient.instrument.title', { - defaultMessage: 'Instrument your application', + defaultMessage: 'Instrument your application' }), textPre: i18n.translate('xpack.apm.tutorial.goClient.instrument.textPre', { defaultMessage: 'Instrument your Go application by using one of the provided instrumentation modules or \ -by using the tracer API directly.', +by using the tracer API directly.' }), commands: `\ import ( @@ -531,93 +636,125 @@ func main() {curlyOpen} http.ListenAndServe(":8080", apmhttp.Wrap(mux)) {curlyClose} `.split('\n'), - textPost: i18n.translate('xpack.apm.tutorial.goClient.instrument.textPost', { - defaultMessage: - 'See the [documentation]({documentationLink}) for a detailed \ + textPost: i18n.translate( + 'xpack.apm.tutorial.goClient.instrument.textPost', + { + defaultMessage: + 'See the [documentation]({documentationLink}) for a detailed \ guide to instrumenting Go source code.', - values: { - documentationLink: - '{config.docs.base_url}guide/en/apm/agent/go/current/instrumenting-source.html', - }, - }), - }, + values: { + documentationLink: + '{config.docs.base_url}guide/en/apm/agent/go/current/instrumenting-source.html' + } + } + ) + } ]; -export const createJavaAgentInstructions = (apmServerUrl = '', secretToken = '') => [ +export const createJavaAgentInstructions = ( + apmServerUrl = '', + secretToken = '' +) => [ { title: i18n.translate('xpack.apm.tutorial.javaClient.download.title', { - defaultMessage: 'Download the APM agent', + defaultMessage: 'Download the APM agent' }), textPre: i18n.translate('xpack.apm.tutorial.javaClient.download.textPre', { defaultMessage: 'Download the agent jar from [Maven Central]({mavenCentralLink}). \ Do **not** add the agent as a dependency to your application.', values: { - mavenCentralLink: 'http://search.maven.org/#search%7Cga%7C1%7Ca%3Aelastic-apm-agent', - }, - }), + mavenCentralLink: + 'http://search.maven.org/#search%7Cga%7C1%7Ca%3Aelastic-apm-agent' + } + }) }, { - title: i18n.translate('xpack.apm.tutorial.javaClient.startApplication.title', { - defaultMessage: 'Start your application with the javaagent flag', - }), - textPre: i18n.translate('xpack.apm.tutorial.javaClient.startApplication.textPre', { - defaultMessage: - 'Add the `-javaagent` flag and configure the agent with system properties.\n\n \ + title: i18n.translate( + 'xpack.apm.tutorial.javaClient.startApplication.title', + { + defaultMessage: 'Start your application with the javaagent flag' + } + ), + textPre: i18n.translate( + 'xpack.apm.tutorial.javaClient.startApplication.textPre', + { + defaultMessage: + 'Add the `-javaagent` flag and configure the agent with system properties.\n\n \ * Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space)\n \ * Set custom APM Server URL (default: {customApmServerUrl})\n \ * Set the base package of your application', - values: { customApmServerUrl: 'http://localhost:8200' }, - }), + values: { customApmServerUrl: 'http://localhost:8200' } + } + ), commands: `java -javaagent:/path/to/elastic-apm-agent-.jar \\ -Delastic.apm.service_name=my-application \\ -Delastic.apm.server_url=${apmServerUrl || 'http://localhost:8200'} \\ -Delastic.apm.secret_token=${secretToken} \\ -Delastic.apm.application_packages=org.example \\ -jar my-application.jar`.split('\n'), - textPost: i18n.translate('xpack.apm.tutorial.javaClient.startApplication.textPost', { - defaultMessage: - 'See the [documentation]({documentationLink}) for configuration options and advanced \ + textPost: i18n.translate( + 'xpack.apm.tutorial.javaClient.startApplication.textPost', + { + defaultMessage: + 'See the [documentation]({documentationLink}) for configuration options and advanced \ usage.', - values: { - documentationLink: '{config.docs.base_url}guide/en/apm/agent/java/current/index.html', - }, - }), - }, + values: { + documentationLink: + '{config.docs.base_url}guide/en/apm/agent/java/current/index.html' + } + } + ) + } ]; -export const createDotNetAgentInstructions = (apmServerUrl = '', secretToken = '') => [ +export const createDotNetAgentInstructions = ( + apmServerUrl = '', + secretToken = '' +) => [ { title: i18n.translate('xpack.apm.tutorial.dotNetClient.download.title', { - defaultMessage: 'Download the APM agent', + defaultMessage: 'Download the APM agent' }), - textPre: i18n.translate('xpack.apm.tutorial.dotNetClient.download.textPre', { - defaultMessage: - 'Add the the agent package(s) from [NuGet]({allNuGetPackagesLink}) to your .NET application. There are multiple \ + textPre: i18n.translate( + 'xpack.apm.tutorial.dotNetClient.download.textPre', + { + defaultMessage: + 'Add the the agent package(s) from [NuGet]({allNuGetPackagesLink}) to your .NET application. There are multiple \ NuGet packages available for different use cases. \n\nFor an ASP.NET Core application with Entity Framework \ Core download the [Elastic.Apm.NetCoreAll]({netCoreAllApmPackageLink}) package. This package will automatically add every \ agent component to your application. \n\n In case you would like to to minimize the dependencies, you can use the \ [Elastic.Apm.AspNetCore]({aspNetCorePackageLink}) package for just \ ASP.NET Core monitoring or the [Elastic.Apm.EfCore]({efCorePackageLink}) package for just Entity Framework Core monitoring. \n\n \ In case you only want to use the public Agent API for manual instrumentation use the [Elastic.Apm]({elasticApmPackageLink}) package.', - values: { - allNuGetPackagesLink: 'https://www.nuget.org/packages?q=Elastic.apm', - netCoreAllApmPackageLink: 'https://www.nuget.org/packages/Elastic.Apm.NetCoreAll', - aspNetCorePackageLink: 'https://www.nuget.org/packages/Elastic.Apm.AspNetCore', - efCorePackageLink: 'https://www.nuget.org/packages/Elastic.Apm.EntityFrameworkCore', - elasticApmPackageLink: 'https://www.nuget.org/packages/Elastic.Apm', - }, - }), + values: { + allNuGetPackagesLink: 'https://www.nuget.org/packages?q=Elastic.apm', + netCoreAllApmPackageLink: + 'https://www.nuget.org/packages/Elastic.Apm.NetCoreAll', + aspNetCorePackageLink: + 'https://www.nuget.org/packages/Elastic.Apm.AspNetCore', + efCorePackageLink: + 'https://www.nuget.org/packages/Elastic.Apm.EntityFrameworkCore', + elasticApmPackageLink: 'https://www.nuget.org/packages/Elastic.Apm' + } + } + ) }, { - title: i18n.translate('xpack.apm.tutorial.dotNetClient.configureApplication.title', { - defaultMessage: 'Add the agent to the application', - }), - textPre: i18n.translate('xpack.apm.tutorial.dotNetClient.configureApplication.textPre', { - defaultMessage: - 'In case of ASP.NET Core with the `Elastic.Apm.NetCoreAll` package, call the `UseAllElasticApm` \ - method in the `Configure` method within the `Startup.cs` file.', - }), + title: i18n.translate( + 'xpack.apm.tutorial.dotNetClient.configureApplication.title', + { + defaultMessage: 'Add the agent to the application' + } + ), + textPre: i18n.translate( + 'xpack.apm.tutorial.dotNetClient.configureApplication.textPre', + { + defaultMessage: + 'In case of ASP.NET Core with the `Elastic.Apm.NetCoreAll` package, call the `UseAllElasticApm` \ + method in the `Configure` method within the `Startup.cs` file.' + } + ), commands: `public class Startup {curlyOpen} public void Configure(IApplicationBuilder app, IHostingEnvironment env) @@ -627,16 +764,22 @@ export const createDotNetAgentInstructions = (apmServerUrl = '', secretToken = ' {curlyClose} //…rest of the class {curlyClose}`.split('\n'), - textPost: i18n.translate('xpack.apm.tutorial.dotNetClient.configureApplication.textPost', { - defaultMessage: - 'Passing an `IConfiguration` instance is optional and by doing so, the agent will read config settings through this \ - `IConfiguration` instance (e.g. from the `appsettings.json` file).', - }), + textPost: i18n.translate( + 'xpack.apm.tutorial.dotNetClient.configureApplication.textPost', + { + defaultMessage: + 'Passing an `IConfiguration` instance is optional and by doing so, the agent will read config settings through this \ + `IConfiguration` instance (e.g. from the `appsettings.json` file).' + } + ) }, { - title: i18n.translate('xpack.apm.tutorial.dotNetClient.configureAgent.title', { - defaultMessage: 'Sample appsettings.json file:', - }), + title: i18n.translate( + 'xpack.apm.tutorial.dotNetClient.configureAgent.title', + { + defaultMessage: 'Sample appsettings.json file:' + } + ), commands: `{curlyOpen} "ElasticApm": {curlyOpen} "SecretToken": "${secretToken}", @@ -645,15 +788,18 @@ export const createDotNetAgentInstructions = (apmServerUrl = '', secretToken = ' "ServiceName" : "MyApp", //allowed characters: a-z, A-Z, 0-9, -, _, and space. Default is the entry assembly of the application {curlyClose} {curlyClose}`.split('\n'), - textPost: i18n.translate('xpack.apm.tutorial.dotNetClient.configureAgent.textPost', { - defaultMessage: - 'In case you don’t pass an `IConfiguration` instance to the agent (e.g. in case of non ASP.NET Core applications) \ + textPost: i18n.translate( + 'xpack.apm.tutorial.dotNetClient.configureAgent.textPost', + { + defaultMessage: + 'In case you don’t pass an `IConfiguration` instance to the agent (e.g. in case of non ASP.NET Core applications) \ you can also configure the agent through environment variables. \n \ See [the documentation]({documentationLink}) for advanced usage.', - values: { - documentationLink: - '{config.docs.base_url}guide/en/apm/agent/dotnet/current/configuration.html', - }, - }), - }, + values: { + documentationLink: + '{config.docs.base_url}guide/en/apm/agent/dotnet/current/configuration.html' + } + } + ) + } ]; diff --git a/x-pack/plugins/apm/server/tutorial/instructions/apm_server_instructions.ts b/x-pack/plugins/apm/server/tutorial/instructions/apm_server_instructions.ts index 991c37c9759a9..371c3928802ae 100644 --- a/x-pack/plugins/apm/server/tutorial/instructions/apm_server_instructions.ts +++ b/x-pack/plugins/apm/server/tutorial/instructions/apm_server_instructions.ts @@ -8,29 +8,29 @@ import { i18n } from '@kbn/i18n'; export const createEditConfig = () => ({ title: i18n.translate('xpack.apm.tutorial.editConfig.title', { - defaultMessage: 'Edit the configuration', + defaultMessage: 'Edit the configuration' }), textPre: i18n.translate('xpack.apm.tutorial.editConfig.textPre', { defaultMessage: "If you're using an X-Pack secured version of Elastic Stack, you must specify \ -credentials in the `apm-server.yml` config file.", +credentials in the `apm-server.yml` config file." }), commands: [ 'output.elasticsearch:', ' hosts: [""]', ' username: ', - ' password: ', - ], + ' password: ' + ] }); const createStartServer = () => ({ title: i18n.translate('xpack.apm.tutorial.startServer.title', { - defaultMessage: 'Start APM Server', + defaultMessage: 'Start APM Server' }), textPre: i18n.translate('xpack.apm.tutorial.startServer.textPre', { defaultMessage: - 'The server processes and stores application performance metrics in Elasticsearch.', - }), + 'The server processes and stores application performance metrics in Elasticsearch.' + }) }); export function createStartServerUnixSysv() { @@ -39,7 +39,7 @@ export function createStartServerUnixSysv() { return { title: START_SERVER.title, textPre: START_SERVER.textPre, - commands: ['service apm-server start'], + commands: ['service apm-server start'] }; } @@ -49,13 +49,13 @@ export function createStartServerUnix() { return { title: START_SERVER.title, textPre: START_SERVER.textPre, - commands: ['./apm-server -e'], + commands: ['./apm-server -e'] }; } const createDownloadServerTitle = () => i18n.translate('xpack.apm.tutorial.downloadServer.title', { - defaultMessage: 'Download and unpack APM Server', + defaultMessage: 'Download and unpack APM Server' }); export const createDownloadServerOsx = () => ({ @@ -63,32 +63,38 @@ export const createDownloadServerOsx = () => ({ commands: [ 'curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-{config.kibana.version}-darwin-x86_64.tar.gz', 'tar xzvf apm-server-{config.kibana.version}-darwin-x86_64.tar.gz', - 'cd apm-server-{config.kibana.version}-darwin-x86_64/', - ], + 'cd apm-server-{config.kibana.version}-darwin-x86_64/' + ] }); export const createDownloadServerDeb = () => ({ title: createDownloadServerTitle(), commands: [ 'curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-{config.kibana.version}-amd64.deb', - 'sudo dpkg -i apm-server-{config.kibana.version}-amd64.deb', + 'sudo dpkg -i apm-server-{config.kibana.version}-amd64.deb' ], textPost: i18n.translate('xpack.apm.tutorial.downloadServerTitle', { - defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({downloadPageLink}).', - values: { downloadPageLink: '{config.docs.base_url}downloads/apm/apm-server' }, - }), + defaultMessage: + 'Looking for the 32-bit packages? See the [Download page]({downloadPageLink}).', + values: { + downloadPageLink: '{config.docs.base_url}downloads/apm/apm-server' + } + }) }); export const createDownloadServerRpm = () => ({ title: createDownloadServerTitle(), commands: [ 'curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-{config.kibana.version}-x86_64.rpm', - 'sudo rpm -vi apm-server-{config.kibana.version}-x86_64.rpm', + 'sudo rpm -vi apm-server-{config.kibana.version}-x86_64.rpm' ], textPost: i18n.translate('xpack.apm.tutorial.downloadServerRpm', { - defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({downloadPageLink}).', - values: { downloadPageLink: '{config.docs.base_url}downloads/apm/apm-server' }, - }), + defaultMessage: + 'Looking for the 32-bit packages? See the [Download page]({downloadPageLink}).', + values: { + downloadPageLink: '{config.docs.base_url}downloads/apm/apm-server' + } + }) }); export function createWindowsServerInstructions() { @@ -97,38 +103,47 @@ export function createWindowsServerInstructions() { return [ { title: createDownloadServerTitle(), - textPre: i18n.translate('xpack.apm.tutorial.windowsServerInstructions.textPre', { - defaultMessage: - '1. Download the APM Server Windows zip file from the \ + textPre: i18n.translate( + 'xpack.apm.tutorial.windowsServerInstructions.textPre', + { + defaultMessage: + '1. Download the APM Server Windows zip file from the \ [Download page]({downloadPageLink}).\n2. Extract the contents of \ the zip file into {zipFileExtractFolder}.\n3. Rename the {apmServerDirectory} \ directory to `APM-Server`.\n4. Open a PowerShell prompt as an Administrator \ (right-click the PowerShell icon and select \ **Run As Administrator**). If you are running Windows XP, you might need to download and install \ PowerShell.\n5. From the PowerShell prompt, run the following commands to install APM Server as a Windows service:', - values: { - downloadPageLink: 'https://www.elastic.co/downloads/apm/apm-server', - zipFileExtractFolder: '`C:\\Program Files`', - apmServerDirectory: '`apm-server-{config.kibana.version}-windows`', - }, - }), - commands: [`cd 'C:\\Program Files\\APM-Server'`, `.\\install-service-apm-server.ps1`], - textPost: i18n.translate('xpack.apm.tutorial.windowsServerInstructions.textPost', { - defaultMessage: - 'Note: If script execution is disabled on your system, \ + values: { + downloadPageLink: 'https://www.elastic.co/downloads/apm/apm-server', + zipFileExtractFolder: '`C:\\Program Files`', + apmServerDirectory: '`apm-server-{config.kibana.version}-windows`' + } + } + ), + commands: [ + `cd 'C:\\Program Files\\APM-Server'`, + `.\\install-service-apm-server.ps1` + ], + textPost: i18n.translate( + 'xpack.apm.tutorial.windowsServerInstructions.textPost', + { + defaultMessage: + 'Note: If script execution is disabled on your system, \ you need to set the execution policy for the current session \ to allow the script to run. For example: {command}.', - values: { - command: - '`PowerShell.exe -ExecutionPolicy UnRestricted -File .\\install-service-apm-server.ps1`', - }, - }), + values: { + command: + '`PowerShell.exe -ExecutionPolicy UnRestricted -File .\\install-service-apm-server.ps1`' + } + } + ) }, createEditConfig(), { title: START_SERVER.title, textPre: START_SERVER.textPre, - commands: ['Start-Service apm-server'], - }, + commands: ['Start-Service apm-server'] + } ]; } diff --git a/x-pack/plugins/apm/tsconfig.json b/x-pack/plugins/apm/tsconfig.json new file mode 100644 index 0000000000000..618c6c3e97b57 --- /dev/null +++ b/x-pack/plugins/apm/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.json" +} diff --git a/x-pack/legacy/plugins/apm/typings/apm-rum-react.d.ts b/x-pack/plugins/apm/typings/apm_rum_react.d.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/apm-rum-react.d.ts rename to x-pack/plugins/apm/typings/apm_rum_react.d.ts diff --git a/x-pack/legacy/plugins/apm/typings/common.d.ts b/x-pack/plugins/apm/typings/common.d.ts similarity index 78% rename from x-pack/legacy/plugins/apm/typings/common.d.ts rename to x-pack/plugins/apm/typings/common.d.ts index 1e718f818246c..bdd2c75f161e9 100644 --- a/x-pack/legacy/plugins/apm/typings/common.d.ts +++ b/x-pack/plugins/apm/typings/common.d.ts @@ -4,12 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import '../../infra/types/rison_node'; -import '../../infra/types/eui'; +import '../../../legacy/plugins/infra/types/rison_node'; +import '../../../legacy/plugins/infra/types/eui'; // EUIBasicTable -import {} from '../../reporting/public/components/report_listing'; +import '../../../legacy/plugins/reporting/public/components/report_listing'; // .svg -import '../../canvas/types/webpack'; +import '../../../legacy/plugins/canvas/types/webpack'; // Allow unknown properties in an object export type AllowUnknownProperties = T extends Array diff --git a/x-pack/legacy/plugins/apm/typings/cytoscape-dagre.d.ts b/x-pack/plugins/apm/typings/cytoscape_dagre.d.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/cytoscape-dagre.d.ts rename to x-pack/plugins/apm/typings/cytoscape_dagre.d.ts diff --git a/x-pack/plugins/apm/typings/elasticsearch/aggregations.ts b/x-pack/plugins/apm/typings/elasticsearch/aggregations.ts index 2ee8df7b5d1e1..6d3620f11a87b 100644 --- a/x-pack/plugins/apm/typings/elasticsearch/aggregations.ts +++ b/x-pack/plugins/apm/typings/elasticsearch/aggregations.ts @@ -147,13 +147,19 @@ type BucketSubAggregationResponse< ? AggregationResponseMap : {}; -interface AggregationResponsePart { +interface AggregationResponsePart< + TAggregationOptionsMap extends AggregationOptionsMap, + TDocument +> { terms: { buckets: Array< { doc_count: number; key: string | number; - } & BucketSubAggregationResponse + } & BucketSubAggregationResponse< + TAggregationOptionsMap['aggs'], + TDocument + > >; }; histogram: { @@ -161,7 +167,10 @@ interface AggregationResponsePart + } & BucketSubAggregationResponse< + TAggregationOptionsMap['aggs'], + TDocument + > >; }; date_histogram: { @@ -170,7 +179,10 @@ interface AggregationResponsePart + } & BucketSubAggregationResponse< + TAggregationOptionsMap['aggs'], + TDocument + > >; }; avg: MetricsAggregationResponsePart; @@ -215,7 +227,10 @@ interface AggregationResponsePart; filters: TAggregationOptionsMap extends { filters: { filters: any[] } } ? Array< - { doc_count: number } & AggregationResponseMap + { doc_count: number } & AggregationResponseMap< + TAggregationOptionsMap['aggs'], + TDocument + > > : TAggregationOptionsMap extends { filters: { @@ -249,7 +264,10 @@ interface AggregationResponsePart, number>; doc_count: number; - } & BucketSubAggregationResponse + } & BucketSubAggregationResponse< + TAggregationOptionsMap['aggs'], + TDocument + > >; }; diversified_sampler: { diff --git a/x-pack/plugins/apm/typings/elasticsearch/index.ts b/x-pack/plugins/apm/typings/elasticsearch/index.ts index e1d4aaeb597e2..064b684cf9aa6 100644 --- a/x-pack/plugins/apm/typings/elasticsearch/index.ts +++ b/x-pack/plugins/apm/typings/elasticsearch/index.ts @@ -31,7 +31,10 @@ export type ESSearchResponse< > = Omit, 'aggregations' | 'hits'> & (TSearchRequest extends { body: { aggs: AggregationInputMap } } ? { - aggregations?: AggregationResponseMap; + aggregations?: AggregationResponseMap< + TSearchRequest['body']['aggs'], + TDocument + >; } : {}) & { hits: Omit['hits'], 'total'> & @@ -49,6 +52,12 @@ export type ESSearchResponse< export interface ESFilter { [key: string]: { - [key: string]: string | string[] | number | boolean | Record | ESFilter[]; + [key: string]: + | string + | string[] + | number + | boolean + | Record + | ESFilter[]; }; } diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/APMBaseDoc.ts b/x-pack/plugins/apm/typings/es_schemas/raw/apm_base_doc.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/es_schemas/raw/APMBaseDoc.ts rename to x-pack/plugins/apm/typings/es_schemas/raw/apm_base_doc.ts diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/ErrorRaw.ts b/x-pack/plugins/apm/typings/es_schemas/raw/error_raw.ts similarity index 71% rename from x-pack/legacy/plugins/apm/typings/es_schemas/raw/ErrorRaw.ts rename to x-pack/plugins/apm/typings/es_schemas/raw/error_raw.ts index 2f6e857e82470..daf65e44980b6 100644 --- a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/ErrorRaw.ts +++ b/x-pack/plugins/apm/typings/es_schemas/raw/error_raw.ts @@ -4,17 +4,17 @@ * you may not use this file except in compliance with the Elastic License. */ -import { APMBaseDoc } from './APMBaseDoc'; -import { Container } from './fields/Container'; -import { Host } from './fields/Host'; -import { Http } from './fields/Http'; -import { Kubernetes } from './fields/Kubernetes'; -import { Page } from './fields/Page'; -import { Process } from './fields/Process'; -import { Service } from './fields/Service'; -import { IStackframe } from './fields/Stackframe'; -import { Url } from './fields/Url'; -import { User } from './fields/User'; +import { APMBaseDoc } from './apm_base_doc'; +import { Container } from './fields/container'; +import { Host } from './fields/host'; +import { Http } from './fields/http'; +import { Kubernetes } from './fields/kubernetes'; +import { Page } from './fields/page'; +import { Process } from './fields/process'; +import { Service } from './fields/service'; +import { IStackframe } from './fields/stackframe'; +import { Url } from './fields/url'; +import { User } from './fields/user'; interface Processor { name: 'error'; diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Container.ts b/x-pack/plugins/apm/typings/es_schemas/raw/fields/container.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Container.ts rename to x-pack/plugins/apm/typings/es_schemas/raw/fields/container.ts diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Host.ts b/x-pack/plugins/apm/typings/es_schemas/raw/fields/host.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Host.ts rename to x-pack/plugins/apm/typings/es_schemas/raw/fields/host.ts diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Http.ts b/x-pack/plugins/apm/typings/es_schemas/raw/fields/http.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Http.ts rename to x-pack/plugins/apm/typings/es_schemas/raw/fields/http.ts diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Kubernetes.ts b/x-pack/plugins/apm/typings/es_schemas/raw/fields/kubernetes.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Kubernetes.ts rename to x-pack/plugins/apm/typings/es_schemas/raw/fields/kubernetes.ts diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Page.ts b/x-pack/plugins/apm/typings/es_schemas/raw/fields/page.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Page.ts rename to x-pack/plugins/apm/typings/es_schemas/raw/fields/page.ts diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Process.ts b/x-pack/plugins/apm/typings/es_schemas/raw/fields/process.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Process.ts rename to x-pack/plugins/apm/typings/es_schemas/raw/fields/process.ts diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Service.ts b/x-pack/plugins/apm/typings/es_schemas/raw/fields/service.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Service.ts rename to x-pack/plugins/apm/typings/es_schemas/raw/fields/service.ts diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Stackframe.ts b/x-pack/plugins/apm/typings/es_schemas/raw/fields/stackframe.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Stackframe.ts rename to x-pack/plugins/apm/typings/es_schemas/raw/fields/stackframe.ts diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Url.ts b/x-pack/plugins/apm/typings/es_schemas/raw/fields/url.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Url.ts rename to x-pack/plugins/apm/typings/es_schemas/raw/fields/url.ts diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/User.ts b/x-pack/plugins/apm/typings/es_schemas/raw/fields/user.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/User.ts rename to x-pack/plugins/apm/typings/es_schemas/raw/fields/user.ts diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/UserAgent.ts b/x-pack/plugins/apm/typings/es_schemas/raw/fields/user_agent.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/UserAgent.ts rename to x-pack/plugins/apm/typings/es_schemas/raw/fields/user_agent.ts diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/SpanRaw.ts b/x-pack/plugins/apm/typings/es_schemas/raw/span_raw.ts similarity index 91% rename from x-pack/legacy/plugins/apm/typings/es_schemas/raw/SpanRaw.ts rename to x-pack/plugins/apm/typings/es_schemas/raw/span_raw.ts index 60e523f1aa043..dbd9e7ede4256 100644 --- a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/SpanRaw.ts +++ b/x-pack/plugins/apm/typings/es_schemas/raw/span_raw.ts @@ -4,8 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import { APMBaseDoc } from './APMBaseDoc'; -import { IStackframe } from './fields/Stackframe'; +import { APMBaseDoc } from './apm_base_doc'; +import { IStackframe } from './fields/stackframe'; interface Processor { name: 'transaction'; diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/TransactionRaw.ts b/x-pack/plugins/apm/typings/es_schemas/raw/transaction_raw.ts similarity index 73% rename from x-pack/legacy/plugins/apm/typings/es_schemas/raw/TransactionRaw.ts rename to x-pack/plugins/apm/typings/es_schemas/raw/transaction_raw.ts index 4dc5f8c897c26..3673f1f13c403 100644 --- a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/TransactionRaw.ts +++ b/x-pack/plugins/apm/typings/es_schemas/raw/transaction_raw.ts @@ -4,17 +4,17 @@ * you may not use this file except in compliance with the Elastic License. */ -import { APMBaseDoc } from './APMBaseDoc'; -import { Container } from './fields/Container'; -import { Host } from './fields/Host'; -import { Http } from './fields/Http'; -import { Kubernetes } from './fields/Kubernetes'; -import { Page } from './fields/Page'; -import { Process } from './fields/Process'; -import { Service } from './fields/Service'; -import { Url } from './fields/Url'; -import { User } from './fields/User'; -import { UserAgent } from './fields/UserAgent'; +import { APMBaseDoc } from './apm_base_doc'; +import { Container } from './fields/container'; +import { Host } from './fields/host'; +import { Http } from './fields/http'; +import { Kubernetes } from './fields/kubernetes'; +import { Page } from './fields/page'; +import { Process } from './fields/process'; +import { Service } from './fields/service'; +import { Url } from './fields/url'; +import { User } from './fields/user'; +import { UserAgent } from './fields/user_agent'; interface Processor { name: 'transaction'; diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/ui/APMError.ts b/x-pack/plugins/apm/typings/es_schemas/ui/apm_error.ts similarity index 78% rename from x-pack/legacy/plugins/apm/typings/es_schemas/ui/APMError.ts rename to x-pack/plugins/apm/typings/es_schemas/ui/apm_error.ts index ae4ce31ee57cf..dd7aeb003711d 100644 --- a/x-pack/legacy/plugins/apm/typings/es_schemas/ui/APMError.ts +++ b/x-pack/plugins/apm/typings/es_schemas/ui/apm_error.ts @@ -4,8 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ErrorRaw } from '../raw/ErrorRaw'; -import { Agent } from './fields/Agent'; +import { ErrorRaw } from '../raw/error_raw'; +import { Agent } from './fields/agent'; export interface APMError extends ErrorRaw { agent: Agent; diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/ui/fields/Agent.ts b/x-pack/plugins/apm/typings/es_schemas/ui/fields/agent.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/es_schemas/ui/fields/Agent.ts rename to x-pack/plugins/apm/typings/es_schemas/ui/fields/agent.ts diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/ui/Span.ts b/x-pack/plugins/apm/typings/es_schemas/ui/span.ts similarity index 78% rename from x-pack/legacy/plugins/apm/typings/es_schemas/ui/Span.ts rename to x-pack/plugins/apm/typings/es_schemas/ui/span.ts index 07149d9ac0412..b282acccac2de 100644 --- a/x-pack/legacy/plugins/apm/typings/es_schemas/ui/Span.ts +++ b/x-pack/plugins/apm/typings/es_schemas/ui/span.ts @@ -4,8 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import { SpanRaw } from '../raw/SpanRaw'; -import { Agent } from './fields/Agent'; +import { SpanRaw } from '../raw/span_raw'; +import { Agent } from './fields/agent'; export interface Span extends SpanRaw { agent: Agent; diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/ui/Transaction.ts b/x-pack/plugins/apm/typings/es_schemas/ui/transaction.ts similarity index 88% rename from x-pack/legacy/plugins/apm/typings/es_schemas/ui/Transaction.ts rename to x-pack/plugins/apm/typings/es_schemas/ui/transaction.ts index a5ce7c9f0dff3..d6d1e7695d2ab 100644 --- a/x-pack/legacy/plugins/apm/typings/es_schemas/ui/Transaction.ts +++ b/x-pack/plugins/apm/typings/es_schemas/ui/transaction.ts @@ -4,8 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import { TransactionRaw } from '../raw/TransactionRaw'; -import { Agent } from './fields/Agent'; +import { TransactionRaw } from '../raw/transaction_raw'; +import { Agent } from './fields/agent'; // Make `transaction.name` required instead of optional. // `transaction.name` can be missing in Elasticsearch but the UI will only aggregate on transactions with a name, diff --git a/x-pack/legacy/plugins/apm/typings/lodash.mean.d.ts b/x-pack/plugins/apm/typings/lodash.mean.d.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/lodash.mean.d.ts rename to x-pack/plugins/apm/typings/lodash.mean.d.ts diff --git a/x-pack/legacy/plugins/apm/typings/numeral.d.ts b/x-pack/plugins/apm/typings/numeral.d.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/numeral.d.ts rename to x-pack/plugins/apm/typings/numeral.d.ts diff --git a/x-pack/legacy/plugins/apm/typings/react-vis.d.ts b/x-pack/plugins/apm/typings/react_vis.d.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/react-vis.d.ts rename to x-pack/plugins/apm/typings/react_vis.d.ts diff --git a/x-pack/legacy/plugins/apm/typings/timeseries.ts b/x-pack/plugins/apm/typings/timeseries.ts similarity index 100% rename from x-pack/legacy/plugins/apm/typings/timeseries.ts rename to x-pack/plugins/apm/typings/timeseries.ts diff --git a/x-pack/legacy/plugins/apm/typings/ui-filters.ts b/x-pack/plugins/apm/typings/ui_filters.ts similarity index 88% rename from x-pack/legacy/plugins/apm/typings/ui-filters.ts rename to x-pack/plugins/apm/typings/ui_filters.ts index 0c62ef3b1c962..3f03e80325b49 100644 --- a/x-pack/legacy/plugins/apm/typings/ui-filters.ts +++ b/x-pack/plugins/apm/typings/ui_filters.ts @@ -4,6 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { LocalUIFilterName } from '../server/lib/ui_filters/local_ui_filters/config'; export type UIFilters = { diff --git a/x-pack/plugins/infra/server/routes/metadata/lib/has_apm_data.ts b/x-pack/plugins/infra/server/routes/metadata/lib/has_apm_data.ts index 9ca0819d74d46..1f8029db80d86 100644 --- a/x-pack/plugins/infra/server/routes/metadata/lib/has_apm_data.ts +++ b/x-pack/plugins/infra/server/routes/metadata/lib/has_apm_data.ts @@ -18,9 +18,7 @@ export const hasAPMData = async ( nodeId: string, nodeType: InventoryItemType ) => { - const apmIndices = await framework.plugins.apm.getApmIndices( - requestContext.core.savedObjects.client - ); + const apmIndices = await framework.plugins.apm.getApmIndices(); const apmIndex = apmIndices['apm_oss.transactionIndices'] || 'apm-*'; const fields = findInventoryFields(nodeType, sourceConfiguration.fields);