From 2c5ecd9b3f6198eac9f4b1eb2913cd866988f84d Mon Sep 17 00:00:00 2001 From: Deepak Sreekumar Date: Tue, 26 Oct 2021 11:54:27 +0530 Subject: [PATCH] chore: rename functions in aggregated_transactions helper (#116001) * Renamed methods and fixed imports * Fixed lint errors * Renamed file Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../chart_preview/get_transaction_duration.ts | 25 +++++++------------ .../get_transaction_error_rate.ts | 14 ++++------- ...egister_transaction_duration_alert_type.ts | 10 ++++---- ...ister_transaction_error_rate_alert_type.ts | 4 +-- .../lib/environments/get_all_environments.ts | 6 ++--- .../lib/environments/get_environments.ts | 6 ++--- ...t_is_using_transaction_events.test.ts.snap | 0 .../get_is_using_transaction_events.test.ts | 0 .../get_is_using_transaction_events.ts | 0 .../index.ts | 6 ++--- .../get_service_count.ts | 6 ++--- .../get_transactions_per_minute.ts | 12 ++++----- .../get_service_map_service_node_info.ts | 18 ++++++------- .../get_derived_service_annotations.ts | 18 +++++-------- .../server/lib/services/get_service_agent.ts | 6 ++--- .../get_service_instance_metadata_details.ts | 12 ++++----- ...ervice_instances_transaction_statistics.ts | 22 ++++++---------- .../services/get_service_metadata_details.ts | 6 ++--- .../services/get_service_metadata_icons.ts | 6 ++--- ...e_transaction_group_detailed_statistics.ts | 16 ++++++------ .../get_service_transaction_groups.ts | 16 ++++++------ .../services/get_service_transaction_types.ts | 14 ++++------- .../get_service_transaction_stats.ts | 16 ++++++------ ...service_transaction_detailed_statistics.ts | 16 ++++++------ .../apm/server/lib/services/get_throughput.ts | 16 ++++-------- .../agent_configuration/get_service_names.ts | 6 ++--- .../server/lib/suggestions/get_suggestions.ts | 6 ++--- .../server/lib/transaction_groups/fetcher.ts | 14 ++++------- .../lib/transaction_groups/get_error_rate.ts | 16 ++++-------- .../get_transaction_group_stats.ts | 6 ++--- .../transactions/get_latency_charts/index.ts | 25 +++++++------------ .../apm/server/projections/services.ts | 6 ++--- .../plugins/apm/server/routes/environments.ts | 2 +- .../server/routes/fallback_to_transactions.ts | 2 +- .../server/routes/observability_overview.ts | 2 +- .../plugins/apm/server/routes/service_map.ts | 2 +- x-pack/plugins/apm/server/routes/services.ts | 2 +- .../routes/settings/agent_configuration.ts | 2 +- .../routes/settings/anomaly_detection.ts | 2 +- .../plugins/apm/server/routes/suggestions.ts | 2 +- x-pack/plugins/apm/server/routes/traces.ts | 2 +- .../plugins/apm/server/routes/transactions.ts | 2 +- 42 files changed, 143 insertions(+), 227 deletions(-) rename x-pack/plugins/apm/server/lib/helpers/{aggregated_transactions => transactions}/__snapshots__/get_is_using_transaction_events.test.ts.snap (100%) rename x-pack/plugins/apm/server/lib/helpers/{aggregated_transactions => transactions}/get_is_using_transaction_events.test.ts (100%) rename x-pack/plugins/apm/server/lib/helpers/{aggregated_transactions => transactions}/get_is_using_transaction_events.ts (100%) rename x-pack/plugins/apm/server/lib/helpers/{aggregated_transactions => transactions}/index.ts (92%) diff --git a/x-pack/plugins/apm/server/lib/alerts/chart_preview/get_transaction_duration.ts b/x-pack/plugins/apm/server/lib/alerts/chart_preview/get_transaction_duration.ts index 1f8b88b3db3e..1359f4b92597 100644 --- a/x-pack/plugins/apm/server/lib/alerts/chart_preview/get_transaction_duration.ts +++ b/x-pack/plugins/apm/server/lib/alerts/chart_preview/get_transaction_duration.ts @@ -14,11 +14,11 @@ import { import { environmentQuery } from '../../../../common/utils/environment_query'; import { AlertParams } from '../../../routes/alerts/chart_preview'; import { - getDocumentTypeFilterForAggregatedTransactions, - getProcessorEventForAggregatedTransactions, getSearchAggregatedTransactions, - getTransactionDurationFieldForAggregatedTransactions, -} from '../../helpers/aggregated_transactions'; + getDocumentTypeFilterForTransactions, + getTransactionDurationFieldForTransactions, + getProcessorEventForTransactions, +} from '../../helpers/transactions'; import { Setup } from '../../helpers/setup_request'; export async function getTransactionDurationChartPreview({ @@ -52,17 +52,14 @@ export async function getTransactionDurationChartPreview({ : []), ...rangeQuery(start, end), ...environmentQuery(environment), - ...getDocumentTypeFilterForAggregatedTransactions( - searchAggregatedTransactions - ), + ...getDocumentTypeFilterForTransactions(searchAggregatedTransactions), ] as QueryDslQueryContainer[], }, }; - const transactionDurationField = - getTransactionDurationFieldForAggregatedTransactions( - searchAggregatedTransactions - ); + const transactionDurationField = getTransactionDurationFieldForTransactions( + searchAggregatedTransactions + ); const aggs = { timeseries: { @@ -90,11 +87,7 @@ export async function getTransactionDurationChartPreview({ }; const params = { apm: { - events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), - ], + events: [getProcessorEventForTransactions(searchAggregatedTransactions)], }, body: { size: 0, query, aggs }, }; diff --git a/x-pack/plugins/apm/server/lib/alerts/chart_preview/get_transaction_error_rate.ts b/x-pack/plugins/apm/server/lib/alerts/chart_preview/get_transaction_error_rate.ts index 1690c92b23e6..d3f03c597e8f 100644 --- a/x-pack/plugins/apm/server/lib/alerts/chart_preview/get_transaction_error_rate.ts +++ b/x-pack/plugins/apm/server/lib/alerts/chart_preview/get_transaction_error_rate.ts @@ -13,10 +13,10 @@ import { import { environmentQuery } from '../../../../common/utils/environment_query'; import { AlertParams } from '../../../routes/alerts/chart_preview'; import { - getDocumentTypeFilterForAggregatedTransactions, - getProcessorEventForAggregatedTransactions, getSearchAggregatedTransactions, -} from '../../helpers/aggregated_transactions'; + getDocumentTypeFilterForTransactions, + getProcessorEventForTransactions, +} from '../../helpers/transactions'; import { Setup } from '../../helpers/setup_request'; import { calculateFailedTransactionRate, @@ -45,11 +45,7 @@ export async function getTransactionErrorRateChartPreview({ const params = { apm: { - events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), - ], + events: [getProcessorEventForTransactions(searchAggregatedTransactions)], }, body: { size: 0, @@ -62,7 +58,7 @@ export async function getTransactionErrorRateChartPreview({ : []), ...rangeQuery(start, end), ...environmentQuery(environment), - ...getDocumentTypeFilterForAggregatedTransactions( + ...getDocumentTypeFilterForTransactions( searchAggregatedTransactions ), ], diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts index df4de254346c..698bbcdbdb84 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts @@ -41,9 +41,9 @@ import { ProcessorEvent } from '../../../common/processor_event'; import { environmentQuery } from '../../../common/utils/environment_query'; import { getDurationFormatter } from '../../../common/utils/formatters'; import { - getDocumentTypeFilterForAggregatedTransactions, - getTransactionDurationFieldForAggregatedTransactions, -} from '../helpers/aggregated_transactions'; + getDocumentTypeFilterForTransactions, + getTransactionDurationFieldForTransactions, +} from '../helpers/transactions'; import { getApmIndices } from '../settings/apm_indices/get_apm_indices'; import { apmActionVariables } from './action_variables'; import { alertingEsClient } from './alerting_es_client'; @@ -122,7 +122,7 @@ export function registerTransactionDurationAlertType({ ? indices.metric : indices.transaction; - const field = getTransactionDurationFieldForAggregatedTransactions( + const field = getTransactionDurationFieldForTransactions( searchAggregatedTransactions ); @@ -140,7 +140,7 @@ export function registerTransactionDurationAlertType({ }, }, }, - ...getDocumentTypeFilterForAggregatedTransactions( + ...getDocumentTypeFilterForTransactions( searchAggregatedTransactions ), { term: { [SERVICE_NAME]: alertParams.serviceName } }, diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts index 598487d02625..5ba7ed5321d7 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts @@ -46,7 +46,7 @@ import { apmActionVariables } from './action_variables'; import { alertingEsClient } from './alerting_es_client'; import { RegisterRuleDependencies } from './register_apm_alerts'; import { SearchAggregatedTransactionSetting } from '../../../common/aggregated_transactions'; -import { getDocumentTypeFilterForAggregatedTransactions } from '../helpers/aggregated_transactions'; +import { getDocumentTypeFilterForTransactions } from '../helpers/transactions'; import { asPercent } from '../../../../observability/common/utils/formatters'; const ALERT_EVALUATION_THRESHOLD: typeof ALERT_EVALUATION_THRESHOLD_TYPED = @@ -131,7 +131,7 @@ export function registerTransactionErrorRateAlertType({ }, }, }, - ...getDocumentTypeFilterForAggregatedTransactions( + ...getDocumentTypeFilterForTransactions( searchAggregatedTransactions ), { diff --git a/x-pack/plugins/apm/server/lib/environments/get_all_environments.ts b/x-pack/plugins/apm/server/lib/environments/get_all_environments.ts index 1ddc3f7ed888..d6c53aeea078 100644 --- a/x-pack/plugins/apm/server/lib/environments/get_all_environments.ts +++ b/x-pack/plugins/apm/server/lib/environments/get_all_environments.ts @@ -12,7 +12,7 @@ import { SERVICE_ENVIRONMENT, } from '../../../common/elasticsearch_fieldnames'; import { ENVIRONMENT_NOT_DEFINED } from '../../../common/environment_filter_values'; -import { getProcessorEventForAggregatedTransactions } from '../helpers/aggregated_transactions'; +import { getProcessorEventForTransactions } from '../helpers/transactions'; /** * This is used for getting *all* environments, and does not filter by range. @@ -45,9 +45,7 @@ export async function getAllEnvironments({ const params = { apm: { events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), + getProcessorEventForTransactions(searchAggregatedTransactions), ProcessorEvent.error, ProcessorEvent.metric, ], diff --git a/x-pack/plugins/apm/server/lib/environments/get_environments.ts b/x-pack/plugins/apm/server/lib/environments/get_environments.ts index 08f6f089e8d0..678cfd891ae5 100644 --- a/x-pack/plugins/apm/server/lib/environments/get_environments.ts +++ b/x-pack/plugins/apm/server/lib/environments/get_environments.ts @@ -12,7 +12,7 @@ import { import { ENVIRONMENT_NOT_DEFINED } from '../../../common/environment_filter_values'; import { ProcessorEvent } from '../../../common/processor_event'; import { rangeQuery } from '../../../../observability/server'; -import { getProcessorEventForAggregatedTransactions } from '../helpers/aggregated_transactions'; +import { getProcessorEventForTransactions } from '../helpers/transactions'; import { Setup } from '../helpers/setup_request'; /** @@ -51,9 +51,7 @@ export async function getEnvironments({ const params = { apm: { events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), + getProcessorEventForTransactions(searchAggregatedTransactions), ProcessorEvent.metric, ProcessorEvent.error, ], diff --git a/x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/__snapshots__/get_is_using_transaction_events.test.ts.snap b/x-pack/plugins/apm/server/lib/helpers/transactions/__snapshots__/get_is_using_transaction_events.test.ts.snap similarity index 100% rename from x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/__snapshots__/get_is_using_transaction_events.test.ts.snap rename to x-pack/plugins/apm/server/lib/helpers/transactions/__snapshots__/get_is_using_transaction_events.test.ts.snap diff --git a/x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/get_is_using_transaction_events.test.ts b/x-pack/plugins/apm/server/lib/helpers/transactions/get_is_using_transaction_events.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/get_is_using_transaction_events.test.ts rename to x-pack/plugins/apm/server/lib/helpers/transactions/get_is_using_transaction_events.test.ts diff --git a/x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/get_is_using_transaction_events.ts b/x-pack/plugins/apm/server/lib/helpers/transactions/get_is_using_transaction_events.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/get_is_using_transaction_events.ts rename to x-pack/plugins/apm/server/lib/helpers/transactions/get_is_using_transaction_events.ts diff --git a/x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/index.ts b/x-pack/plugins/apm/server/lib/helpers/transactions/index.ts similarity index 92% rename from x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/index.ts rename to x-pack/plugins/apm/server/lib/helpers/transactions/index.ts index a58a95dd43fc..f16e03ddc3ea 100644 --- a/x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/index.ts +++ b/x-pack/plugins/apm/server/lib/helpers/transactions/index.ts @@ -77,7 +77,7 @@ export async function getSearchAggregatedTransactions({ ); } -export function getTransactionDurationFieldForAggregatedTransactions( +export function getTransactionDurationFieldForTransactions( searchAggregatedTransactions: boolean ) { return searchAggregatedTransactions @@ -85,7 +85,7 @@ export function getTransactionDurationFieldForAggregatedTransactions( : TRANSACTION_DURATION; } -export function getDocumentTypeFilterForAggregatedTransactions( +export function getDocumentTypeFilterForTransactions( searchAggregatedTransactions: boolean ) { return searchAggregatedTransactions @@ -93,7 +93,7 @@ export function getDocumentTypeFilterForAggregatedTransactions( : []; } -export function getProcessorEventForAggregatedTransactions( +export function getProcessorEventForTransactions( searchAggregatedTransactions: boolean ): ProcessorEvent.metric | ProcessorEvent.transaction { return searchAggregatedTransactions diff --git a/x-pack/plugins/apm/server/lib/observability_overview/get_service_count.ts b/x-pack/plugins/apm/server/lib/observability_overview/get_service_count.ts index a181b1a41fbc..3eb11f668115 100644 --- a/x-pack/plugins/apm/server/lib/observability_overview/get_service_count.ts +++ b/x-pack/plugins/apm/server/lib/observability_overview/get_service_count.ts @@ -9,7 +9,7 @@ import { ProcessorEvent } from '../../../common/processor_event'; import { rangeQuery } from '../../../../observability/server'; import { SERVICE_NAME } from '../../../common/elasticsearch_fieldnames'; import { Setup } from '../helpers/setup_request'; -import { getProcessorEventForAggregatedTransactions } from '../helpers/aggregated_transactions'; +import { getProcessorEventForTransactions } from '../helpers/transactions'; export async function getServiceCount({ setup, @@ -27,9 +27,7 @@ export async function getServiceCount({ const params = { apm: { events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), + getProcessorEventForTransactions(searchAggregatedTransactions), ProcessorEvent.error, ProcessorEvent.metric, ], diff --git a/x-pack/plugins/apm/server/lib/observability_overview/get_transactions_per_minute.ts b/x-pack/plugins/apm/server/lib/observability_overview/get_transactions_per_minute.ts index 8c64670f5d2e..829afa833016 100644 --- a/x-pack/plugins/apm/server/lib/observability_overview/get_transactions_per_minute.ts +++ b/x-pack/plugins/apm/server/lib/observability_overview/get_transactions_per_minute.ts @@ -13,9 +13,9 @@ import { TRANSACTION_TYPE } from '../../../common/elasticsearch_fieldnames'; import { rangeQuery } from '../../../../observability/server'; import { Setup } from '../helpers/setup_request'; import { - getDocumentTypeFilterForAggregatedTransactions, - getProcessorEventForAggregatedTransactions, -} from '../helpers/aggregated_transactions'; + getDocumentTypeFilterForTransactions, + getProcessorEventForTransactions, +} from '../helpers/transactions'; import { calculateThroughputWithInterval, calculateThroughputWithRange, @@ -43,9 +43,7 @@ export async function getTransactionsPerMinute({ { apm: { events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), + getProcessorEventForTransactions(searchAggregatedTransactions), ], }, body: { @@ -54,7 +52,7 @@ export async function getTransactionsPerMinute({ bool: { filter: [ ...rangeQuery(start, end), - ...getDocumentTypeFilterForAggregatedTransactions( + ...getDocumentTypeFilterForTransactions( searchAggregatedTransactions ), ], diff --git a/x-pack/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 index 78ca3fad6318..43147684ef3f 100644 --- a/x-pack/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 @@ -23,10 +23,10 @@ import { rangeQuery } from '../../../../observability/server'; import { environmentQuery } from '../../../common/utils/environment_query'; import { withApmSpan } from '../../utils/with_apm_span'; import { - getDocumentTypeFilterForAggregatedTransactions, - getProcessorEventForAggregatedTransactions, - getTransactionDurationFieldForAggregatedTransactions, -} from '../helpers/aggregated_transactions'; + getDocumentTypeFilterForTransactions, + getTransactionDurationFieldForTransactions, + getProcessorEventForTransactions, +} from '../helpers/transactions'; import { Setup } from '../helpers/setup_request'; import { percentCgroupMemoryUsedScript, @@ -131,11 +131,7 @@ async function getTransactionStats({ const params = { apm: { - events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), - ], + events: [getProcessorEventForTransactions(searchAggregatedTransactions)], }, body: { size: 0, @@ -143,7 +139,7 @@ async function getTransactionStats({ bool: { filter: [ ...filter, - ...getDocumentTypeFilterForAggregatedTransactions( + ...getDocumentTypeFilterForTransactions( searchAggregatedTransactions ), { @@ -161,7 +157,7 @@ async function getTransactionStats({ aggs: { duration: { avg: { - field: getTransactionDurationFieldForAggregatedTransactions( + field: getTransactionDurationFieldForTransactions( searchAggregatedTransactions ), }, diff --git a/x-pack/plugins/apm/server/lib/services/annotations/get_derived_service_annotations.ts b/x-pack/plugins/apm/server/lib/services/annotations/get_derived_service_annotations.ts index 3af9b557dd12..22b37e33a26e 100644 --- a/x-pack/plugins/apm/server/lib/services/annotations/get_derived_service_annotations.ts +++ b/x-pack/plugins/apm/server/lib/services/annotations/get_derived_service_annotations.ts @@ -15,9 +15,9 @@ import { import { rangeQuery } from '../../../../../observability/server'; import { environmentQuery } from '../../../../common/utils/environment_query'; import { - getDocumentTypeFilterForAggregatedTransactions, - getProcessorEventForAggregatedTransactions, -} from '../../helpers/aggregated_transactions'; + getDocumentTypeFilterForTransactions, + getProcessorEventForTransactions, +} from '../../helpers/transactions'; import { Setup } from '../../helpers/setup_request'; export async function getDerivedServiceAnnotations({ @@ -39,9 +39,7 @@ export async function getDerivedServiceAnnotations({ const filter: ESFilter[] = [ { term: { [SERVICE_NAME]: serviceName } }, - ...getDocumentTypeFilterForAggregatedTransactions( - searchAggregatedTransactions - ), + ...getDocumentTypeFilterForTransactions(searchAggregatedTransactions), ...environmentQuery(environment), ]; @@ -50,9 +48,7 @@ export async function getDerivedServiceAnnotations({ await apmEventClient.search('get_derived_service_annotations', { apm: { events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), + getProcessorEventForTransactions(searchAggregatedTransactions), ], }, body: { @@ -83,9 +79,7 @@ export async function getDerivedServiceAnnotations({ { apm: { events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), + getProcessorEventForTransactions(searchAggregatedTransactions), ], }, body: { diff --git a/x-pack/plugins/apm/server/lib/services/get_service_agent.ts b/x-pack/plugins/apm/server/lib/services/get_service_agent.ts index a9bb3c8f3103..5ef29437d73d 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_agent.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_agent.ts @@ -13,7 +13,7 @@ import { } from '../../../common/elasticsearch_fieldnames'; import { rangeQuery } from '../../../../observability/server'; import { Setup } from '../helpers/setup_request'; -import { getProcessorEventForAggregatedTransactions } from '../helpers/aggregated_transactions'; +import { getProcessorEventForTransactions } from '../helpers/transactions'; interface ServiceAgent { agent?: { @@ -46,9 +46,7 @@ export async function getServiceAgent({ apm: { events: [ ProcessorEvent.error, - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), + getProcessorEventForTransactions(searchAggregatedTransactions), ProcessorEvent.metric, ], }, diff --git a/x-pack/plugins/apm/server/lib/services/get_service_instance_metadata_details.ts b/x-pack/plugins/apm/server/lib/services/get_service_instance_metadata_details.ts index ba122ea5ad0e..d349ca3ce039 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_instance_metadata_details.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_instance_metadata_details.ts @@ -15,9 +15,9 @@ import { rangeQuery } from '../../../../observability/server'; import { Setup } from '../helpers/setup_request'; import { maybe } from '../../../common/utils/maybe'; import { - getDocumentTypeFilterForAggregatedTransactions, - getProcessorEventForAggregatedTransactions, -} from '../helpers/aggregated_transactions'; + getDocumentTypeFilterForTransactions, + getProcessorEventForTransactions, +} from '../helpers/transactions'; export async function getServiceInstanceMetadataDetails({ serviceName, @@ -84,16 +84,14 @@ export async function getServiceInstanceMetadataDetails({ 'get_service_instance_metadata_details_application_transaction_metric', { apm: { - events: [getProcessorEventForAggregatedTransactions(true)], + events: [getProcessorEventForTransactions(true)], }, body: { terminate_after: 1, size: 1, query: { bool: { - filter: filter.concat( - getDocumentTypeFilterForAggregatedTransactions(true) - ), + filter: filter.concat(getDocumentTypeFilterForTransactions(true)), }, }, }, diff --git a/x-pack/plugins/apm/server/lib/services/get_service_instances/get_service_instances_transaction_statistics.ts b/x-pack/plugins/apm/server/lib/services/get_service_instances/get_service_instances_transaction_statistics.ts index ec76e0d35e5c..b0f64036a184 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_instances/get_service_instances_transaction_statistics.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_instances/get_service_instances_transaction_statistics.ts @@ -17,10 +17,10 @@ import { Coordinate } from '../../../../typings/timeseries'; import { kqlQuery, rangeQuery } from '../../../../../observability/server'; import { environmentQuery } from '../../../../common/utils/environment_query'; import { - getDocumentTypeFilterForAggregatedTransactions, - getProcessorEventForAggregatedTransactions, - getTransactionDurationFieldForAggregatedTransactions, -} from '../../helpers/aggregated_transactions'; + getDocumentTypeFilterForTransactions, + getTransactionDurationFieldForTransactions, + getProcessorEventForTransactions, +} from '../../helpers/transactions'; import { calculateThroughput } from '../../helpers/calculate_throughput'; import { getBucketSizeForAggregatedTransactions } from '../../helpers/get_bucket_size_for_aggregated_transactions'; import { @@ -89,7 +89,7 @@ export async function getServiceInstancesTransactionStatistics< } ); - const field = getTransactionDurationFieldForAggregatedTransactions( + const field = getTransactionDurationFieldForTransactions( searchAggregatedTransactions ); @@ -109,15 +109,11 @@ export async function getServiceInstancesTransactionStatistics< filter: [ { term: { [SERVICE_NAME]: serviceName } }, { term: { [TRANSACTION_TYPE]: transactionType } }, - ...getDocumentTypeFilterForAggregatedTransactions( - searchAggregatedTransactions - ), + ...getDocumentTypeFilterForTransactions(searchAggregatedTransactions), ...rangeQuery(start, end), ...environmentQuery(environment), ...kqlQuery(kuery), - ...getDocumentTypeFilterForAggregatedTransactions( - searchAggregatedTransactions - ), + ...getDocumentTypeFilterForTransactions(searchAggregatedTransactions), ...(isComparisonSearch && serviceNodeIds ? [{ terms: { [SERVICE_NODE_NAME]: serviceNodeIds } }] : []), @@ -154,9 +150,7 @@ export async function getServiceInstancesTransactionStatistics< { apm: { events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), + getProcessorEventForTransactions(searchAggregatedTransactions), ], }, body: { size: 0, query, aggs }, diff --git a/x-pack/plugins/apm/server/lib/services/get_service_metadata_details.ts b/x-pack/plugins/apm/server/lib/services/get_service_metadata_details.ts index 7a39e953ad49..e2852a51b0c0 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_metadata_details.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_metadata_details.ts @@ -22,7 +22,7 @@ import { import { ContainerType } from '../../../common/service_metadata'; import { rangeQuery } from '../../../../observability/server'; import { TransactionRaw } from '../../../typings/es_schemas/raw/transaction_raw'; -import { getProcessorEventForAggregatedTransactions } from '../helpers/aggregated_transactions'; +import { getProcessorEventForTransactions } from '../helpers/transactions'; import { Setup } from '../helpers/setup_request'; import { should } from './get_service_metadata_icons'; @@ -81,9 +81,7 @@ export async function getServiceMetadataDetails({ const params = { apm: { events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), + getProcessorEventForTransactions(searchAggregatedTransactions), ProcessorEvent.error, ProcessorEvent.metric, ], diff --git a/x-pack/plugins/apm/server/lib/services/get_service_metadata_icons.ts b/x-pack/plugins/apm/server/lib/services/get_service_metadata_icons.ts index 26a3090946ff..2c93a298cb13 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_metadata_icons.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_metadata_icons.ts @@ -18,7 +18,7 @@ import { import { ContainerType } from '../../../common/service_metadata'; import { rangeQuery } from '../../../../observability/server'; import { TransactionRaw } from '../../../typings/es_schemas/raw/transaction_raw'; -import { getProcessorEventForAggregatedTransactions } from '../helpers/aggregated_transactions'; +import { getProcessorEventForTransactions } from '../helpers/transactions'; import { Setup } from '../helpers/setup_request'; type ServiceMetadataIconsRaw = Pick< @@ -63,9 +63,7 @@ export async function getServiceMetadataIcons({ const params = { apm: { events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), + getProcessorEventForTransactions(searchAggregatedTransactions), ProcessorEvent.error, ProcessorEvent.metric, ], diff --git a/x-pack/plugins/apm/server/lib/services/get_service_transaction_group_detailed_statistics.ts b/x-pack/plugins/apm/server/lib/services/get_service_transaction_group_detailed_statistics.ts index feab6d78f02c..35256e6a7ecd 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_transaction_group_detailed_statistics.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_transaction_group_detailed_statistics.ts @@ -19,10 +19,10 @@ import { kqlQuery, rangeQuery } from '../../../../observability/server'; import { environmentQuery } from '../../../common/utils/environment_query'; import { Coordinate } from '../../../typings/timeseries'; import { - getDocumentTypeFilterForAggregatedTransactions, - getProcessorEventForAggregatedTransactions, - getTransactionDurationFieldForAggregatedTransactions, -} from '../helpers/aggregated_transactions'; + getDocumentTypeFilterForTransactions, + getTransactionDurationFieldForTransactions, + getProcessorEventForTransactions, +} from '../helpers/transactions'; import { getBucketSizeForAggregatedTransactions } from '../helpers/get_bucket_size_for_aggregated_transactions'; import { getLatencyAggregation, @@ -72,7 +72,7 @@ export async function getServiceTransactionGroupDetailedStatistics({ searchAggregatedTransactions, }); - const field = getTransactionDurationFieldForAggregatedTransactions( + const field = getTransactionDurationFieldForTransactions( searchAggregatedTransactions ); @@ -81,9 +81,7 @@ export async function getServiceTransactionGroupDetailedStatistics({ { apm: { events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), + getProcessorEventForTransactions(searchAggregatedTransactions), ], }, body: { @@ -93,7 +91,7 @@ export async function getServiceTransactionGroupDetailedStatistics({ filter: [ { term: { [SERVICE_NAME]: serviceName } }, { term: { [TRANSACTION_TYPE]: transactionType } }, - ...getDocumentTypeFilterForAggregatedTransactions( + ...getDocumentTypeFilterForTransactions( searchAggregatedTransactions ), ...rangeQuery(start, end), diff --git a/x-pack/plugins/apm/server/lib/services/get_service_transaction_groups.ts b/x-pack/plugins/apm/server/lib/services/get_service_transaction_groups.ts index fbc1e2880495..7f624693a3b9 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_transaction_groups.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_transaction_groups.ts @@ -16,10 +16,10 @@ import { LatencyAggregationType } from '../../../common/latency_aggregation_type import { rangeQuery, kqlQuery } from '../../../../observability/server'; import { environmentQuery } from '../../../common/utils/environment_query'; import { - getDocumentTypeFilterForAggregatedTransactions, - getProcessorEventForAggregatedTransactions, - getTransactionDurationFieldForAggregatedTransactions, -} from '../helpers/aggregated_transactions'; + getDocumentTypeFilterForTransactions, + getTransactionDurationFieldForTransactions, + getProcessorEventForTransactions, +} from '../helpers/transactions'; import { calculateThroughput } from '../helpers/calculate_throughput'; import { getLatencyAggregation, @@ -59,7 +59,7 @@ export async function getServiceTransactionGroups({ const { apmEventClient, config } = setup; const bucketSize = config.ui.transactionGroupBucketSize; - const field = getTransactionDurationFieldForAggregatedTransactions( + const field = getTransactionDurationFieldForTransactions( searchAggregatedTransactions ); @@ -68,9 +68,7 @@ export async function getServiceTransactionGroups({ { apm: { events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), + getProcessorEventForTransactions(searchAggregatedTransactions), ], }, body: { @@ -80,7 +78,7 @@ export async function getServiceTransactionGroups({ filter: [ { term: { [SERVICE_NAME]: serviceName } }, { term: { [TRANSACTION_TYPE]: transactionType } }, - ...getDocumentTypeFilterForAggregatedTransactions( + ...getDocumentTypeFilterForTransactions( searchAggregatedTransactions ), ...rangeQuery(start, end), diff --git a/x-pack/plugins/apm/server/lib/services/get_service_transaction_types.ts b/x-pack/plugins/apm/server/lib/services/get_service_transaction_types.ts index 9e3d39e7f280..1c2d1c9207bc 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_transaction_types.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_transaction_types.ts @@ -12,9 +12,9 @@ import { import { rangeQuery } from '../../../../observability/server'; import { Setup } from '../helpers/setup_request'; import { - getDocumentTypeFilterForAggregatedTransactions, - getProcessorEventForAggregatedTransactions, -} from '../helpers/aggregated_transactions'; + getDocumentTypeFilterForTransactions, + getProcessorEventForTransactions, +} from '../helpers/transactions'; export async function getServiceTransactionTypes({ setup, @@ -33,18 +33,14 @@ export async function getServiceTransactionTypes({ const params = { apm: { - events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), - ], + events: [getProcessorEventForTransactions(searchAggregatedTransactions)], }, body: { size: 0, query: { bool: { filter: [ - ...getDocumentTypeFilterForAggregatedTransactions( + ...getDocumentTypeFilterForTransactions( searchAggregatedTransactions ), { term: { [SERVICE_NAME]: serviceName } }, diff --git a/x-pack/plugins/apm/server/lib/services/get_services/get_service_transaction_stats.ts b/x-pack/plugins/apm/server/lib/services/get_services/get_service_transaction_stats.ts index 24d2640024d2..36903f9ca229 100644 --- a/x-pack/plugins/apm/server/lib/services/get_services/get_service_transaction_stats.ts +++ b/x-pack/plugins/apm/server/lib/services/get_services/get_service_transaction_stats.ts @@ -19,10 +19,10 @@ import { import { environmentQuery } from '../../../../common/utils/environment_query'; import { AgentName } from '../../../../typings/es_schemas/ui/fields/agent'; import { - getDocumentTypeFilterForAggregatedTransactions, - getProcessorEventForAggregatedTransactions, - getTransactionDurationFieldForAggregatedTransactions, -} from '../../helpers/aggregated_transactions'; + getDocumentTypeFilterForTransactions, + getTransactionDurationFieldForTransactions, + getProcessorEventForTransactions, +} from '../../helpers/transactions'; import { calculateThroughput } from '../../helpers/calculate_throughput'; import { calculateFailedTransactionRate, @@ -56,7 +56,7 @@ export async function getServiceTransactionStats({ const metrics = { avg_duration: { avg: { - field: getTransactionDurationFieldForAggregatedTransactions( + field: getTransactionDurationFieldForTransactions( searchAggregatedTransactions ), }, @@ -69,9 +69,7 @@ export async function getServiceTransactionStats({ { apm: { events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), + getProcessorEventForTransactions(searchAggregatedTransactions), ], }, body: { @@ -79,7 +77,7 @@ export async function getServiceTransactionStats({ query: { bool: { filter: [ - ...getDocumentTypeFilterForAggregatedTransactions( + ...getDocumentTypeFilterForTransactions( searchAggregatedTransactions ), ...rangeQuery(start, end), diff --git a/x-pack/plugins/apm/server/lib/services/get_services_detailed_statistics/get_service_transaction_detailed_statistics.ts b/x-pack/plugins/apm/server/lib/services/get_services_detailed_statistics/get_service_transaction_detailed_statistics.ts index 14a37600bb4c..686555e7764a 100644 --- a/x-pack/plugins/apm/server/lib/services/get_services_detailed_statistics/get_service_transaction_detailed_statistics.ts +++ b/x-pack/plugins/apm/server/lib/services/get_services_detailed_statistics/get_service_transaction_detailed_statistics.ts @@ -18,10 +18,10 @@ import { import { environmentQuery } from '../../../../common/utils/environment_query'; import { getOffsetInMs } from '../../../../common/utils/get_offset_in_ms'; import { - getDocumentTypeFilterForAggregatedTransactions, - getProcessorEventForAggregatedTransactions, - getTransactionDurationFieldForAggregatedTransactions, -} from '../../helpers/aggregated_transactions'; + getDocumentTypeFilterForTransactions, + getTransactionDurationFieldForTransactions, + getProcessorEventForTransactions, +} from '../../helpers/transactions'; import { calculateThroughput } from '../../helpers/calculate_throughput'; import { getBucketSizeForAggregatedTransactions } from '../../helpers/get_bucket_size_for_aggregated_transactions'; import { Setup } from '../../helpers/setup_request'; @@ -61,7 +61,7 @@ export async function getServiceTransactionDetailedStatistics({ const metrics = { avg_duration: { avg: { - field: getTransactionDurationFieldForAggregatedTransactions( + field: getTransactionDurationFieldForTransactions( searchAggregatedTransactions ), }, @@ -74,9 +74,7 @@ export async function getServiceTransactionDetailedStatistics({ { apm: { events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), + getProcessorEventForTransactions(searchAggregatedTransactions), ], }, body: { @@ -84,7 +82,7 @@ export async function getServiceTransactionDetailedStatistics({ query: { bool: { filter: [ - ...getDocumentTypeFilterForAggregatedTransactions( + ...getDocumentTypeFilterForTransactions( searchAggregatedTransactions ), ...rangeQuery(startWithOffset, endWithOffset), diff --git a/x-pack/plugins/apm/server/lib/services/get_throughput.ts b/x-pack/plugins/apm/server/lib/services/get_throughput.ts index 669203ad198b..e31e9dd3b8c9 100644 --- a/x-pack/plugins/apm/server/lib/services/get_throughput.ts +++ b/x-pack/plugins/apm/server/lib/services/get_throughput.ts @@ -14,9 +14,9 @@ import { import { kqlQuery, rangeQuery } from '../../../../observability/server'; import { environmentQuery } from '../../../common/utils/environment_query'; import { - getDocumentTypeFilterForAggregatedTransactions, - getProcessorEventForAggregatedTransactions, -} from '../helpers/aggregated_transactions'; + getDocumentTypeFilterForTransactions, + getProcessorEventForTransactions, +} from '../helpers/transactions'; import { Setup } from '../helpers/setup_request'; import { calculateThroughputWithInterval } from '../helpers/calculate_throughput'; @@ -52,9 +52,7 @@ export async function getThroughput({ const filter: ESFilter[] = [ { term: { [SERVICE_NAME]: serviceName } }, { term: { [TRANSACTION_TYPE]: transactionType } }, - ...getDocumentTypeFilterForAggregatedTransactions( - searchAggregatedTransactions - ), + ...getDocumentTypeFilterForTransactions(searchAggregatedTransactions), ...rangeQuery(start, end), ...environmentQuery(environment), ...kqlQuery(kuery), @@ -70,11 +68,7 @@ export async function getThroughput({ const params = { apm: { - events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), - ], + events: [getProcessorEventForTransactions(searchAggregatedTransactions)], }, body: { size: 0, diff --git a/x-pack/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 index 282eacbec66d..06bd900872a2 100644 --- a/x-pack/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 @@ -10,7 +10,7 @@ import { Setup } from '../../helpers/setup_request'; import { PromiseReturnType } from '../../../../../observability/typings/common'; import { SERVICE_NAME } from '../../../../common/elasticsearch_fieldnames'; import { ALL_OPTION_VALUE } from '../../../../common/agent_configuration/all_option'; -import { getProcessorEventForAggregatedTransactions } from '../../helpers/aggregated_transactions'; +import { getProcessorEventForTransactions } from '../../helpers/transactions'; export type AgentConfigurationServicesAPIResponse = PromiseReturnType< typeof getServiceNames @@ -30,9 +30,7 @@ export async function getServiceNames({ const params = { apm: { events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), + getProcessorEventForTransactions(searchAggregatedTransactions), ProcessorEvent.error, ProcessorEvent.metric, ], diff --git a/x-pack/plugins/apm/server/lib/suggestions/get_suggestions.ts b/x-pack/plugins/apm/server/lib/suggestions/get_suggestions.ts index acd44366ef4c..5ea28debc443 100644 --- a/x-pack/plugins/apm/server/lib/suggestions/get_suggestions.ts +++ b/x-pack/plugins/apm/server/lib/suggestions/get_suggestions.ts @@ -6,7 +6,7 @@ */ import { ProcessorEvent } from '../../../common/processor_event'; -import { getProcessorEventForAggregatedTransactions } from '../helpers/aggregated_transactions'; +import { getProcessorEventForTransactions } from '../helpers/transactions'; import { Setup } from '../helpers/setup_request'; export async function getSuggestions({ @@ -27,9 +27,7 @@ export async function getSuggestions({ const response = await apmEventClient.termsEnum('get_suggestions', { apm: { events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), + getProcessorEventForTransactions(searchAggregatedTransactions), ProcessorEvent.error, ProcessorEvent.metric, ], diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts b/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts index dc7cc0f80446..f082483c0c10 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts @@ -22,9 +22,9 @@ import { environmentQuery } from '../../../common/utils/environment_query'; import { joinByKey } from '../../../common/utils/join_by_key'; import { withApmSpan } from '../../utils/with_apm_span'; import { - getDocumentTypeFilterForAggregatedTransactions, - getProcessorEventForAggregatedTransactions, -} from '../helpers/aggregated_transactions'; + getDocumentTypeFilterForTransactions, + getProcessorEventForTransactions, +} from '../helpers/transactions'; import { Setup } from '../helpers/setup_request'; import { getAverages, getCounts, getSums } from './get_transaction_group_stats'; @@ -75,11 +75,7 @@ function getRequest(topTraceOptions: TopTraceOptions) { return { apm: { - events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), - ], + events: [getProcessorEventForTransactions(searchAggregatedTransactions)], }, body: { size: 0, @@ -87,7 +83,7 @@ function getRequest(topTraceOptions: TopTraceOptions) { bool: { filter: [ ...transactionNameFilter, - ...getDocumentTypeFilterForAggregatedTransactions( + ...getDocumentTypeFilterForTransactions( searchAggregatedTransactions ), ...rangeQuery(start, end), diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/get_error_rate.ts b/x-pack/plugins/apm/server/lib/transaction_groups/get_error_rate.ts index d57b0400abed..e85bd61ac440 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/get_error_rate.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/get_error_rate.ts @@ -17,9 +17,9 @@ import { kqlQuery, rangeQuery } from '../../../../observability/server'; import { environmentQuery } from '../../../common/utils/environment_query'; import { Coordinate } from '../../../typings/timeseries'; import { - getDocumentTypeFilterForAggregatedTransactions, - getProcessorEventForAggregatedTransactions, -} from '../helpers/aggregated_transactions'; + getDocumentTypeFilterForTransactions, + getProcessorEventForTransactions, +} from '../helpers/transactions'; import { getBucketSizeForAggregatedTransactions } from '../helpers/get_bucket_size_for_aggregated_transactions'; import { Setup } from '../helpers/setup_request'; import { @@ -71,9 +71,7 @@ export async function getErrorRate({ }, ...transactionNamefilter, ...transactionTypefilter, - ...getDocumentTypeFilterForAggregatedTransactions( - searchAggregatedTransactions - ), + ...getDocumentTypeFilterForTransactions(searchAggregatedTransactions), ...rangeQuery(start, end), ...environmentQuery(environment), ...kqlQuery(kuery), @@ -83,11 +81,7 @@ export async function getErrorRate({ const params = { apm: { - events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), - ], + events: [getProcessorEventForTransactions(searchAggregatedTransactions)], }, body: { size: 0, diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts b/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts index 980d8f10610c..8769a572e33a 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts @@ -10,7 +10,7 @@ import { estypes } from '@elastic/elasticsearch'; import { TRANSACTION_TYPE } from '../../../common/elasticsearch_fieldnames'; import { arrayUnionToCallable } from '../../../common/utils/array_union_to_callable'; import { TransactionGroupRequestBase, TransactionGroupSetup } from './fetcher'; -import { getTransactionDurationFieldForAggregatedTransactions } from '../helpers/aggregated_transactions'; +import { getTransactionDurationFieldForTransactions } from '../helpers/transactions'; interface MetricParams { request: TransactionGroupRequestBase; @@ -46,7 +46,7 @@ export async function getAverages({ const params = mergeRequestWithAggs(request, { avg: { avg: { - field: getTransactionDurationFieldForAggregatedTransactions( + field: getTransactionDurationFieldForTransactions( searchAggregatedTransactions ), }, @@ -110,7 +110,7 @@ export async function getSums({ const params = mergeRequestWithAggs(request, { sum: { sum: { - field: getTransactionDurationFieldForAggregatedTransactions( + field: getTransactionDurationFieldForTransactions( searchAggregatedTransactions ), }, diff --git a/x-pack/plugins/apm/server/lib/transactions/get_latency_charts/index.ts b/x-pack/plugins/apm/server/lib/transactions/get_latency_charts/index.ts index 01e2d905bbf2..c4bae841764c 100644 --- a/x-pack/plugins/apm/server/lib/transactions/get_latency_charts/index.ts +++ b/x-pack/plugins/apm/server/lib/transactions/get_latency_charts/index.ts @@ -17,10 +17,10 @@ import { offsetPreviousPeriodCoordinates } from '../../../../common/utils/offset import { kqlQuery, rangeQuery } from '../../../../../observability/server'; import { environmentQuery } from '../../../../common/utils/environment_query'; import { - getDocumentTypeFilterForAggregatedTransactions, - getProcessorEventForAggregatedTransactions, - getTransactionDurationFieldForAggregatedTransactions, -} from '../../../lib/helpers/aggregated_transactions'; + getDocumentTypeFilterForTransactions, + getTransactionDurationFieldForTransactions, + getProcessorEventForTransactions, +} from '../../../lib/helpers/transactions'; import { Setup } from '../../../lib/helpers/setup_request'; import { getBucketSizeForAggregatedTransactions } from '../../helpers/get_bucket_size_for_aggregated_transactions'; import { @@ -63,9 +63,7 @@ function searchLatency({ const filter: ESFilter[] = [ { term: { [SERVICE_NAME]: serviceName } }, - ...getDocumentTypeFilterForAggregatedTransactions( - searchAggregatedTransactions - ), + ...getDocumentTypeFilterForTransactions(searchAggregatedTransactions), ...rangeQuery(start, end), ...environmentQuery(environment), ...kqlQuery(kuery), @@ -79,18 +77,13 @@ function searchLatency({ filter.push({ term: { [TRANSACTION_TYPE]: transactionType } }); } - const transactionDurationField = - getTransactionDurationFieldForAggregatedTransactions( - searchAggregatedTransactions - ); + const transactionDurationField = getTransactionDurationFieldForTransactions( + searchAggregatedTransactions + ); const params = { apm: { - events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), - ], + events: [getProcessorEventForTransactions(searchAggregatedTransactions)], }, body: { size: 0, diff --git a/x-pack/plugins/apm/server/projections/services.ts b/x-pack/plugins/apm/server/projections/services.ts index afa6f4ba752f..139c86acd514 100644 --- a/x-pack/plugins/apm/server/projections/services.ts +++ b/x-pack/plugins/apm/server/projections/services.ts @@ -9,7 +9,7 @@ import { Setup } from '../../server/lib/helpers/setup_request'; import { SERVICE_NAME } from '../../common/elasticsearch_fieldnames'; import { rangeQuery, kqlQuery } from '../../../observability/server'; import { ProcessorEvent } from '../../common/processor_event'; -import { getProcessorEventForAggregatedTransactions } from '../lib/helpers/aggregated_transactions'; +import { getProcessorEventForTransactions } from '../lib/helpers/transactions'; export function getServicesProjection({ kuery, @@ -27,9 +27,7 @@ export function getServicesProjection({ return { apm: { events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), + getProcessorEventForTransactions(searchAggregatedTransactions), ProcessorEvent.metric as const, ProcessorEvent.error as const, ], diff --git a/x-pack/plugins/apm/server/routes/environments.ts b/x-pack/plugins/apm/server/routes/environments.ts index 59e75f6f9c34..e54ad79f177c 100644 --- a/x-pack/plugins/apm/server/routes/environments.ts +++ b/x-pack/plugins/apm/server/routes/environments.ts @@ -7,7 +7,7 @@ import * as t from 'io-ts'; import { maxSuggestions } from '../../../observability/common'; -import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions'; +import { getSearchAggregatedTransactions } from '../lib/helpers/transactions'; import { setupRequest } from '../lib/helpers/setup_request'; import { getEnvironments } from '../lib/environments/get_environments'; import { rangeRt } from './default_api_types'; diff --git a/x-pack/plugins/apm/server/routes/fallback_to_transactions.ts b/x-pack/plugins/apm/server/routes/fallback_to_transactions.ts index ba74cc0b7a88..99c6a290e34b 100644 --- a/x-pack/plugins/apm/server/routes/fallback_to_transactions.ts +++ b/x-pack/plugins/apm/server/routes/fallback_to_transactions.ts @@ -6,7 +6,7 @@ */ import * as t from 'io-ts'; -import { getIsUsingTransactionEvents } from '../lib/helpers/aggregated_transactions/get_is_using_transaction_events'; +import { getIsUsingTransactionEvents } from '../lib/helpers/transactions/get_is_using_transaction_events'; import { setupRequest } from '../lib/helpers/setup_request'; import { createApmServerRoute } from './create_apm_server_route'; import { createApmServerRouteRepository } from './create_apm_server_route_repository'; diff --git a/x-pack/plugins/apm/server/routes/observability_overview.ts b/x-pack/plugins/apm/server/routes/observability_overview.ts index 0dbebd061e8b..2aff798f9ad0 100644 --- a/x-pack/plugins/apm/server/routes/observability_overview.ts +++ b/x-pack/plugins/apm/server/routes/observability_overview.ts @@ -12,7 +12,7 @@ import { getServiceCount } from '../lib/observability_overview/get_service_count import { getTransactionsPerMinute } from '../lib/observability_overview/get_transactions_per_minute'; import { getHasData } from '../lib/observability_overview/has_data'; import { rangeRt } from './default_api_types'; -import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions'; +import { getSearchAggregatedTransactions } from '../lib/helpers/transactions'; import { withApmSpan } from '../utils/with_apm_span'; import { createApmServerRouteRepository } from './create_apm_server_route_repository'; import { createApmServerRoute } from './create_apm_server_route'; diff --git a/x-pack/plugins/apm/server/routes/service_map.ts b/x-pack/plugins/apm/server/routes/service_map.ts index 17fb9d7c98c5..038f909d7b33 100644 --- a/x-pack/plugins/apm/server/routes/service_map.ts +++ b/x-pack/plugins/apm/server/routes/service_map.ts @@ -10,7 +10,7 @@ import * as t from 'io-ts'; import { isActivePlatinumLicense } from '../../common/license_check'; import { invalidLicenseMessage } from '../../common/service_map'; import { notifyFeatureUsage } from '../feature'; -import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions'; +import { getSearchAggregatedTransactions } from '../lib/helpers/transactions'; import { setupRequest } from '../lib/helpers/setup_request'; import { getServiceMap } from '../lib/service_map/get_service_map'; import { getServiceMapBackendNodeInfo } from '../lib/service_map/get_service_map_backend_node_info'; diff --git a/x-pack/plugins/apm/server/routes/services.ts b/x-pack/plugins/apm/server/routes/services.ts index f1f29dc2f036..257aec216eb0 100644 --- a/x-pack/plugins/apm/server/routes/services.ts +++ b/x-pack/plugins/apm/server/routes/services.ts @@ -11,7 +11,7 @@ import * as t from 'io-ts'; import { uniq } from 'lodash'; import { latencyAggregationTypeRt } from '../../common/latency_aggregation_types'; import { ProfilingValueType } from '../../common/profiling'; -import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions'; +import { getSearchAggregatedTransactions } from '../lib/helpers/transactions'; import { setupRequest } from '../lib/helpers/setup_request'; import { getServiceAnnotations } from '../lib/services/annotations'; import { getServices } from '../lib/services/get_services'; diff --git a/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts index a904e5e03b53..0488d0ebd01b 100644 --- a/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts +++ b/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts @@ -24,7 +24,7 @@ import { serviceRt, agentConfigurationIntakeRt, } from '../../../common/agent_configuration/runtime_types/agent_configuration_intake_rt'; -import { getSearchAggregatedTransactions } from '../../lib/helpers/aggregated_transactions'; +import { getSearchAggregatedTransactions } from '../../lib/helpers/transactions'; import { createApmServerRouteRepository } from '../create_apm_server_route_repository'; import { syncAgentConfigsToApmPackagePolicies } from '../../lib/fleet/sync_agent_configs_to_apm_package_policies'; diff --git a/x-pack/plugins/apm/server/routes/settings/anomaly_detection.ts b/x-pack/plugins/apm/server/routes/settings/anomaly_detection.ts index 78db4e0c14b3..f614f35810c5 100644 --- a/x-pack/plugins/apm/server/routes/settings/anomaly_detection.ts +++ b/x-pack/plugins/apm/server/routes/settings/anomaly_detection.ts @@ -16,7 +16,7 @@ import { createAnomalyDetectionJobs } from '../../lib/anomaly_detection/create_a import { setupRequest } from '../../lib/helpers/setup_request'; import { getAllEnvironments } from '../../lib/environments/get_all_environments'; import { hasLegacyJobs } from '../../lib/anomaly_detection/has_legacy_jobs'; -import { getSearchAggregatedTransactions } from '../../lib/helpers/aggregated_transactions'; +import { getSearchAggregatedTransactions } from '../../lib/helpers/transactions'; import { notifyFeatureUsage } from '../../feature'; import { withApmSpan } from '../../utils/with_apm_span'; import { createApmServerRouteRepository } from '../create_apm_server_route_repository'; diff --git a/x-pack/plugins/apm/server/routes/suggestions.ts b/x-pack/plugins/apm/server/routes/suggestions.ts index 8b82601650a4..4834d894f364 100644 --- a/x-pack/plugins/apm/server/routes/suggestions.ts +++ b/x-pack/plugins/apm/server/routes/suggestions.ts @@ -8,7 +8,7 @@ import * as t from 'io-ts'; import { maxSuggestions } from '../../../observability/common'; import { getSuggestions } from '../lib/suggestions/get_suggestions'; -import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions'; +import { getSearchAggregatedTransactions } from '../lib/helpers/transactions'; import { setupRequest } from '../lib/helpers/setup_request'; import { createApmServerRoute } from './create_apm_server_route'; import { createApmServerRouteRepository } from './create_apm_server_route_repository'; diff --git a/x-pack/plugins/apm/server/routes/traces.ts b/x-pack/plugins/apm/server/routes/traces.ts index a71b7eefeed3..cc800c348b16 100644 --- a/x-pack/plugins/apm/server/routes/traces.ts +++ b/x-pack/plugins/apm/server/routes/traces.ts @@ -11,7 +11,7 @@ import { getTraceItems } from '../lib/traces/get_trace_items'; import { getTopTransactionGroupList } from '../lib/transaction_groups'; import { createApmServerRoute } from './create_apm_server_route'; import { environmentRt, kueryRt, rangeRt } from './default_api_types'; -import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions'; +import { getSearchAggregatedTransactions } from '../lib/helpers/transactions'; import { getRootTransactionByTraceId } from '../lib/transactions/get_transaction_by_trace'; import { createApmServerRouteRepository } from './create_apm_server_route_repository'; import { getTransaction } from '../lib/transactions/get_transaction'; diff --git a/x-pack/plugins/apm/server/routes/transactions.ts b/x-pack/plugins/apm/server/routes/transactions.ts index 0e24d64d8c6c..56b7ead2254d 100644 --- a/x-pack/plugins/apm/server/routes/transactions.ts +++ b/x-pack/plugins/apm/server/routes/transactions.ts @@ -11,7 +11,7 @@ import { LatencyAggregationType, latencyAggregationTypeRt, } from '../../common/latency_aggregation_types'; -import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions'; +import { getSearchAggregatedTransactions } from '../lib/helpers/transactions'; import { setupRequest } from '../lib/helpers/setup_request'; import { getServiceTransactionGroups } from '../lib/services/get_service_transaction_groups'; import { getServiceTransactionGroupDetailedStatisticsPeriods } from '../lib/services/get_service_transaction_group_detailed_statistics';