diff --git a/x-pack/plugins/apm/public/components/app/correlations/custom_fields.tsx b/x-pack/plugins/apm/public/components/app/correlations/custom_fields.tsx
deleted file mode 100644
index 9a13c44602c2d..0000000000000
--- a/x-pack/plugins/apm/public/components/app/correlations/custom_fields.tsx
+++ /dev/null
@@ -1,166 +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
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-
-import {
- EuiFlexGroup,
- EuiFlexItem,
- EuiAccordion,
- EuiComboBox,
- EuiFormRow,
- EuiLink,
- EuiSelect,
- EuiSpacer,
-} from '@elastic/eui';
-import { i18n } from '@kbn/i18n';
-import { FormattedMessage } from '@kbn/i18n/react';
-import React, { useEffect, useState } from 'react';
-import { useFieldNames } from './use_field_names';
-import { ElasticDocsLink } from '../../shared/Links/ElasticDocsLink';
-import { useUiTracker } from '../../../../../observability/public';
-
-interface Props {
- fieldNames: string[];
- setFieldNames: (fieldNames: string[]) => void;
- setDurationPercentile?: (value: PercentileOption) => void;
- showThreshold?: boolean;
- durationPercentile?: PercentileOption;
-}
-
-export type PercentileOption = 50 | 75 | 99;
-const percentilOptions: PercentileOption[] = [50, 75, 99];
-
-export function CustomFields({
- fieldNames,
- setFieldNames,
- setDurationPercentile = () => {},
- showThreshold = false,
- durationPercentile = 75,
-}: Props) {
- const trackApmEvent = useUiTracker({ app: 'apm' });
- const { defaultFieldNames, getSuggestions } = useFieldNames();
- const [suggestedFieldNames, setSuggestedFieldNames] = useState(
- getSuggestions('')
- );
-
- useEffect(() => {
- if (suggestedFieldNames.length) {
- return;
- }
- setSuggestedFieldNames(getSuggestions(''));
- }, [getSuggestions, suggestedFieldNames]);
-
- return (
-
-
-
- {showThreshold && (
-
-
- ({
- value: percentile,
- text: i18n.translate(
- 'xpack.apm.correlations.customize.thresholdPercentile',
- {
- defaultMessage: '{percentile}th percentile',
- values: { percentile },
- }
- ),
- }))}
- onChange={(e) => {
- setDurationPercentile(
- parseInt(e.target.value, 10) as PercentileOption
- );
- }}
- />
-
-
- )}
-
- {
- setFieldNames(defaultFieldNames);
- }}
- >
- {i18n.translate(
- 'xpack.apm.correlations.customize.fieldHelpTextReset',
- { defaultMessage: 'reset' }
- )}
-
- ),
- docsLink: (
-
- {i18n.translate(
- 'xpack.apm.correlations.customize.fieldHelpTextDocsLink',
- {
- defaultMessage:
- 'Learn more about the default fields.',
- }
- )}
-
- ),
- }}
- />
- }
- >
- ({ label }))}
- onChange={(options) => {
- const nextFieldNames = options.map((option) => option.label);
- setFieldNames(nextFieldNames);
- trackApmEvent({ metric: 'customize_correlations_fields' });
- }}
- onCreateOption={(term) => {
- const nextFieldNames = [...fieldNames, term];
- setFieldNames(nextFieldNames);
- }}
- onSearchChange={(searchValue) => {
- setSuggestedFieldNames(getSuggestions(searchValue));
- }}
- options={suggestedFieldNames.map((label) => ({ label }))}
- />
-
-
-
-
- );
-}
diff --git a/x-pack/plugins/apm/public/components/app/correlations/use_field_names.ts b/x-pack/plugins/apm/public/components/app/correlations/use_field_names.ts
deleted file mode 100644
index ff88808c51d15..0000000000000
--- a/x-pack/plugins/apm/public/components/app/correlations/use_field_names.ts
+++ /dev/null
@@ -1,74 +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
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-
-import { memoize } from 'lodash';
-import { useEffect, useMemo, useState } from 'react';
-import { isRumAgentName } from '../../../../common/agent_name';
-import { useApmServiceContext } from '../../../context/apm_service/use_apm_service_context';
-import { useDynamicIndexPatternFetcher } from '../../../hooks/use_dynamic_index_pattern';
-
-interface IndexPattern {
- fields: Array<{ name: string; esTypes: string[] }>;
-}
-
-export function useFieldNames() {
- const { agentName } = useApmServiceContext();
- const isRumAgent = isRumAgentName(agentName);
- const { indexPattern } = useDynamicIndexPatternFetcher();
-
- const [defaultFieldNames, setDefaultFieldNames] = useState(
- getDefaultFieldNames(indexPattern, isRumAgent)
- );
-
- const getSuggestions = useMemo(
- () =>
- memoize((searchValue: string) =>
- getMatchingFieldNames(indexPattern, searchValue)
- ),
- [indexPattern]
- );
-
- useEffect(() => {
- setDefaultFieldNames(getDefaultFieldNames(indexPattern, isRumAgent));
- }, [indexPattern, isRumAgent]);
-
- return { defaultFieldNames, getSuggestions };
-}
-
-function getMatchingFieldNames(
- indexPattern: IndexPattern | undefined,
- inputValue: string
-) {
- if (!indexPattern) {
- return [];
- }
- return indexPattern.fields
- .filter(
- ({ name, esTypes }) =>
- name.startsWith(inputValue) && esTypes[0] === 'keyword' // only show fields of type 'keyword'
- )
- .map(({ name }) => name);
-}
-
-function getDefaultFieldNames(
- indexPattern: IndexPattern | undefined,
- isRumAgent: boolean
-) {
- const labelFields = getMatchingFieldNames(indexPattern, 'labels.').slice(
- 0,
- 6
- );
- return isRumAgent
- ? [
- ...labelFields,
- 'user_agent.name',
- 'user_agent.os.name',
- 'url.original',
- ...getMatchingFieldNames(indexPattern, 'user.').slice(0, 6),
- ]
- : [...labelFields, 'service.version', 'service.node.name', 'host.ip'];
-}
diff --git a/x-pack/plugins/apm/server/lib/search_strategies/queries/query_histogram_interval.test.ts b/x-pack/plugins/apm/server/lib/search_strategies/queries/query_histogram_interval.test.ts
deleted file mode 100644
index e6cf926d20bd7..0000000000000
--- a/x-pack/plugins/apm/server/lib/search_strategies/queries/query_histogram_interval.test.ts
+++ /dev/null
@@ -1,111 +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
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-
-import type { estypes } from '@elastic/elasticsearch';
-
-import type { ElasticsearchClient } from 'src/core/server';
-import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values';
-
-import {
- fetchTransactionDurationHistogramInterval,
- getHistogramIntervalRequest,
-} from './query_histogram_interval';
-
-const params = {
- index: 'apm-*',
- start: '2020',
- end: '2021',
- includeFrozen: false,
- environment: ENVIRONMENT_ALL.value,
- kuery: '',
-};
-
-describe('query_histogram_interval', () => {
- describe('getHistogramIntervalRequest', () => {
- it('returns the request body for the transaction duration ranges aggregation', () => {
- const req = getHistogramIntervalRequest(params);
-
- expect(req).toEqual({
- body: {
- aggs: {
- transaction_duration_max: {
- max: {
- field: 'transaction.duration.us',
- },
- },
- transaction_duration_min: {
- min: {
- field: 'transaction.duration.us',
- },
- },
- },
- query: {
- bool: {
- filter: [
- {
- term: {
- 'processor.event': 'transaction',
- },
- },
- {
- range: {
- '@timestamp': {
- format: 'epoch_millis',
- gte: 1577836800000,
- lte: 1609459200000,
- },
- },
- },
- ],
- },
- },
- size: 0,
- },
- index: params.index,
- ignore_throttled: !params.includeFrozen,
- ignore_unavailable: true,
- });
- });
- });
-
- describe('fetchTransactionDurationHistogramInterval', () => {
- it('fetches the interval duration for histograms', async () => {
- const esClientSearchMock = jest.fn(
- (
- req: estypes.SearchRequest
- ): {
- body: estypes.SearchResponse;
- } => {
- return {
- body: {
- aggregations: {
- transaction_duration_max: {
- value: 10000,
- },
- transaction_duration_min: {
- value: 10,
- },
- },
- } as unknown as estypes.SearchResponse,
- };
- }
- );
-
- const esClientMock = {
- search: esClientSearchMock,
- } as unknown as ElasticsearchClient;
-
- const resp = await fetchTransactionDurationHistogramInterval(
- esClientMock,
- params
- );
-
- expect(resp).toEqual(10);
- expect(esClientSearchMock).toHaveBeenCalledTimes(1);
- });
- });
-});
diff --git a/x-pack/plugins/apm/server/lib/search_strategies/queries/query_histogram_interval.ts b/x-pack/plugins/apm/server/lib/search_strategies/queries/query_histogram_interval.ts
deleted file mode 100644
index 906105003b716..0000000000000
--- a/x-pack/plugins/apm/server/lib/search_strategies/queries/query_histogram_interval.ts
+++ /dev/null
@@ -1,57 +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
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-
-import type { estypes } from '@elastic/elasticsearch';
-
-import type { ElasticsearchClient } from 'src/core/server';
-
-import { TRANSACTION_DURATION } from '../../../../common/elasticsearch_fieldnames';
-import type { SearchStrategyParams } from '../../../../common/search_strategies/types';
-
-import { getQueryWithParams } from './get_query_with_params';
-import { getRequestBase } from './get_request_base';
-
-const HISTOGRAM_INTERVALS = 1000;
-
-export const getHistogramIntervalRequest = (
- params: SearchStrategyParams
-): estypes.SearchRequest => ({
- ...getRequestBase(params),
- body: {
- query: getQueryWithParams({ params }),
- size: 0,
- aggs: {
- transaction_duration_min: { min: { field: TRANSACTION_DURATION } },
- transaction_duration_max: { max: { field: TRANSACTION_DURATION } },
- },
- },
-});
-
-export const fetchTransactionDurationHistogramInterval = async (
- esClient: ElasticsearchClient,
- params: SearchStrategyParams
-): Promise => {
- const resp = await esClient.search(getHistogramIntervalRequest(params));
-
- if (resp.body.aggregations === undefined) {
- throw new Error(
- 'fetchTransactionDurationHistogramInterval failed, did not return aggregations.'
- );
- }
-
- const transactionDurationDelta =
- (
- resp.body.aggregations
- .transaction_duration_max as estypes.AggregationsValueAggregate
- ).value -
- (
- resp.body.aggregations
- .transaction_duration_min as estypes.AggregationsValueAggregate
- ).value;
-
- return transactionDurationDelta / (HISTOGRAM_INTERVALS - 1);
-};
diff --git a/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts b/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts
index b56ab83f547ff..6e03c879f9b97 100644
--- a/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts
+++ b/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts
@@ -57,17 +57,6 @@ const clientSearchMock = (
aggregations = { transaction_duration_percentiles: { values: {} } };
}
- // fetchTransactionDurationHistogramInterval
- if (
- aggs.transaction_duration_min !== undefined &&
- aggs.transaction_duration_max !== undefined
- ) {
- aggregations = {
- transaction_duration_min: { value: 0 },
- transaction_duration_max: { value: 1234 },
- };
- }
-
// fetchTransactionDurationCorrelation
if (aggs.logspace_ranges !== undefined) {
aggregations = { logspace_ranges: { buckets: [] } };
diff --git a/x-pack/plugins/apm/server/routes/correlations.ts b/x-pack/plugins/apm/server/routes/correlations.ts
deleted file mode 100644
index 4728aa2e8d3f6..0000000000000
--- a/x-pack/plugins/apm/server/routes/correlations.ts
+++ /dev/null
@@ -1,214 +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
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-
-import Boom from '@hapi/boom';
-import { i18n } from '@kbn/i18n';
-import * as t from 'io-ts';
-import { isActivePlatinumLicense } from '../../common/license_check';
-import { getCorrelationsForFailedTransactions } from '../lib/correlations/errors/get_correlations_for_failed_transactions';
-import { getOverallErrorTimeseries } from '../lib/correlations/errors/get_overall_error_timeseries';
-import { getCorrelationsForSlowTransactions } from '../lib/correlations/latency/get_correlations_for_slow_transactions';
-import { getOverallLatencyDistribution } from '../lib/correlations/latency/get_overall_latency_distribution';
-import { setupRequest } from '../lib/helpers/setup_request';
-import { createApmServerRoute } from './create_apm_server_route';
-import { createApmServerRouteRepository } from './create_apm_server_route_repository';
-import { environmentRt, kueryRt, rangeRt } from './default_api_types';
-
-const INVALID_LICENSE = i18n.translate(
- 'xpack.apm.significanTerms.license.text',
- {
- defaultMessage:
- 'To use the correlations API, you must be subscribed to an Elastic Platinum license.',
- }
-);
-
-const correlationsLatencyDistributionRoute = createApmServerRoute({
- endpoint: 'GET /api/apm/correlations/latency/overall_distribution',
- params: t.type({
- query: t.intersection([
- t.partial({
- serviceName: t.string,
- transactionName: t.string,
- transactionType: t.string,
- }),
- environmentRt,
- kueryRt,
- rangeRt,
- ]),
- }),
- options: { tags: ['access:apm'] },
- handler: async (resources) => {
- const { context, params } = resources;
- if (!isActivePlatinumLicense(context.licensing.license)) {
- throw Boom.forbidden(INVALID_LICENSE);
- }
- const setup = await setupRequest(resources);
- const {
- environment,
- kuery,
- serviceName,
- transactionType,
- transactionName,
- } = params.query;
-
- return getOverallLatencyDistribution({
- environment,
- kuery,
- serviceName,
- transactionType,
- transactionName,
- setup,
- });
- },
-});
-
-const correlationsForSlowTransactionsRoute = createApmServerRoute({
- endpoint: 'GET /api/apm/correlations/latency/slow_transactions',
- params: t.type({
- query: t.intersection([
- t.partial({
- serviceName: t.string,
- transactionName: t.string,
- transactionType: t.string,
- }),
- t.type({
- durationPercentile: t.string,
- fieldNames: t.string,
- maxLatency: t.string,
- distributionInterval: t.string,
- }),
- environmentRt,
- kueryRt,
- rangeRt,
- ]),
- }),
- options: { tags: ['access:apm'] },
- handler: async (resources) => {
- const { context, params } = resources;
-
- if (!isActivePlatinumLicense(context.licensing.license)) {
- throw Boom.forbidden(INVALID_LICENSE);
- }
- const setup = await setupRequest(resources);
- const {
- environment,
- kuery,
- serviceName,
- transactionType,
- transactionName,
- durationPercentile,
- fieldNames,
- maxLatency,
- distributionInterval,
- } = params.query;
-
- return getCorrelationsForSlowTransactions({
- environment,
- kuery,
- serviceName,
- transactionType,
- transactionName,
- durationPercentile: parseInt(durationPercentile, 10),
- fieldNames: fieldNames.split(','),
- setup,
- maxLatency: parseInt(maxLatency, 10),
- distributionInterval: parseInt(distributionInterval, 10),
- });
- },
-});
-
-const correlationsErrorDistributionRoute = createApmServerRoute({
- endpoint: 'GET /api/apm/correlations/errors/overall_timeseries',
- params: t.type({
- query: t.intersection([
- t.partial({
- serviceName: t.string,
- transactionName: t.string,
- transactionType: t.string,
- }),
- environmentRt,
- kueryRt,
- rangeRt,
- ]),
- }),
- options: { tags: ['access:apm'] },
- handler: async (resources) => {
- const { params, context } = resources;
-
- if (!isActivePlatinumLicense(context.licensing.license)) {
- throw Boom.forbidden(INVALID_LICENSE);
- }
- const setup = await setupRequest(resources);
- const {
- environment,
- kuery,
- serviceName,
- transactionType,
- transactionName,
- } = params.query;
-
- return getOverallErrorTimeseries({
- environment,
- kuery,
- serviceName,
- transactionType,
- transactionName,
- setup,
- });
- },
-});
-
-const correlationsForFailedTransactionsRoute = createApmServerRoute({
- endpoint: 'GET /api/apm/correlations/errors/failed_transactions',
- params: t.type({
- query: t.intersection([
- t.partial({
- serviceName: t.string,
- transactionName: t.string,
- transactionType: t.string,
- }),
- t.type({
- fieldNames: t.string,
- }),
- environmentRt,
- kueryRt,
- rangeRt,
- ]),
- }),
- options: { tags: ['access:apm'] },
- handler: async (resources) => {
- const { context, params } = resources;
- if (!isActivePlatinumLicense(context.licensing.license)) {
- throw Boom.forbidden(INVALID_LICENSE);
- }
- const setup = await setupRequest(resources);
- const {
- environment,
- kuery,
- serviceName,
- transactionType,
- transactionName,
- fieldNames,
- } = params.query;
-
- return getCorrelationsForFailedTransactions({
- environment,
- kuery,
- serviceName,
- transactionType,
- transactionName,
- fieldNames: fieldNames.split(','),
- setup,
- });
- },
-});
-
-export const correlationsRouteRepository = createApmServerRouteRepository()
- .add(correlationsLatencyDistributionRoute)
- .add(correlationsForSlowTransactionsRoute)
- .add(correlationsErrorDistributionRoute)
- .add(correlationsForFailedTransactionsRoute);
diff --git a/x-pack/plugins/apm/server/routes/get_global_apm_server_route_repository.ts b/x-pack/plugins/apm/server/routes/get_global_apm_server_route_repository.ts
index 9bc9108da9055..09756e30d9682 100644
--- a/x-pack/plugins/apm/server/routes/get_global_apm_server_route_repository.ts
+++ b/x-pack/plugins/apm/server/routes/get_global_apm_server_route_repository.ts
@@ -12,7 +12,6 @@ import type {
import { PickByValue } from 'utility-types';
import { alertsChartPreviewRouteRepository } from './alerts/chart_preview';
import { backendsRouteRepository } from './backends';
-import { correlationsRouteRepository } from './correlations';
import { createApmServerRouteRepository } from './create_apm_server_route_repository';
import { environmentsRouteRepository } from './environments';
import { errorsRouteRepository } from './errors';
@@ -49,7 +48,6 @@ const getTypedGlobalApmServerRouteRepository = () => {
.merge(traceRouteRepository)
.merge(transactionRouteRepository)
.merge(alertsChartPreviewRouteRepository)
- .merge(correlationsRouteRepository)
.merge(agentConfigurationRouteRepository)
.merge(anomalyDetectionRouteRepository)
.merge(apmIndicesRouteRepository)
diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index 8fd02c5dba865..b1d22a44d6273 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -6399,14 +6399,6 @@
"xpack.apm.correlations.correlationsTable.filterLabel": "フィルター",
"xpack.apm.correlations.correlationsTable.loadingText": "読み込み中",
"xpack.apm.correlations.correlationsTable.noDataText": "データなし",
- "xpack.apm.correlations.customize.buttonLabel": "フィールドのカスタマイズ",
- "xpack.apm.correlations.customize.fieldHelpText": "相関関係を分析するフィールドをカスタマイズまたは{reset}します。{docsLink}",
- "xpack.apm.correlations.customize.fieldHelpTextDocsLink": "デフォルトフィールドの詳細。",
- "xpack.apm.correlations.customize.fieldHelpTextReset": "リセット",
- "xpack.apm.correlations.customize.fieldLabel": "フィールド",
- "xpack.apm.correlations.customize.fieldPlaceholder": "オプションを選択または作成",
- "xpack.apm.correlations.customize.thresholdLabel": "しきい値",
- "xpack.apm.correlations.customize.thresholdPercentile": "{percentile}パーセンタイル",
"xpack.apm.correlations.failedTransactions.correlationsTable.fieldNameLabel": "フィールド名",
"xpack.apm.correlations.failedTransactions.correlationsTable.fieldValueLabel": "フィールド値",
"xpack.apm.correlations.failedTransactions.correlationsTable.impactLabel": "インパクト",
@@ -6960,7 +6952,6 @@
"xpack.apm.settings.unsupportedConfigs.errorToast.title": "APMサーバー設定を取り込めません",
"xpack.apm.settingsLinkLabel": "設定",
"xpack.apm.setupInstructionsButtonLabel": "セットアップの手順",
- "xpack.apm.significanTerms.license.text": "相関関係APIを使用するには、Elastic Platinumライセンスのサブスクリプションが必要です。",
"xpack.apm.stacktraceTab.causedByFramesToogleButtonLabel": "作成元",
"xpack.apm.stacktraceTab.localVariablesToogleButtonLabel": "ローカル変数",
"xpack.apm.stacktraceTab.noStacktraceAvailableLabel": "利用可能なスタックトレースがありません。",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index bd1224a8fd057..9e65bebb9fd6e 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -6450,14 +6450,6 @@
"xpack.apm.correlations.correlationsTable.filterLabel": "筛选",
"xpack.apm.correlations.correlationsTable.loadingText": "正在加载",
"xpack.apm.correlations.correlationsTable.noDataText": "无数据",
- "xpack.apm.correlations.customize.buttonLabel": "定制字段",
- "xpack.apm.correlations.customize.fieldHelpText": "定制或{reset}要针对相关性分析的字段。{docsLink}",
- "xpack.apm.correlations.customize.fieldHelpTextDocsLink": "详细了解默认字段。",
- "xpack.apm.correlations.customize.fieldHelpTextReset": "重置",
- "xpack.apm.correlations.customize.fieldLabel": "字段",
- "xpack.apm.correlations.customize.fieldPlaceholder": "选择或创建选项",
- "xpack.apm.correlations.customize.thresholdLabel": "阈值",
- "xpack.apm.correlations.customize.thresholdPercentile": "第 {percentile} 个百分位数",
"xpack.apm.correlations.failedTransactions.correlationsTable.fieldNameLabel": "字段名称",
"xpack.apm.correlations.failedTransactions.correlationsTable.fieldValueLabel": "字段值",
"xpack.apm.correlations.failedTransactions.correlationsTable.impactLabel": "影响",
@@ -7016,7 +7008,6 @@
"xpack.apm.settings.unsupportedConfigs.errorToast.title": "无法获取 APM Server 设置",
"xpack.apm.settingsLinkLabel": "设置",
"xpack.apm.setupInstructionsButtonLabel": "设置说明",
- "xpack.apm.significanTerms.license.text": "要使用相关性 API,必须订阅 Elastic 白金级许可证。",
"xpack.apm.stacktraceTab.causedByFramesToogleButtonLabel": "原因",
"xpack.apm.stacktraceTab.libraryFramesToogleButtonLabel": "{count, plural, other {# 个库帧}}",
"xpack.apm.stacktraceTab.localVariablesToogleButtonLabel": "本地变量",
diff --git a/x-pack/test/apm_api_integration/tests/correlations/errors_failed_transactions.ts b/x-pack/test/apm_api_integration/tests/correlations/errors_failed_transactions.ts
deleted file mode 100644
index b3c5302ee2c6b..0000000000000
--- a/x-pack/test/apm_api_integration/tests/correlations/errors_failed_transactions.ts
+++ /dev/null
@@ -1,83 +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
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-
-import expect from '@kbn/expect';
-import { format } from 'url';
-import { APIReturnType } from '../../../../plugins/apm/public/services/rest/createCallApmApi';
-import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata';
-import { FtrProviderContext } from '../../common/ftr_provider_context';
-import { registry } from '../../common/registry';
-
-export default function ApiTest({ getService }: FtrProviderContext) {
- const supertest = getService('legacySupertestAsApmReadUser');
- const archiveName = 'apm_8.0.0';
- const range = archives_metadata[archiveName];
-
- const url = format({
- pathname: `/api/apm/correlations/errors/failed_transactions`,
- query: {
- start: range.start,
- end: range.end,
- fieldNames: 'http.response.status_code,user_agent.name,user_agent.os.name,url.original',
- environment: 'ENVIRONMENT_ALL',
- kuery: '',
- },
- });
- registry.when(
- 'correlations errors failed transactions without data',
- { config: 'trial', archives: [] },
- () => {
- it('handles the empty state', async () => {
- const response = await supertest.get(url);
-
- expect(response.status).to.be(200);
- expect(response.body.response).to.be(undefined);
- });
- }
- );
-
- registry.when(
- 'correlations errors failed transactions with data and default args',
- { config: 'trial', archives: ['apm_8.0.0'] },
- () => {
- type ResponseBody = APIReturnType<'GET /api/apm/correlations/errors/failed_transactions'>;
- let response: {
- status: number;
- body: NonNullable;
- };
-
- before(async () => {
- response = await supertest.get(url);
- });
-
- it('returns successfully', () => {
- expect(response.status).to.eql(200);
- });
-
- it('returns significant terms', () => {
- const { significantTerms } = response.body;
- expect(significantTerms.length).to.be.greaterThan(0);
-
- const sortedFieldNames = significantTerms.map(({ fieldName }) => fieldName).sort();
- expectSnapshot(sortedFieldNames).toMatchInline(`
- Array [
- "http.response.status_code",
- ]
- `);
- });
-
- it('returns a distribution per term', () => {
- const { significantTerms } = response.body;
- expectSnapshot(significantTerms.map((term) => term.timeseries.length)).toMatchInline(`
- Array [
- 31,
- ]
- `);
- });
- }
- );
-}
diff --git a/x-pack/test/apm_api_integration/tests/correlations/errors_overall.ts b/x-pack/test/apm_api_integration/tests/correlations/errors_overall.ts
deleted file mode 100644
index f4e95816a3996..0000000000000
--- a/x-pack/test/apm_api_integration/tests/correlations/errors_overall.ts
+++ /dev/null
@@ -1,63 +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
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-
-import expect from '@kbn/expect';
-import { SupertestReturnType } from '../../common/apm_api_supertest';
-import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata';
-import { FtrProviderContext } from '../../common/ftr_provider_context';
-import { registry } from '../../common/registry';
-
-export default function ApiTest({ getService }: FtrProviderContext) {
- const apmApiClient = getService('apmApiClient');
- const archiveName = 'apm_8.0.0';
- const range = archives_metadata[archiveName];
-
- const urlConfig = {
- endpoint: `GET /api/apm/correlations/errors/overall_timeseries` as const,
- params: {
- query: {
- start: range.start,
- end: range.end,
- environment: 'ENVIRONMENT_ALL',
- kuery: '',
- },
- },
- };
-
- registry.when(
- 'correlations errors overall without data',
- { config: 'trial', archives: [] },
- () => {
- it('handles the empty state', async () => {
- const response = await apmApiClient.readUser(urlConfig);
-
- expect(response.status).to.be(200);
- expect(response.body.overall).to.be(null);
- });
- }
- );
-
- registry.when(
- 'correlations errors overall with data and default args',
- { config: 'trial', archives: ['apm_8.0.0'] },
- () => {
- let response: SupertestReturnType<'GET /api/apm/correlations/errors/overall_timeseries'>;
-
- before(async () => {
- response = await apmApiClient.readUser(urlConfig);
- });
-
- it('returns successfully', () => {
- expect(response.status).to.eql(200);
- });
-
- it('returns overall distribution', () => {
- expectSnapshot(response.body?.overall?.timeseries.length).toMatchInline(`31`);
- });
- }
- );
-}
diff --git a/x-pack/test/apm_api_integration/tests/correlations/latency_overall.ts b/x-pack/test/apm_api_integration/tests/correlations/latency_overall.ts
deleted file mode 100644
index 722a9a2bc4fb7..0000000000000
--- a/x-pack/test/apm_api_integration/tests/correlations/latency_overall.ts
+++ /dev/null
@@ -1,71 +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
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-
-import expect from '@kbn/expect';
-import { format } from 'url';
-import { APIReturnType } from '../../../../plugins/apm/public/services/rest/createCallApmApi';
-import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata';
-import { FtrProviderContext } from '../../common/ftr_provider_context';
-import { registry } from '../../common/registry';
-
-export default function ApiTest({ getService }: FtrProviderContext) {
- const supertest = getService('legacySupertestAsApmReadUser');
- const archiveName = 'apm_8.0.0';
- const range = archives_metadata[archiveName];
-
- const url = format({
- pathname: `/api/apm/correlations/latency/overall_distribution`,
- query: {
- start: range.start,
- end: range.end,
- environment: 'ENVIRONMENT_ALL',
- kuery: '',
- },
- });
-
- registry.when(
- 'correlations latency overall without data',
- { config: 'trial', archives: [] },
- () => {
- it('handles the empty state', async () => {
- const response = await supertest.get(url);
-
- expect(response.status).to.be(200);
- expect(response.body.response).to.be(undefined);
- });
- }
- );
-
- registry.when(
- 'correlations latency overall with data and default args',
- { config: 'trial', archives: ['apm_8.0.0'] },
- () => {
- type ResponseBody = APIReturnType<'GET /api/apm/correlations/latency/overall_distribution'>;
- let response: {
- status: number;
- body: NonNullable;
- };
-
- before(async () => {
- response = await supertest.get(url);
- });
-
- it('returns successfully', () => {
- expect(response.status).to.eql(200);
- });
-
- it('returns overall distribution', () => {
- // less precision for distributionInterval as it is not exact
- expectSnapshot(response.body?.distributionInterval?.toPrecision(2)).toMatchInline(
- `"3.8e+5"`
- );
- expectSnapshot(response.body?.maxLatency?.toPrecision(2)).toMatchInline(`"5.8e+6"`);
- expectSnapshot(response.body?.overallDistribution?.length).toMatchInline(`15`);
- });
- }
- );
-}
diff --git a/x-pack/test/apm_api_integration/tests/correlations/latency_slow_transactions.ts b/x-pack/test/apm_api_integration/tests/correlations/latency_slow_transactions.ts
deleted file mode 100644
index c72753a86f6a6..0000000000000
--- a/x-pack/test/apm_api_integration/tests/correlations/latency_slow_transactions.ts
+++ /dev/null
@@ -1,96 +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
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-
-import expect from '@kbn/expect';
-import { format } from 'url';
-import { APIReturnType } from '../../../../plugins/apm/public/services/rest/createCallApmApi';
-import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata';
-import { FtrProviderContext } from '../../common/ftr_provider_context';
-import { registry } from '../../common/registry';
-
-export default function ApiTest({ getService }: FtrProviderContext) {
- const supertest = getService('legacySupertestAsApmReadUser');
- const archiveName = 'apm_8.0.0';
- const range = archives_metadata[archiveName];
-
- const url = format({
- pathname: `/api/apm/correlations/latency/slow_transactions`,
- query: {
- start: range.start,
- end: range.end,
- durationPercentile: 95,
- fieldNames: 'user_agent.name,user_agent.os.name,url.original',
- maxLatency: 3581640.00000003,
- distributionInterval: 238776,
- environment: 'ENVIRONMENT_ALL',
- kuery: '',
- },
- });
- registry.when(
- 'correlations latency slow transactions without data',
- { config: 'trial', archives: [] },
- () => {
- it('handles the empty state', async () => {
- const response = await supertest.get(url);
-
- expect(response.status).to.be(200);
- expect(response.body.response).to.be(undefined);
- });
- }
- );
-
- registry.when(
- 'correlations latency slow transactions with data and default args',
- { config: 'trial', archives: ['apm_8.0.0'] },
- () => {
- type ResponseBody = APIReturnType<'GET /api/apm/correlations/latency/slow_transactions'>;
- let response: {
- status: number;
- body: NonNullable;
- };
-
- before(async () => {
- response = await supertest.get(url);
- });
-
- it('returns successfully', () => {
- expect(response.status).to.eql(200);
- });
-
- it('returns significant terms', () => {
- const { significantTerms } = response.body;
- expect(significantTerms.length).to.be.greaterThan(0);
-
- const sortedFieldNames = significantTerms.map(({ fieldName }) => fieldName).sort();
- expectSnapshot(sortedFieldNames).toMatchInline(`
- Array [
- "url.original",
- "url.original",
- "url.original",
- "user_agent.name",
- "user_agent.name",
- "user_agent.os.name",
- ]
- `);
- });
-
- it('returns a distribution per term', () => {
- const { significantTerms } = response.body;
- expectSnapshot(significantTerms.map((term) => term.distribution.length)).toMatchInline(`
- Array [
- 15,
- 15,
- 15,
- 15,
- 15,
- 15,
- ]
- `);
- });
- }
- );
-}
diff --git a/x-pack/test/apm_api_integration/tests/index.ts b/x-pack/test/apm_api_integration/tests/index.ts
index 6c989e61bc6bf..5ea5ad78d9479 100644
--- a/x-pack/test/apm_api_integration/tests/index.ts
+++ b/x-pack/test/apm_api_integration/tests/index.ts
@@ -29,10 +29,6 @@ export default function apmApiIntegrationTests(providerContext: FtrProviderConte
});
// correlations
- describe('correlations/latency_slow_transactions', function () {
- loadTestFile(require.resolve('./correlations/latency_slow_transactions'));
- });
-
describe('correlations/failed_transactions', function () {
loadTestFile(require.resolve('./correlations/failed_transactions'));
});
@@ -41,18 +37,6 @@ export default function apmApiIntegrationTests(providerContext: FtrProviderConte
loadTestFile(require.resolve('./correlations/latency'));
});
- describe('correlations/latency_overall', function () {
- loadTestFile(require.resolve('./correlations/latency_overall'));
- });
-
- describe('correlations/errors_overall', function () {
- loadTestFile(require.resolve('./correlations/errors_overall'));
- });
-
- describe('correlations/errors_failed_transactions', function () {
- loadTestFile(require.resolve('./correlations/errors_failed_transactions'));
- });
-
describe('metrics_charts/metrics_charts', function () {
loadTestFile(require.resolve('./metrics_charts/metrics_charts'));
});