From 3004e762b3b8751ea6728258ec06a4101195391e Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 18 Nov 2021 12:45:39 +0000 Subject: [PATCH 1/2] skip flaky suites (#118921) --- x-pack/test/examples/search_examples/search_session_example.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/examples/search_examples/search_session_example.ts b/x-pack/test/examples/search_examples/search_session_example.ts index ab96a7767baff..e6261f69e14f6 100644 --- a/x-pack/test/examples/search_examples/search_session_example.ts +++ b/x-pack/test/examples/search_examples/search_session_example.ts @@ -15,7 +15,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const es = getService('es'); const searchSessions = getService('searchSessions'); - describe('Search session example', () => { + // FLAKY: https://github.com/elastic/kibana/issues/118921 + describe.skip('Search session example', () => { const appId = 'searchExamples'; before(async function () { From f7d7a344e358d0d24ae05f43bebe3a0296d2a839 Mon Sep 17 00:00:00 2001 From: Kate Patticha Date: Thu, 18 Nov 2021 13:48:04 +0100 Subject: [PATCH 2/2] [APM] Improve server file structure by colocating files related to the route (#118649) * [APM] Improve server file structure by colocate files related to the route * [APM] co-locate the rest of files * Fix unit test * Remove obsolete code * Fix broken paths in tests --- .../plugins/apm/server/deprecations/index.ts | 2 +- .../collect_data_telemetry/index.ts | 2 +- .../collect_data_telemetry/tasks.test.ts | 2 +- .../apm/server/lib/apm_telemetry/index.ts | 2 +- .../create_apm_event_client/index.ts | 2 +- .../unpack_processor_events.test.ts | 2 +- .../unpack_processor_events.ts | 2 +- .../server/lib/helpers/setup_request.test.ts | 6 +- .../apm/server/lib/helpers/setup_request.ts | 2 +- x-pack/plugins/apm/server/plugin.ts | 10 ++-- .../projections/rum_page_load_transactions.ts | 4 +- .../alerts/action_variables.ts | 0 .../alerts/alerting_es_client.ts | 0 .../chart_preview/get_transaction_duration.ts | 6 +- .../get_transaction_error_count.ts | 4 +- .../get_transaction_error_rate.ts | 8 +-- .../alerts/register_apm_alerts.ts | 0 .../register_error_count_alert_type.test.ts | 0 .../alerts/register_error_count_alert_type.ts | 2 +- ...er_transaction_duration_alert_type.test.ts | 0 ...egister_transaction_duration_alert_type.ts | 4 +- ...action_duration_anomaly_alert_type.test.ts | 0 ...transaction_duration_anomaly_alert_type.ts | 0 ..._transaction_error_rate_alert_type.test.ts | 0 ...ister_transaction_error_rate_alert_type.ts | 4 +- .../alerts/{chart_preview.ts => route.ts} | 6 +- .../alerts/test_utils/index.ts | 0 .../get_global_apm_server_route_repository.ts | 46 +++++++------- .../field_stats/get_boolean_field_stats.ts | 0 .../field_stats/get_field_stats.test.ts | 0 .../queries/field_stats/get_fields_stats.ts | 0 .../field_stats/get_keyword_field_stats.ts | 0 .../field_stats/get_numeric_field_stats.ts | 0 .../correlations/queries/get_filters.ts | 0 .../queries/get_query_with_params.test.ts | 0 .../queries/get_query_with_params.ts | 0 .../queries/get_request_base.test.ts | 0 .../correlations/queries/get_request_base.ts | 0 .../correlations/queries/index.ts | 0 .../queries/query_correlation.test.ts | 0 .../correlations/queries/query_correlation.ts | 0 .../query_correlation_with_histogram.test.ts | 0 .../query_correlation_with_histogram.ts | 0 .../queries/query_failure_correlation.ts | 0 .../queries/query_field_candidates.test.ts | 0 .../queries/query_field_candidates.ts | 0 .../queries/query_field_value_pairs.test.ts | 0 .../queries/query_field_value_pairs.ts | 0 .../queries/query_fractions.test.ts | 0 .../correlations/queries/query_fractions.ts | 0 .../queries/query_histogram.test.ts | 0 .../correlations/queries/query_histogram.ts | 0 .../query_histogram_range_steps.test.ts | 0 .../queries/query_histogram_range_steps.ts | 0 .../correlations/queries/query_p_values.ts | 0 .../queries/query_percentiles.test.ts | 0 .../correlations/queries/query_percentiles.ts | 0 .../correlations/queries/query_ranges.test.ts | 0 .../correlations/queries/query_ranges.ts | 0 .../queries/query_significant_correlations.ts | 0 .../route.ts} | 16 ++--- .../compute_expectations_and_ranges.test.ts | 0 .../utils/compute_expectations_and_ranges.ts | 0 .../correlations/utils/field_stats_utils.ts | 0 .../correlations/utils/index.ts | 0 .../utils/split_all_settled_promises.ts | 0 .../data_view/create_static_data_view.test.ts | 4 +- .../data_view/create_static_data_view.ts | 4 +- .../data_view/get_apm_data_view_title.test.ts | 0 .../data_view/get_apm_data_view_title.ts | 0 .../data_view/get_dynamic_data_view.ts | 0 .../{data_view.ts => data_view/route.ts} | 10 ++-- .../get_all_environments.test.ts.snap | 0 .../get_environments.test.ts.snap | 0 .../environments/get_all_environments.test.ts | 0 .../environments/get_all_environments.ts | 4 +- .../environments/get_environments.test.ts | 0 .../environments/get_environments.ts | 4 +- .../route.ts} | 14 ++--- .../errors/__snapshots__/queries.test.ts.snap | 0 .../__snapshots__/get_buckets.test.ts.snap | 0 .../__snapshots__/queries.test.ts.snap | 0 .../errors/distribution/get_buckets.test.ts | 0 .../errors/distribution/get_buckets.ts | 2 +- .../errors/distribution/get_distribution.ts | 2 +- .../errors/distribution/queries.test.ts | 0 .../errors/get_error_group_sample.ts | 2 +- .../errors/get_error_groups.ts | 4 +- .../{lib => routes}/errors/queries.test.ts | 0 .../routes/{errors.ts => errors/route.ts} | 14 ++--- .../event_metadata/get_event_metadata.ts | 2 +- .../route.ts} | 10 ++-- .../route.ts} | 10 ++-- .../fleet/create_cloud_apm_package_policy.ts | 2 +- .../{lib => routes}/fleet/get_agents.ts | 2 +- .../fleet/get_apm_package_policies.ts | 2 +- .../get_apm_package_policy_definition.test.ts | 0 .../get_apm_package_policy_definition.ts | 0 .../fleet/get_cloud_apm_package_policy.ts | 0 .../get_unsupported_apm_server_schema.test.ts | 0 .../get_unsupported_apm_server_schema.ts | 0 .../{lib => routes}/fleet/is_superuser.ts | 0 .../fleet/merge_package_policy_with_apm.ts | 2 +- .../fleet/register_fleet_policy_callbacks.ts | 2 +- .../routes/{fleet.ts => fleet/route.ts} | 22 +++---- .../{lib => routes}/fleet/source_maps.test.ts | 0 .../{lib => routes}/fleet/source_maps.ts | 2 +- ...c_agent_configs_to_apm_package_policies.ts | 6 +- .../get_overall_latency_distribution.ts | 0 .../get_percentile_threshold_value.ts | 0 .../route.ts} | 10 ++-- .../latency_distribution}/types.ts | 2 +- .../__snapshots__/queries.test.ts.snap | 0 .../metrics/by_agent/default.ts | 2 +- .../gc/fetch_and_transform_gc_metrics.test.ts | 2 +- .../java/gc/fetch_and_transform_gc_metrics.ts | 6 +- .../by_agent/java/gc/get_gc_rate_chart.ts | 2 +- .../by_agent/java/gc/get_gc_time_chart.ts | 2 +- .../by_agent/java/heap_memory/index.ts | 2 +- .../metrics/by_agent/java/index.ts | 2 +- .../by_agent/java/non_heap_memory/index.ts | 2 +- .../by_agent/java/thread_count/index.ts | 2 +- .../metrics/by_agent/shared/cpu/index.ts | 2 +- .../metrics/by_agent/shared/memory/index.ts | 2 +- .../metrics/fetch_and_transform_metrics.ts | 6 +- .../get_metrics_chart_data_by_agent.ts | 2 +- .../{lib => routes}/metrics/queries.test.ts | 0 .../routes/{metrics.ts => metrics/route.ts} | 10 ++-- .../server/{lib => routes}/metrics/types.ts | 0 .../get_service_count.ts | 4 +- .../get_transactions_per_minute.ts | 6 +- .../observability_overview/has_data.ts | 2 +- .../route.ts} | 18 +++--- .../__snapshots__/queries.test.ts.snap | 0 .../rum_client/get_client_metrics.ts | 2 +- .../rum_client/get_js_errors.ts | 2 +- .../rum_client/get_long_task_metrics.ts | 2 +- .../rum_client/get_page_load_distribution.ts | 2 +- .../rum_client/get_page_view_trends.ts | 2 +- .../rum_client/get_pl_dist_breakdown.ts | 2 +- .../rum_client/get_rum_services.ts | 2 +- .../rum_client/get_url_search.ts | 2 +- .../rum_client/get_visitor_breakdown.ts | 2 +- .../rum_client/get_web_core_vitals.ts | 2 +- .../rum_client/has_rum_data.ts | 2 +- .../rum_client/queries.test.ts | 0 .../{rum_client.ts => rum_client/route.ts} | 34 +++++------ .../ui_filters/get_es_filter.test.ts | 0 .../rum_client/ui_filters/get_es_filter.ts | 0 .../fetch_service_paths_from_trace_ids.ts | 2 +- .../service_map/get_service_anomalies.ts | 4 +- .../service_map/get_service_map.ts | 4 +- .../get_service_map_backend_node_info.ts | 4 +- .../get_service_map_from_trace_ids.test.ts | 0 .../get_service_map_from_trace_ids.ts | 2 +- .../get_service_map_service_node_info.test.ts | 4 +- .../get_service_map_service_node_info.ts | 6 +- .../service_map/get_trace_sample_ids.ts | 2 +- .../service_map/group_resource_nodes.test.ts | 0 .../service_map/group_resource_nodes.ts | 0 .../group_resource_nodes_grouped.json | 0 .../group_resource_nodes_pregrouped.json | 0 .../{service_map.ts => service_map/route.ts} | 22 +++---- .../transform_service_map_responses.test.ts | 0 .../transform_service_map_responses.ts | 0 .../__snapshots__/queries.test.ts.snap | 0 .../service_nodes/get_service_nodes.ts} | 2 +- .../service_nodes/queries.test.ts | 2 +- .../route.ts} | 12 ++-- .../__snapshots__/queries.test.ts.snap | 0 .../__fixtures__/multiple_versions.json | 0 .../annotations/__fixtures__/no_versions.json | 0 .../annotations/__fixtures__/one_version.json | 0 .../__fixtures__/versions_first_seen.json | 0 .../get_derived_service_annotations.ts | 4 +- .../annotations/get_stored_annotations.ts | 0 .../services/annotations/index.test.ts | 0 .../services/annotations/index.ts | 2 +- .../services/get_service_agent.ts | 2 +- .../services/get_service_alerts.ts | 0 .../services/get_service_dependencies.ts | 6 +- .../get_service_dependencies_breakdown.ts | 4 +- ...service_error_group_detailed_statistics.ts | 4 +- ...get_service_error_group_main_statistics.ts | 4 +- .../get_service_error_groups/index.ts | 6 +- .../services/get_service_infrastructure.ts | 2 +- .../get_service_instance_metadata_details.ts | 4 +- .../detailed_statistics.ts | 2 +- ...vice_instances_system_metric_statistics.ts | 4 +- ...ervice_instances_transaction_statistics.ts | 10 ++-- .../get_service_instances/main_statistics.ts | 2 +- .../services/get_service_metadata_details.ts | 4 +- .../services/get_service_metadata_icons.ts | 4 +- .../services/get_service_node_metadata.ts | 2 +- ...e_transaction_group_detailed_statistics.ts | 10 ++-- .../get_service_transaction_groups.ts | 10 ++-- .../services/get_service_transaction_types.ts | 4 +- .../get_services/get_health_statuses.ts | 2 +- .../get_services/get_legacy_data_status.ts | 2 +- .../get_service_transaction_stats.ts | 6 +- .../get_services_from_metric_documents.ts | 2 +- .../get_services/get_services_items.ts | 2 +- .../services/get_services/index.ts | 2 +- .../get_services/merge_service_stats.test.ts | 0 .../get_services/merge_service_stats.ts | 0 ...service_transaction_detailed_statistics.ts | 10 ++-- .../get_services_detailed_statistics/index.ts | 2 +- .../services/get_throughput.ts | 4 +- .../get_service_profiling_statistics.ts | 4 +- .../get_service_profiling_timeline.ts | 4 +- .../{lib => routes}/services/queries.test.ts | 0 .../routes/{services.ts => services/route.ts} | 60 +++++++++---------- .../__snapshots__/queries.test.ts.snap | 0 .../convert_settings_to_string.ts | 0 .../create_agent_config_index.ts | 0 .../create_or_update_configuration.ts | 4 +- .../delete_configuration.ts | 2 +- .../find_exact_configuration.ts | 2 +- .../get_agent_name_by_service.ts | 2 +- .../get_existing_environments_for_service.ts | 2 +- .../get_environments/index.ts | 2 +- .../agent_configuration/get_service_names.ts | 4 +- .../list_configurations.ts | 2 +- .../mark_applied_by_agent.ts | 2 +- .../agent_configuration/queries.test.ts | 0 .../route.ts} | 32 +++++----- .../search_configurations.ts | 2 +- .../route.ts} | 26 ++++---- .../settings/apm_indices/get_apm_indices.ts | 2 +- .../{apm_indices.ts => apm_indices/route.ts} | 13 ++-- .../apm_indices/save_apm_indices.test.ts | 0 .../settings/apm_indices/save_apm_indices.ts | 0 .../get_transaction.test.ts.snap | 0 .../list_custom_links.test.ts.snap | 0 .../custom_link/create_custom_link_index.ts | 0 .../create_or_update_custom_link.test.ts | 2 +- .../create_or_update_custom_link.ts | 4 +- .../settings/custom_link/custom_link_types.ts | 0 .../custom_link/delete_custom_link.ts | 2 +- .../custom_link/get_transaction.test.ts | 2 +- .../settings/custom_link/get_transaction.ts | 2 +- .../settings/custom_link/helper.test.ts | 0 .../settings/custom_link/helper.ts | 0 .../custom_link/list_custom_links.test.ts | 2 +- .../settings/custom_link/list_custom_links.ts | 2 +- .../{custom_link.ts => custom_link/route.ts} | 27 ++++----- .../{source_maps.ts => source_maps/route.ts} | 10 ++-- .../suggestions/get_suggestions.ts | 4 +- .../{suggestions.ts => suggestions/route.ts} | 12 ++-- .../traces/__snapshots__/queries.test.ts.snap | 0 .../{lib => routes}/traces/get_trace_items.ts | 2 +- .../{lib => routes}/traces/queries.test.ts | 0 .../routes/{traces.ts => traces/route.ts} | 18 +++--- .../__snapshots__/queries.test.ts.snap | 0 .../transactions/breakdown/constants.ts | 0 .../transactions/breakdown/index.test.ts | 2 +- .../transactions/breakdown/index.ts | 4 +- .../breakdown/mock_responses/data.json | 0 .../breakdown/mock_responses/no_data.json | 0 .../{lib => routes}/transactions/constants.ts | 0 .../transactions/get_anomaly_data/fetcher.ts | 2 +- .../transactions/get_anomaly_data/index.ts | 4 +- .../transactions/get_latency_charts/index.ts | 4 +- .../transactions/get_transaction/index.ts | 2 +- .../get_transaction_by_trace/index.ts | 2 +- .../transactions/queries.test.ts | 0 .../route.ts} | 26 ++++---- .../trace_samples/get_trace_samples/index.ts | 2 +- .../transactions/trace_samples/index.ts | 2 +- x-pack/plugins/apm/server/tutorial/index.ts | 4 +- x-pack/plugins/apm/server/types.ts | 2 +- .../plugins/apm/server/utils/test_helpers.tsx | 2 +- .../metrics_charts/metrics_charts.spec.ts | 2 +- .../settings/agent_configuration.spec.ts | 2 +- 274 files changed, 449 insertions(+), 455 deletions(-) rename x-pack/plugins/apm/server/{lib => routes}/alerts/action_variables.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/alerts/alerting_es_client.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/alerts/chart_preview/get_transaction_duration.ts (94%) rename x-pack/plugins/apm/server/{lib => routes}/alerts/chart_preview/get_transaction_error_count.ts (93%) rename x-pack/plugins/apm/server/{lib => routes}/alerts/chart_preview/get_transaction_error_rate.ts (91%) rename x-pack/plugins/apm/server/{lib => routes}/alerts/register_apm_alerts.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/alerts/register_error_count_alert_type.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/alerts/register_error_count_alert_type.ts (98%) rename x-pack/plugins/apm/server/{lib => routes}/alerts/register_transaction_duration_alert_type.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/alerts/register_transaction_duration_alert_type.ts (98%) rename x-pack/plugins/apm/server/{lib => routes}/alerts/register_transaction_duration_anomaly_alert_type.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/alerts/register_transaction_duration_anomaly_alert_type.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/alerts/register_transaction_error_rate_alert_type.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/alerts/register_transaction_error_rate_alert_type.ts (97%) rename x-pack/plugins/apm/server/routes/alerts/{chart_preview.ts => route.ts} (89%) rename x-pack/plugins/apm/server/{lib => routes}/alerts/test_utils/index.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/field_stats/get_boolean_field_stats.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/field_stats/get_field_stats.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/field_stats/get_fields_stats.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/field_stats/get_keyword_field_stats.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/field_stats/get_numeric_field_stats.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/get_filters.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/get_query_with_params.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/get_query_with_params.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/get_request_base.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/get_request_base.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/index.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_correlation.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_correlation.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_correlation_with_histogram.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_correlation_with_histogram.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_failure_correlation.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_field_candidates.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_field_candidates.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_field_value_pairs.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_field_value_pairs.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_fractions.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_fractions.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_histogram.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_histogram.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_histogram_range_steps.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_histogram_range_steps.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_p_values.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_percentiles.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_percentiles.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_ranges.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_ranges.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/queries/query_significant_correlations.ts (100%) rename x-pack/plugins/apm/server/routes/{correlations.ts => correlations/route.ts} (92%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/utils/compute_expectations_and_ranges.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/utils/compute_expectations_and_ranges.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/utils/field_stats_utils.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/utils/index.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/correlations/utils/split_all_settled_promises.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/data_view/create_static_data_view.test.ts (96%) rename x-pack/plugins/apm/server/{lib => routes}/data_view/create_static_data_view.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/data_view/get_apm_data_view_title.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/data_view/get_apm_data_view_title.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/data_view/get_dynamic_data_view.ts (100%) rename x-pack/plugins/apm/server/routes/{data_view.ts => data_view/route.ts} (78%) rename x-pack/plugins/apm/server/{lib => routes}/environments/__snapshots__/get_all_environments.test.ts.snap (100%) rename x-pack/plugins/apm/server/{lib => routes}/environments/__snapshots__/get_environments.test.ts.snap (100%) rename x-pack/plugins/apm/server/{lib => routes}/environments/get_all_environments.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/environments/get_all_environments.ts (93%) rename x-pack/plugins/apm/server/{lib => routes}/environments/get_environments.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/environments/get_environments.ts (93%) rename x-pack/plugins/apm/server/routes/{environments.ts => environments/route.ts} (72%) rename x-pack/plugins/apm/server/{lib => routes}/errors/__snapshots__/queries.test.ts.snap (100%) rename x-pack/plugins/apm/server/{lib => routes}/errors/distribution/__snapshots__/get_buckets.test.ts.snap (100%) rename x-pack/plugins/apm/server/{lib => routes}/errors/distribution/__snapshots__/queries.test.ts.snap (100%) rename x-pack/plugins/apm/server/{lib => routes}/errors/distribution/get_buckets.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/errors/distribution/get_buckets.ts (96%) rename x-pack/plugins/apm/server/{lib => routes}/errors/distribution/get_distribution.ts (96%) rename x-pack/plugins/apm/server/{lib => routes}/errors/distribution/queries.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/errors/get_error_group_sample.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/errors/get_error_groups.ts (96%) rename x-pack/plugins/apm/server/{lib => routes}/errors/queries.test.ts (100%) rename x-pack/plugins/apm/server/routes/{errors.ts => errors/route.ts} (86%) rename x-pack/plugins/apm/server/{lib => routes}/event_metadata/get_event_metadata.ts (93%) rename x-pack/plugins/apm/server/routes/{event_metadata.ts => event_metadata/route.ts} (72%) rename x-pack/plugins/apm/server/routes/{fallback_to_transactions.ts => fallback_to_transactions/route.ts} (70%) rename x-pack/plugins/apm/server/{lib => routes}/fleet/create_cloud_apm_package_policy.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/fleet/get_agents.ts (89%) rename x-pack/plugins/apm/server/{lib => routes}/fleet/get_apm_package_policies.ts (89%) rename x-pack/plugins/apm/server/{lib => routes}/fleet/get_apm_package_policy_definition.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/fleet/get_apm_package_policy_definition.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/fleet/get_cloud_apm_package_policy.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/fleet/get_unsupported_apm_server_schema.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/fleet/get_unsupported_apm_server_schema.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/fleet/is_superuser.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/fleet/merge_package_policy_with_apm.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/fleet/register_fleet_policy_callbacks.ts (98%) rename x-pack/plugins/apm/server/routes/{fleet.ts => fleet/route.ts} (89%) rename x-pack/plugins/apm/server/{lib => routes}/fleet/source_maps.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/fleet/source_maps.ts (98%) rename x-pack/plugins/apm/server/{lib => routes}/fleet/sync_agent_configs_to_apm_package_policies.ts (90%) rename x-pack/plugins/apm/server/{lib/latency => routes/latency_distribution}/get_overall_latency_distribution.ts (100%) rename x-pack/plugins/apm/server/{lib/latency => routes/latency_distribution}/get_percentile_threshold_value.ts (100%) rename x-pack/plugins/apm/server/routes/{latency_distribution.ts => latency_distribution/route.ts} (80%) rename x-pack/plugins/apm/server/{lib/latency => routes/latency_distribution}/types.ts (92%) rename x-pack/plugins/apm/server/{lib => routes}/metrics/__snapshots__/queries.test.ts.snap (100%) rename x-pack/plugins/apm/server/{lib => routes}/metrics/by_agent/default.ts (92%) rename x-pack/plugins/apm/server/{lib => routes}/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.test.ts (98%) rename x-pack/plugins/apm/server/{lib => routes}/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/metrics/by_agent/java/gc/get_gc_rate_chart.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/metrics/by_agent/java/gc/get_gc_time_chart.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/metrics/by_agent/java/heap_memory/index.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/metrics/by_agent/java/index.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/metrics/by_agent/java/non_heap_memory/index.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/metrics/by_agent/java/thread_count/index.ts (96%) rename x-pack/plugins/apm/server/{lib => routes}/metrics/by_agent/shared/cpu/index.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/metrics/by_agent/shared/memory/index.ts (98%) rename x-pack/plugins/apm/server/{lib => routes}/metrics/fetch_and_transform_metrics.ts (94%) rename x-pack/plugins/apm/server/{lib => routes}/metrics/get_metrics_chart_data_by_agent.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/metrics/queries.test.ts (100%) rename x-pack/plugins/apm/server/routes/{metrics.ts => metrics/route.ts} (76%) rename x-pack/plugins/apm/server/{lib => routes}/metrics/types.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/observability_overview/get_service_count.ts (90%) rename x-pack/plugins/apm/server/{lib => routes}/observability_overview/get_transactions_per_minute.ts (93%) rename x-pack/plugins/apm/server/{lib => routes}/observability_overview/has_data.ts (94%) rename x-pack/plugins/apm/server/routes/{observability_overview.ts => observability_overview/route.ts} (74%) rename x-pack/plugins/apm/server/{lib => routes}/rum_client/__snapshots__/queries.test.ts.snap (100%) rename x-pack/plugins/apm/server/{lib => routes}/rum_client/get_client_metrics.ts (98%) rename x-pack/plugins/apm/server/{lib => routes}/rum_client/get_js_errors.ts (98%) rename x-pack/plugins/apm/server/{lib => routes}/rum_client/get_long_task_metrics.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/rum_client/get_page_load_distribution.ts (99%) rename x-pack/plugins/apm/server/{lib => routes}/rum_client/get_page_view_trends.ts (98%) rename x-pack/plugins/apm/server/{lib => routes}/rum_client/get_pl_dist_breakdown.ts (98%) rename x-pack/plugins/apm/server/{lib => routes}/rum_client/get_rum_services.ts (96%) rename x-pack/plugins/apm/server/{lib => routes}/rum_client/get_url_search.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/rum_client/get_visitor_breakdown.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/rum_client/get_web_core_vitals.ts (98%) rename x-pack/plugins/apm/server/{lib => routes}/rum_client/has_rum_data.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/rum_client/queries.test.ts (100%) rename x-pack/plugins/apm/server/routes/{rum_client.ts => rum_client/route.ts} (87%) rename x-pack/plugins/apm/server/{lib => routes}/rum_client/ui_filters/get_es_filter.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/rum_client/ui_filters/get_es_filter.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/service_map/fetch_service_paths_from_trace_ids.ts (99%) rename x-pack/plugins/apm/server/{lib => routes}/service_map/get_service_anomalies.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/service_map/get_service_map.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/service_map/get_service_map_backend_node_info.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/service_map/get_service_map_from_trace_ids.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/service_map/get_service_map_from_trace_ids.ts (96%) rename x-pack/plugins/apm/server/{lib => routes}/service_map/get_service_map_service_node_info.test.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/service_map/get_service_map_service_node_info.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/service_map/get_trace_sample_ids.ts (98%) rename x-pack/plugins/apm/server/{lib => routes}/service_map/group_resource_nodes.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/service_map/group_resource_nodes.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/service_map/mock_responses/group_resource_nodes_grouped.json (100%) rename x-pack/plugins/apm/server/{lib => routes}/service_map/mock_responses/group_resource_nodes_pregrouped.json (100%) rename x-pack/plugins/apm/server/routes/{service_map.ts => service_map/route.ts} (81%) rename x-pack/plugins/apm/server/{lib => routes}/service_map/transform_service_map_responses.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/service_map/transform_service_map_responses.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/service_nodes/__snapshots__/queries.test.ts.snap (100%) rename x-pack/plugins/apm/server/{lib/service_nodes/index.ts => routes/service_nodes/get_service_nodes.ts} (98%) rename x-pack/plugins/apm/server/{lib => routes}/service_nodes/queries.test.ts (96%) rename x-pack/plugins/apm/server/routes/{service_nodes.ts => service_nodes/route.ts} (72%) rename x-pack/plugins/apm/server/{lib => routes}/services/__snapshots__/queries.test.ts.snap (100%) rename x-pack/plugins/apm/server/{lib => routes}/services/annotations/__fixtures__/multiple_versions.json (100%) rename x-pack/plugins/apm/server/{lib => routes}/services/annotations/__fixtures__/no_versions.json (100%) rename x-pack/plugins/apm/server/{lib => routes}/services/annotations/__fixtures__/one_version.json (100%) rename x-pack/plugins/apm/server/{lib => routes}/services/annotations/__fixtures__/versions_first_seen.json (100%) rename x-pack/plugins/apm/server/{lib => routes}/services/annotations/get_derived_service_annotations.ts (96%) rename x-pack/plugins/apm/server/{lib => routes}/services/annotations/get_stored_annotations.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/services/annotations/index.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/services/annotations/index.ts (96%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_agent.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_alerts.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_dependencies.ts (77%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_dependencies_breakdown.ts (90%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_error_groups/get_service_error_group_detailed_statistics.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_error_groups/get_service_error_group_main_statistics.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_error_groups/index.ts (96%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_infrastructure.ts (96%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_instance_metadata_details.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_instances/detailed_statistics.ts (98%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_instances/get_service_instances_system_metric_statistics.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_instances/get_service_instances_transaction_statistics.ts (94%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_instances/main_statistics.ts (96%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_metadata_details.ts (96%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_metadata_icons.ts (94%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_node_metadata.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_transaction_group_detailed_statistics.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_transaction_groups.ts (92%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_service_transaction_types.ts (94%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_services/get_health_statuses.ts (92%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_services/get_legacy_data_status.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_services/get_service_transaction_stats.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_services/get_services_from_metric_documents.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_services/get_services_items.ts (96%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_services/index.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_services/merge_service_stats.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_services/merge_service_stats.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_services_detailed_statistics/get_service_transaction_detailed_statistics.ts (92%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_services_detailed_statistics/index.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/services/get_throughput.ts (96%) rename x-pack/plugins/apm/server/{lib => routes}/services/profiling/get_service_profiling_statistics.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/services/profiling/get_service_profiling_timeline.ts (96%) rename x-pack/plugins/apm/server/{lib => routes}/services/queries.test.ts (100%) rename x-pack/plugins/apm/server/routes/{services.ts => services/route.ts} (89%) rename x-pack/plugins/apm/server/{lib => routes}/settings/agent_configuration/__snapshots__/queries.test.ts.snap (100%) rename x-pack/plugins/apm/server/{lib => routes}/settings/agent_configuration/convert_settings_to_string.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/settings/agent_configuration/create_agent_config_index.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/settings/agent_configuration/create_or_update_configuration.ts (89%) rename x-pack/plugins/apm/server/{lib => routes}/settings/agent_configuration/delete_configuration.ts (91%) rename x-pack/plugins/apm/server/{lib => routes}/settings/agent_configuration/find_exact_configuration.ts (96%) rename x-pack/plugins/apm/server/{lib => routes}/settings/agent_configuration/get_agent_name_by_service.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/settings/agent_configuration/get_environments/get_existing_environments_for_service.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/settings/agent_configuration/get_environments/index.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/settings/agent_configuration/get_service_names.ts (90%) rename x-pack/plugins/apm/server/{lib => routes}/settings/agent_configuration/list_configurations.ts (93%) rename x-pack/plugins/apm/server/{lib => routes}/settings/agent_configuration/mark_applied_by_agent.ts (93%) rename x-pack/plugins/apm/server/{lib => routes}/settings/agent_configuration/queries.test.ts (100%) rename x-pack/plugins/apm/server/routes/settings/{agent_configuration.ts => agent_configuration/route.ts} (86%) rename x-pack/plugins/apm/server/{lib => routes}/settings/agent_configuration/search_configurations.ts (97%) rename x-pack/plugins/apm/server/routes/settings/{anomaly_detection.ts => anomaly_detection/route.ts} (74%) rename x-pack/plugins/apm/server/{lib => routes}/settings/apm_indices/get_apm_indices.ts (97%) rename x-pack/plugins/apm/server/routes/settings/{apm_indices.ts => apm_indices/route.ts} (82%) rename x-pack/plugins/apm/server/{lib => routes}/settings/apm_indices/save_apm_indices.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/settings/apm_indices/save_apm_indices.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/settings/custom_link/__snapshots__/get_transaction.test.ts.snap (100%) rename x-pack/plugins/apm/server/{lib => routes}/settings/custom_link/__snapshots__/list_custom_links.test.ts.snap (100%) rename x-pack/plugins/apm/server/{lib => routes}/settings/custom_link/create_custom_link_index.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/settings/custom_link/create_or_update_custom_link.test.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/settings/custom_link/create_or_update_custom_link.ts (86%) rename x-pack/plugins/apm/server/{lib => routes}/settings/custom_link/custom_link_types.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/settings/custom_link/delete_custom_link.ts (90%) rename x-pack/plugins/apm/server/{lib => routes}/settings/custom_link/get_transaction.test.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/settings/custom_link/get_transaction.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/settings/custom_link/helper.test.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/settings/custom_link/helper.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/settings/custom_link/list_custom_links.test.ts (94%) rename x-pack/plugins/apm/server/{lib => routes}/settings/custom_link/list_custom_links.ts (96%) rename x-pack/plugins/apm/server/routes/settings/{custom_link.ts => custom_link/route.ts} (79%) rename x-pack/plugins/apm/server/routes/{source_maps.ts => source_maps/route.ts} (91%) rename x-pack/plugins/apm/server/{lib => routes}/suggestions/get_suggestions.ts (87%) rename x-pack/plugins/apm/server/routes/{suggestions.ts => suggestions/route.ts} (72%) rename x-pack/plugins/apm/server/{lib => routes}/traces/__snapshots__/queries.test.ts.snap (100%) rename x-pack/plugins/apm/server/{lib => routes}/traces/get_trace_items.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/traces/queries.test.ts (100%) rename x-pack/plugins/apm/server/routes/{traces.ts => traces/route.ts} (79%) rename x-pack/plugins/apm/server/{lib => routes}/transactions/__snapshots__/queries.test.ts.snap (100%) rename x-pack/plugins/apm/server/{lib => routes}/transactions/breakdown/constants.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/transactions/breakdown/index.test.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/transactions/breakdown/index.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/transactions/breakdown/mock_responses/data.json (100%) rename x-pack/plugins/apm/server/{lib => routes}/transactions/breakdown/mock_responses/no_data.json (100%) rename x-pack/plugins/apm/server/{lib => routes}/transactions/constants.ts (100%) rename x-pack/plugins/apm/server/{lib => routes}/transactions/get_anomaly_data/fetcher.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/transactions/get_anomaly_data/index.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/transactions/get_latency_charts/index.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/transactions/get_transaction/index.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/transactions/get_transaction_by_trace/index.ts (95%) rename x-pack/plugins/apm/server/{lib => routes}/transactions/queries.test.ts (100%) rename x-pack/plugins/apm/server/routes/{transactions.ts => transactions/route.ts} (90%) rename x-pack/plugins/apm/server/{lib => routes}/transactions/trace_samples/get_trace_samples/index.ts (97%) rename x-pack/plugins/apm/server/{lib => routes}/transactions/trace_samples/index.ts (95%) diff --git a/x-pack/plugins/apm/server/deprecations/index.ts b/x-pack/plugins/apm/server/deprecations/index.ts index 39e282e76d9a6..92955fa0c6d0b 100644 --- a/x-pack/plugins/apm/server/deprecations/index.ts +++ b/x-pack/plugins/apm/server/deprecations/index.ts @@ -9,7 +9,7 @@ import { GetDeprecationsContext, DeprecationsDetails } from 'src/core/server'; import { i18n } from '@kbn/i18n'; import { isEmpty } from 'lodash'; import { CloudSetup } from '../../../cloud/server'; -import { getCloudAgentPolicy } from '../lib/fleet/get_cloud_apm_package_policy'; +import { getCloudAgentPolicy } from '../routes/fleet/get_cloud_apm_package_policy'; import { APMRouteHandlerResources } from '../'; export function getDeprecations({ diff --git a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/index.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/index.ts index 9b5820767690f..8aee60357ba73 100644 --- a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/index.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/index.ts @@ -12,7 +12,7 @@ import { ESSearchRequest, ESSearchResponse, } from '../../../../../../../src/core/types/elasticsearch'; -import { ApmIndicesConfig } from '../../settings/apm_indices/get_apm_indices'; +import { ApmIndicesConfig } from '../../../routes/settings/apm_indices/get_apm_indices'; import { tasks } from './tasks'; import { APMDataTelemetry } from '../types'; diff --git a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts index 1e697ebdcae06..b69aa1e6e0196 100644 --- a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ApmIndicesConfig } from '../../settings/apm_indices/get_apm_indices'; +import { ApmIndicesConfig } from '../../../routes/settings/apm_indices/get_apm_indices'; import { tasks } from './tasks'; import { SERVICE_NAME, diff --git a/x-pack/plugins/apm/server/lib/apm_telemetry/index.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/index.ts index 88ef1203bae9f..bdbb1fe1dbcd3 100644 --- a/x-pack/plugins/apm/server/lib/apm_telemetry/index.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/index.ts @@ -24,7 +24,7 @@ import { APM_TELEMETRY_SAVED_OBJECT_TYPE, } from '../../../common/apm_saved_object_constants'; import { getInternalSavedObjectsClient } from '../helpers/get_internal_saved_objects_client'; -import { getApmIndices } from '../settings/apm_indices/get_apm_indices'; +import { getApmIndices } from '../../routes/settings/apm_indices/get_apm_indices'; import { collectDataTelemetry, CollectTelemetryParams, diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.ts index a45d314c33719..6c9a0cb45e273 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.ts @@ -26,7 +26,7 @@ import { APMError } from '../../../../../typings/es_schemas/ui/apm_error'; import { Metric } from '../../../../../typings/es_schemas/ui/metric'; import { Span } from '../../../../../typings/es_schemas/ui/span'; import { Transaction } from '../../../../../typings/es_schemas/ui/transaction'; -import { ApmIndicesConfig } from '../../../settings/apm_indices/get_apm_indices'; +import { ApmIndicesConfig } from '../../../../routes/settings/apm_indices/get_apm_indices'; import { callAsyncWithDebug, getDebugBody, diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts index 5ef3786e9bde4..d3f0fca0bb259 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts @@ -6,7 +6,7 @@ */ import { APMEventESSearchRequest } from '.'; -import { ApmIndicesConfig } from '../../../settings/apm_indices/get_apm_indices'; +import { ApmIndicesConfig } from '../../../../routes/settings/apm_indices/get_apm_indices'; import { unpackProcessorEvents } from './unpack_processor_events'; describe('unpackProcessorEvents', () => { diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts index 582fe0374c5ca..e62720e9fbd0c 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts @@ -13,7 +13,7 @@ import { ESFilter, } from '../../../../../../../../src/core/types/elasticsearch'; import { APMEventESSearchRequest, APMEventESTermsEnumRequest } from '.'; -import { ApmIndicesConfig } from '../../../settings/apm_indices/get_apm_indices'; +import { ApmIndicesConfig } from '../../../../routes/settings/apm_indices/get_apm_indices'; const processorEventIndexMap = { [ProcessorEvent.transaction]: 'transaction', diff --git a/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts b/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts index 7b3201095106e..ffcbe01b7f043 100644 --- a/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts +++ b/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts @@ -10,10 +10,10 @@ import { APMConfig } from '../..'; import { APMRouteHandlerResources } from '../../routes/typings'; import { ProcessorEvent } from '../../../common/processor_event'; import { PROCESSOR_EVENT } from '../../../common/elasticsearch_fieldnames'; -import { getApmIndices } from '../settings/apm_indices/get_apm_indices'; +import { getApmIndices } from '../../routes/settings/apm_indices/get_apm_indices'; import { PromiseReturnType } from '../../../../observability/typings/common'; -jest.mock('../settings/apm_indices/get_apm_indices', () => ({ +jest.mock('../../routes/settings/apm_indices/get_apm_indices', () => ({ getApmIndices: async () => ({ sourcemap: 'apm-*', @@ -26,7 +26,7 @@ jest.mock('../settings/apm_indices/get_apm_indices', () => ({ } as PromiseReturnType), })); -jest.mock('../data_view/get_dynamic_data_view', () => ({ +jest.mock('../../routes/data_view/get_dynamic_data_view', () => ({ getDynamicDataView: async () => { return; }, diff --git a/x-pack/plugins/apm/server/lib/helpers/setup_request.ts b/x-pack/plugins/apm/server/lib/helpers/setup_request.ts index a0d908c68d84d..85fb94dd765b0 100644 --- a/x-pack/plugins/apm/server/lib/helpers/setup_request.ts +++ b/x-pack/plugins/apm/server/lib/helpers/setup_request.ts @@ -13,7 +13,7 @@ import { APMRouteHandlerResources } from '../../routes/typings'; import { ApmIndicesConfig, getApmIndices, -} from '../settings/apm_indices/get_apm_indices'; +} from '../../routes/settings/apm_indices/get_apm_indices'; import { APMEventClient, createApmEventClient, diff --git a/x-pack/plugins/apm/server/plugin.ts b/x-pack/plugins/apm/server/plugin.ts index b273fc867e5a8..9ece2c507847e 100644 --- a/x-pack/plugins/apm/server/plugin.ts +++ b/x-pack/plugins/apm/server/plugin.ts @@ -20,14 +20,14 @@ import { Dataset } from '../../rule_registry/server'; import { APMConfig, APM_SERVER_FEATURE_ID } from '.'; import { UI_SETTINGS } from '../../../../src/plugins/data/common'; import { APM_FEATURE, registerFeaturesUsage } from './feature'; -import { registerApmAlerts } from './lib/alerts/register_apm_alerts'; -import { registerFleetPolicyCallbacks } from './lib/fleet/register_fleet_policy_callbacks'; +import { registerApmAlerts } from './routes/alerts/register_apm_alerts'; +import { registerFleetPolicyCallbacks } from './routes/fleet/register_fleet_policy_callbacks'; import { createApmTelemetry } from './lib/apm_telemetry'; import { createApmEventClient } from './lib/helpers/create_es_client/create_apm_event_client'; import { getInternalSavedObjectsClient } from './lib/helpers/get_internal_saved_objects_client'; -import { createApmAgentConfigurationIndex } from './lib/settings/agent_configuration/create_agent_config_index'; -import { getApmIndices } from './lib/settings/apm_indices/get_apm_indices'; -import { createApmCustomLinkIndex } from './lib/settings/custom_link/create_custom_link_index'; +import { createApmAgentConfigurationIndex } from './routes/settings/agent_configuration/create_agent_config_index'; +import { getApmIndices } from './routes/settings/apm_indices/get_apm_indices'; +import { createApmCustomLinkIndex } from './routes/settings/custom_link/create_custom_link_index'; import { apmIndices, apmTelemetry, apmServerSettings } from './saved_objects'; import type { ApmPluginRequestHandlerContext, diff --git a/x-pack/plugins/apm/server/projections/rum_page_load_transactions.ts b/x-pack/plugins/apm/server/projections/rum_page_load_transactions.ts index 6265ee71c27e1..e3e98cc3c1773 100644 --- a/x-pack/plugins/apm/server/projections/rum_page_load_transactions.ts +++ b/x-pack/plugins/apm/server/projections/rum_page_load_transactions.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SetupUX } from '../routes/rum_client'; +import { SetupUX } from '../routes/rum_client/route'; import { AGENT_NAME, TRANSACTION_TYPE, @@ -14,7 +14,7 @@ import { import { rangeQuery } from '../../../observability/server'; import { ProcessorEvent } from '../../common/processor_event'; import { TRANSACTION_PAGE_LOAD } from '../../common/transaction_types'; -import { getEsFilter } from '../lib/rum_client/ui_filters/get_es_filter'; +import { getEsFilter } from '../routes/rum_client/ui_filters/get_es_filter'; export function getRumPageLoadTransactionsProjection({ setup, diff --git a/x-pack/plugins/apm/server/lib/alerts/action_variables.ts b/x-pack/plugins/apm/server/routes/alerts/action_variables.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/alerts/action_variables.ts rename to x-pack/plugins/apm/server/routes/alerts/action_variables.ts diff --git a/x-pack/plugins/apm/server/lib/alerts/alerting_es_client.ts b/x-pack/plugins/apm/server/routes/alerts/alerting_es_client.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/alerts/alerting_es_client.ts rename to x-pack/plugins/apm/server/routes/alerts/alerting_es_client.ts diff --git a/x-pack/plugins/apm/server/lib/alerts/chart_preview/get_transaction_duration.ts b/x-pack/plugins/apm/server/routes/alerts/chart_preview/get_transaction_duration.ts similarity index 94% rename from x-pack/plugins/apm/server/lib/alerts/chart_preview/get_transaction_duration.ts rename to x-pack/plugins/apm/server/routes/alerts/chart_preview/get_transaction_duration.ts index 693502d7629e8..0338f78a0a892 100644 --- a/x-pack/plugins/apm/server/lib/alerts/chart_preview/get_transaction_duration.ts +++ b/x-pack/plugins/apm/server/routes/alerts/chart_preview/get_transaction_duration.ts @@ -12,14 +12,14 @@ import { TRANSACTION_TYPE, } from '../../../../common/elasticsearch_fieldnames'; import { environmentQuery } from '../../../../common/utils/environment_query'; -import { AlertParams } from '../../../routes/alerts/chart_preview'; +import { AlertParams } from '../route'; import { getSearchAggregatedTransactions, getDocumentTypeFilterForTransactions, getTransactionDurationFieldForTransactions, getProcessorEventForTransactions, -} from '../../helpers/transactions'; -import { Setup } from '../../helpers/setup_request'; +} from '../../../lib/helpers/transactions'; +import { Setup } from '../../../lib/helpers/setup_request'; export async function getTransactionDurationChartPreview({ alertParams, diff --git a/x-pack/plugins/apm/server/lib/alerts/chart_preview/get_transaction_error_count.ts b/x-pack/plugins/apm/server/routes/alerts/chart_preview/get_transaction_error_count.ts similarity index 93% rename from x-pack/plugins/apm/server/lib/alerts/chart_preview/get_transaction_error_count.ts rename to x-pack/plugins/apm/server/routes/alerts/chart_preview/get_transaction_error_count.ts index 0e1fa74199f60..708acd6d7f8ea 100644 --- a/x-pack/plugins/apm/server/lib/alerts/chart_preview/get_transaction_error_count.ts +++ b/x-pack/plugins/apm/server/routes/alerts/chart_preview/get_transaction_error_count.ts @@ -7,10 +7,10 @@ import { SERVICE_NAME } from '../../../../common/elasticsearch_fieldnames'; import { ProcessorEvent } from '../../../../common/processor_event'; -import { AlertParams } from '../../../routes/alerts/chart_preview'; +import { AlertParams } from '../route'; import { rangeQuery, termQuery } from '../../../../../observability/server'; import { environmentQuery } from '../../../../common/utils/environment_query'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; export async function getTransactionErrorCountChartPreview({ setup, diff --git a/x-pack/plugins/apm/server/lib/alerts/chart_preview/get_transaction_error_rate.ts b/x-pack/plugins/apm/server/routes/alerts/chart_preview/get_transaction_error_rate.ts similarity index 91% rename from x-pack/plugins/apm/server/lib/alerts/chart_preview/get_transaction_error_rate.ts rename to x-pack/plugins/apm/server/routes/alerts/chart_preview/get_transaction_error_rate.ts index e2bfaf29f83cb..cf3380c105ac8 100644 --- a/x-pack/plugins/apm/server/lib/alerts/chart_preview/get_transaction_error_rate.ts +++ b/x-pack/plugins/apm/server/routes/alerts/chart_preview/get_transaction_error_rate.ts @@ -11,17 +11,17 @@ import { TRANSACTION_TYPE, } from '../../../../common/elasticsearch_fieldnames'; import { environmentQuery } from '../../../../common/utils/environment_query'; -import { AlertParams } from '../../../routes/alerts/chart_preview'; +import { AlertParams } from '../route'; import { getSearchAggregatedTransactions, getDocumentTypeFilterForTransactions, getProcessorEventForTransactions, -} from '../../helpers/transactions'; -import { Setup } from '../../helpers/setup_request'; +} from '../../../lib/helpers/transactions'; +import { Setup } from '../../../lib/helpers/setup_request'; import { calculateFailedTransactionRate, getOutcomeAggregation, -} from '../../helpers/transaction_error_rate'; +} from '../../../lib/helpers/transaction_error_rate'; export async function getTransactionErrorRateChartPreview({ setup, diff --git a/x-pack/plugins/apm/server/lib/alerts/register_apm_alerts.ts b/x-pack/plugins/apm/server/routes/alerts/register_apm_alerts.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/alerts/register_apm_alerts.ts rename to x-pack/plugins/apm/server/routes/alerts/register_apm_alerts.ts diff --git a/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.test.ts b/x-pack/plugins/apm/server/routes/alerts/register_error_count_alert_type.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.test.ts rename to x-pack/plugins/apm/server/routes/alerts/register_error_count_alert_type.test.ts diff --git a/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts b/x-pack/plugins/apm/server/routes/alerts/register_error_count_alert_type.ts similarity index 98% rename from x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts rename to x-pack/plugins/apm/server/routes/alerts/register_error_count_alert_type.ts index 723f52cb1eeda..2dacb5ca1e895 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts +++ b/x-pack/plugins/apm/server/routes/alerts/register_error_count_alert_type.ts @@ -31,7 +31,7 @@ import { } from '../../../common/elasticsearch_fieldnames'; import { ProcessorEvent } from '../../../common/processor_event'; import { environmentQuery } from '../../../common/utils/environment_query'; -import { getApmIndices } from '../settings/apm_indices/get_apm_indices'; +import { getApmIndices } from '../../routes/settings/apm_indices/get_apm_indices'; import { apmActionVariables } from './action_variables'; import { alertingEsClient } from './alerting_es_client'; import { RegisterRuleDependencies } from './register_apm_alerts'; diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.test.ts b/x-pack/plugins/apm/server/routes/alerts/register_transaction_duration_alert_type.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.test.ts rename to x-pack/plugins/apm/server/routes/alerts/register_transaction_duration_alert_type.test.ts diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts b/x-pack/plugins/apm/server/routes/alerts/register_transaction_duration_alert_type.ts similarity index 98% rename from x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts rename to x-pack/plugins/apm/server/routes/alerts/register_transaction_duration_alert_type.ts index 4e68ca6b52248..1e39b02655ada 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts +++ b/x-pack/plugins/apm/server/routes/alerts/register_transaction_duration_alert_type.ts @@ -37,8 +37,8 @@ import { getDurationFormatter } from '../../../common/utils/formatters'; import { getDocumentTypeFilterForTransactions, getTransactionDurationFieldForTransactions, -} from '../helpers/transactions'; -import { getApmIndices } from '../settings/apm_indices/get_apm_indices'; +} from '../../lib/helpers/transactions'; +import { getApmIndices } from '../../routes/settings/apm_indices/get_apm_indices'; import { apmActionVariables } from './action_variables'; import { alertingEsClient } from './alerting_es_client'; import { RegisterRuleDependencies } from './register_apm_alerts'; diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.test.ts b/x-pack/plugins/apm/server/routes/alerts/register_transaction_duration_anomaly_alert_type.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.test.ts rename to x-pack/plugins/apm/server/routes/alerts/register_transaction_duration_anomaly_alert_type.test.ts diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.ts b/x-pack/plugins/apm/server/routes/alerts/register_transaction_duration_anomaly_alert_type.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.ts rename to x-pack/plugins/apm/server/routes/alerts/register_transaction_duration_anomaly_alert_type.ts diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.test.ts b/x-pack/plugins/apm/server/routes/alerts/register_transaction_error_rate_alert_type.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.test.ts rename to x-pack/plugins/apm/server/routes/alerts/register_transaction_error_rate_alert_type.test.ts diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts b/x-pack/plugins/apm/server/routes/alerts/register_transaction_error_rate_alert_type.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts rename to x-pack/plugins/apm/server/routes/alerts/register_transaction_error_rate_alert_type.ts index cf5b45d901228..f196b718968da 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts +++ b/x-pack/plugins/apm/server/routes/alerts/register_transaction_error_rate_alert_type.ts @@ -35,12 +35,12 @@ import { EventOutcome } from '../../../common/event_outcome'; import { ProcessorEvent } from '../../../common/processor_event'; import { asDecimalOrInteger } from '../../../common/utils/formatters'; import { environmentQuery } from '../../../common/utils/environment_query'; -import { getApmIndices } from '../settings/apm_indices/get_apm_indices'; +import { getApmIndices } from '../../routes/settings/apm_indices/get_apm_indices'; import { apmActionVariables } from './action_variables'; import { alertingEsClient } from './alerting_es_client'; import { RegisterRuleDependencies } from './register_apm_alerts'; import { SearchAggregatedTransactionSetting } from '../../../common/aggregated_transactions'; -import { getDocumentTypeFilterForTransactions } from '../helpers/transactions'; +import { getDocumentTypeFilterForTransactions } from '../../lib/helpers/transactions'; import { asPercent } from '../../../../observability/common/utils/formatters'; import { termQuery } from '../../../../observability/server'; diff --git a/x-pack/plugins/apm/server/routes/alerts/chart_preview.ts b/x-pack/plugins/apm/server/routes/alerts/route.ts similarity index 89% rename from x-pack/plugins/apm/server/routes/alerts/chart_preview.ts rename to x-pack/plugins/apm/server/routes/alerts/route.ts index cae35c7f06a85..49baeda8d3a47 100644 --- a/x-pack/plugins/apm/server/routes/alerts/chart_preview.ts +++ b/x-pack/plugins/apm/server/routes/alerts/route.ts @@ -6,9 +6,9 @@ */ import * as t from 'io-ts'; -import { getTransactionDurationChartPreview } from '../../lib/alerts/chart_preview/get_transaction_duration'; -import { getTransactionErrorCountChartPreview } from '../../lib/alerts/chart_preview/get_transaction_error_count'; -import { getTransactionErrorRateChartPreview } from '../../lib/alerts/chart_preview/get_transaction_error_rate'; +import { getTransactionDurationChartPreview } from './chart_preview/get_transaction_duration'; +import { getTransactionErrorCountChartPreview } from './chart_preview/get_transaction_error_count'; +import { getTransactionErrorRateChartPreview } from './chart_preview/get_transaction_error_rate'; import { setupRequest } from '../../lib/helpers/setup_request'; import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; diff --git a/x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts b/x-pack/plugins/apm/server/routes/alerts/test_utils/index.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts rename to x-pack/plugins/apm/server/routes/alerts/test_utils/index.ts diff --git a/x-pack/plugins/apm/server/routes/apm_routes/get_global_apm_server_route_repository.ts b/x-pack/plugins/apm/server/routes/apm_routes/get_global_apm_server_route_repository.ts index fa8bc1e54ebfb..ee4c9d1c8cfa5 100644 --- a/x-pack/plugins/apm/server/routes/apm_routes/get_global_apm_server_route_repository.ts +++ b/x-pack/plugins/apm/server/routes/apm_routes/get_global_apm_server_route_repository.ts @@ -10,33 +10,33 @@ import type { EndpointOf, } from '@kbn/server-route-repository'; import { PickByValue } from 'utility-types'; -import { correlationsRouteRepository } from '../correlations'; -import { alertsChartPreviewRouteRepository } from '../alerts/chart_preview'; +import { correlationsRouteRepository } from '../correlations/route'; +import { alertsChartPreviewRouteRepository } from '../alerts/route'; import { backendsRouteRepository } from '../backends/route'; import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; -import { environmentsRouteRepository } from '../environments'; -import { errorsRouteRepository } from '../errors'; -import { apmFleetRouteRepository } from '../fleet'; -import { dataViewRouteRepository } from '../data_view'; -import { latencyDistributionRouteRepository } from '../latency_distribution'; -import { metricsRouteRepository } from '../metrics'; -import { observabilityOverviewRouteRepository } from '../observability_overview'; -import { rumRouteRepository } from '../rum_client'; -import { fallbackToTransactionsRouteRepository } from '../fallback_to_transactions'; -import { serviceRouteRepository } from '../services'; -import { serviceMapRouteRepository } from '../service_map'; -import { serviceNodeRouteRepository } from '../service_nodes'; -import { agentConfigurationRouteRepository } from '../settings/agent_configuration'; -import { anomalyDetectionRouteRepository } from '../settings/anomaly_detection'; -import { apmIndicesRouteRepository } from '../settings/apm_indices'; -import { customLinkRouteRepository } from '../settings/custom_link'; -import { sourceMapsRouteRepository } from '../source_maps'; -import { traceRouteRepository } from '../traces'; -import { transactionRouteRepository } from '../transactions'; +import { environmentsRouteRepository } from '../environments/route'; +import { errorsRouteRepository } from '../errors/route'; +import { apmFleetRouteRepository } from '../fleet/route'; +import { dataViewRouteRepository } from '../data_view/route'; +import { latencyDistributionRouteRepository } from '../latency_distribution/route'; +import { metricsRouteRepository } from '../metrics/route'; +import { observabilityOverviewRouteRepository } from '../observability_overview/route'; +import { rumRouteRepository } from '../rum_client/route'; +import { fallbackToTransactionsRouteRepository } from '../fallback_to_transactions/route'; +import { serviceRouteRepository } from '../services/route'; +import { serviceMapRouteRepository } from '../service_map/route'; +import { serviceNodeRouteRepository } from '../service_nodes/route'; +import { agentConfigurationRouteRepository } from '../settings/agent_configuration/route'; +import { anomalyDetectionRouteRepository } from '../settings/anomaly_detection/route'; +import { apmIndicesRouteRepository } from '../settings/apm_indices/route'; +import { customLinkRouteRepository } from '../settings/custom_link/route'; +import { sourceMapsRouteRepository } from '../source_maps/route'; +import { traceRouteRepository } from '../traces/route'; +import { transactionRouteRepository } from '../transactions/route'; import { APMRouteHandlerResources } from '../typings'; import { historicalDataRouteRepository } from '../historical_data'; -import { eventMetadataRouteRepository } from '../event_metadata'; -import { suggestionsRouteRepository } from '../suggestions'; +import { eventMetadataRouteRepository } from '../event_metadata/route'; +import { suggestionsRouteRepository } from '../suggestions/route'; const getTypedGlobalApmServerRouteRepository = () => { const repository = createApmServerRouteRepository() diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/field_stats/get_boolean_field_stats.ts b/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/get_boolean_field_stats.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/field_stats/get_boolean_field_stats.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/field_stats/get_boolean_field_stats.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/field_stats/get_field_stats.test.ts b/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/get_field_stats.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/field_stats/get_field_stats.test.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/field_stats/get_field_stats.test.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/field_stats/get_fields_stats.ts b/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/get_fields_stats.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/field_stats/get_fields_stats.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/field_stats/get_fields_stats.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/field_stats/get_keyword_field_stats.ts b/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/get_keyword_field_stats.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/field_stats/get_keyword_field_stats.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/field_stats/get_keyword_field_stats.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/field_stats/get_numeric_field_stats.ts b/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/get_numeric_field_stats.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/field_stats/get_numeric_field_stats.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/field_stats/get_numeric_field_stats.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/get_filters.ts b/x-pack/plugins/apm/server/routes/correlations/queries/get_filters.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/get_filters.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/get_filters.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/get_query_with_params.test.ts b/x-pack/plugins/apm/server/routes/correlations/queries/get_query_with_params.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/get_query_with_params.test.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/get_query_with_params.test.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/get_query_with_params.ts b/x-pack/plugins/apm/server/routes/correlations/queries/get_query_with_params.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/get_query_with_params.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/get_query_with_params.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/get_request_base.test.ts b/x-pack/plugins/apm/server/routes/correlations/queries/get_request_base.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/get_request_base.test.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/get_request_base.test.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/get_request_base.ts b/x-pack/plugins/apm/server/routes/correlations/queries/get_request_base.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/get_request_base.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/get_request_base.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/index.ts b/x-pack/plugins/apm/server/routes/correlations/queries/index.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/index.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/index.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_correlation.test.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_correlation.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_correlation.test.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_correlation.test.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_correlation.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_correlation.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_correlation.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_correlation.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_correlation_with_histogram.test.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_correlation_with_histogram.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_correlation_with_histogram.test.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_correlation_with_histogram.test.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_correlation_with_histogram.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_correlation_with_histogram.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_correlation_with_histogram.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_correlation_with_histogram.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_failure_correlation.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_failure_correlation.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_failure_correlation.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_failure_correlation.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_field_candidates.test.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_field_candidates.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_field_candidates.test.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_field_candidates.test.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_field_candidates.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_field_candidates.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_field_candidates.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_field_candidates.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_field_value_pairs.test.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_field_value_pairs.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_field_value_pairs.test.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_field_value_pairs.test.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_field_value_pairs.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_field_value_pairs.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_field_value_pairs.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_field_value_pairs.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_fractions.test.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_fractions.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_fractions.test.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_fractions.test.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_fractions.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_fractions.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_fractions.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_fractions.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_histogram.test.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_histogram.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_histogram.test.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_histogram.test.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_histogram.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_histogram.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_histogram.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_histogram.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_histogram_range_steps.test.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_histogram_range_steps.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_histogram_range_steps.test.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_histogram_range_steps.test.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_histogram_range_steps.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_histogram_range_steps.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_histogram_range_steps.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_histogram_range_steps.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_p_values.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_p_values.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_p_values.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_p_values.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_percentiles.test.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_percentiles.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_percentiles.test.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_percentiles.test.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_percentiles.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_percentiles.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_percentiles.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_percentiles.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_ranges.test.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_ranges.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_ranges.test.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_ranges.test.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_ranges.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_ranges.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_ranges.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_ranges.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/queries/query_significant_correlations.ts b/x-pack/plugins/apm/server/routes/correlations/queries/query_significant_correlations.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/queries/query_significant_correlations.ts rename to x-pack/plugins/apm/server/routes/correlations/queries/query_significant_correlations.ts diff --git a/x-pack/plugins/apm/server/routes/correlations.ts b/x-pack/plugins/apm/server/routes/correlations/route.ts similarity index 92% rename from x-pack/plugins/apm/server/routes/correlations.ts rename to x-pack/plugins/apm/server/routes/correlations/route.ts index f6ca064b4385f..b02a6fbc6b7a6 100644 --- a/x-pack/plugins/apm/server/routes/correlations.ts +++ b/x-pack/plugins/apm/server/routes/correlations/route.ts @@ -11,22 +11,22 @@ import Boom from '@hapi/boom'; import { i18n } from '@kbn/i18n'; import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt'; -import { isActivePlatinumLicense } from '../../common/license_check'; +import { isActivePlatinumLicense } from '../../../common/license_check'; -import { setupRequest } from '../lib/helpers/setup_request'; +import { setupRequest } from '../../lib/helpers/setup_request'; import { fetchPValues, fetchSignificantCorrelations, fetchTransactionDurationFieldCandidates, fetchTransactionDurationFieldValuePairs, -} from '../lib/correlations/queries'; -import { fetchFieldsStats } from '../lib/correlations/queries/field_stats/get_fields_stats'; +} from './queries'; +import { fetchFieldsStats } from './queries/field_stats/get_fields_stats'; -import { withApmSpan } from '../utils/with_apm_span'; +import { withApmSpan } from '../../utils/with_apm_span'; -import { createApmServerRoute } from './apm_routes/create_apm_server_route'; -import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; -import { environmentRt, kueryRt, rangeRt } from './default_api_types'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; +import { environmentRt, kueryRt, rangeRt } from '../default_api_types'; const INVALID_LICENSE = i18n.translate('xpack.apm.correlations.license.text', { defaultMessage: diff --git a/x-pack/plugins/apm/server/lib/correlations/utils/compute_expectations_and_ranges.test.ts b/x-pack/plugins/apm/server/routes/correlations/utils/compute_expectations_and_ranges.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/utils/compute_expectations_and_ranges.test.ts rename to x-pack/plugins/apm/server/routes/correlations/utils/compute_expectations_and_ranges.test.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/utils/compute_expectations_and_ranges.ts b/x-pack/plugins/apm/server/routes/correlations/utils/compute_expectations_and_ranges.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/utils/compute_expectations_and_ranges.ts rename to x-pack/plugins/apm/server/routes/correlations/utils/compute_expectations_and_ranges.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/utils/field_stats_utils.ts b/x-pack/plugins/apm/server/routes/correlations/utils/field_stats_utils.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/utils/field_stats_utils.ts rename to x-pack/plugins/apm/server/routes/correlations/utils/field_stats_utils.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/utils/index.ts b/x-pack/plugins/apm/server/routes/correlations/utils/index.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/utils/index.ts rename to x-pack/plugins/apm/server/routes/correlations/utils/index.ts diff --git a/x-pack/plugins/apm/server/lib/correlations/utils/split_all_settled_promises.ts b/x-pack/plugins/apm/server/routes/correlations/utils/split_all_settled_promises.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/correlations/utils/split_all_settled_promises.ts rename to x-pack/plugins/apm/server/routes/correlations/utils/split_all_settled_promises.ts diff --git a/x-pack/plugins/apm/server/lib/data_view/create_static_data_view.test.ts b/x-pack/plugins/apm/server/routes/data_view/create_static_data_view.test.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/data_view/create_static_data_view.test.ts rename to x-pack/plugins/apm/server/routes/data_view/create_static_data_view.test.ts index 77b9f0ffd4ad0..7d345b5e3bec1 100644 --- a/x-pack/plugins/apm/server/lib/data_view/create_static_data_view.test.ts +++ b/x-pack/plugins/apm/server/routes/data_view/create_static_data_view.test.ts @@ -6,9 +6,9 @@ */ import { createStaticDataView } from './create_static_data_view'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; import * as HistoricalAgentData from '../../routes/historical_data/has_historical_agent_data'; -import { InternalSavedObjectsClient } from '../helpers/get_internal_saved_objects_client'; +import { InternalSavedObjectsClient } from '../../lib/helpers/get_internal_saved_objects_client'; import { APMConfig } from '../..'; function getMockSavedObjectsClient(existingDataViewTitle: string) { diff --git a/x-pack/plugins/apm/server/lib/data_view/create_static_data_view.ts b/x-pack/plugins/apm/server/routes/data_view/create_static_data_view.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/data_view/create_static_data_view.ts rename to x-pack/plugins/apm/server/routes/data_view/create_static_data_view.ts index 521d290b9ca22..13639d2efcbfe 100644 --- a/x-pack/plugins/apm/server/lib/data_view/create_static_data_view.ts +++ b/x-pack/plugins/apm/server/routes/data_view/create_static_data_view.ts @@ -9,9 +9,9 @@ import { SavedObjectsErrorHelpers } from '../../../../../../src/core/server'; import { APM_STATIC_INDEX_PATTERN_ID } from '../../../common/index_pattern_constants'; import apmDataView from '../../tutorial/index_pattern.json'; import { hasHistoricalAgentData } from '../../routes/historical_data/has_historical_agent_data'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; import { APMRouteHandlerResources } from '../../routes/typings'; -import { InternalSavedObjectsClient } from '../helpers/get_internal_saved_objects_client.js'; +import { InternalSavedObjectsClient } from '../../lib/helpers/get_internal_saved_objects_client.js'; import { withApmSpan } from '../../utils/with_apm_span'; import { getApmDataViewTitle } from './get_apm_data_view_title'; diff --git a/x-pack/plugins/apm/server/lib/data_view/get_apm_data_view_title.test.ts b/x-pack/plugins/apm/server/routes/data_view/get_apm_data_view_title.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/data_view/get_apm_data_view_title.test.ts rename to x-pack/plugins/apm/server/routes/data_view/get_apm_data_view_title.test.ts diff --git a/x-pack/plugins/apm/server/lib/data_view/get_apm_data_view_title.ts b/x-pack/plugins/apm/server/routes/data_view/get_apm_data_view_title.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/data_view/get_apm_data_view_title.ts rename to x-pack/plugins/apm/server/routes/data_view/get_apm_data_view_title.ts diff --git a/x-pack/plugins/apm/server/lib/data_view/get_dynamic_data_view.ts b/x-pack/plugins/apm/server/routes/data_view/get_dynamic_data_view.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/data_view/get_dynamic_data_view.ts rename to x-pack/plugins/apm/server/routes/data_view/get_dynamic_data_view.ts diff --git a/x-pack/plugins/apm/server/routes/data_view.ts b/x-pack/plugins/apm/server/routes/data_view/route.ts similarity index 78% rename from x-pack/plugins/apm/server/routes/data_view.ts rename to x-pack/plugins/apm/server/routes/data_view/route.ts index 3590ef9db9bd0..4e1c0ca050a09 100644 --- a/x-pack/plugins/apm/server/routes/data_view.ts +++ b/x-pack/plugins/apm/server/routes/data_view/route.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { createStaticDataView } from '../lib/data_view/create_static_data_view'; -import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; -import { setupRequest } from '../lib/helpers/setup_request'; -import { getDynamicDataView } from '../lib/data_view/get_dynamic_data_view'; -import { createApmServerRoute } from './apm_routes/create_apm_server_route'; +import { createStaticDataView } from './create_static_data_view'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; +import { setupRequest } from '../../lib/helpers/setup_request'; +import { getDynamicDataView } from './get_dynamic_data_view'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; const staticDataViewRoute = createApmServerRoute({ endpoint: 'POST /internal/apm/data_view/static', diff --git a/x-pack/plugins/apm/server/lib/environments/__snapshots__/get_all_environments.test.ts.snap b/x-pack/plugins/apm/server/routes/environments/__snapshots__/get_all_environments.test.ts.snap similarity index 100% rename from x-pack/plugins/apm/server/lib/environments/__snapshots__/get_all_environments.test.ts.snap rename to x-pack/plugins/apm/server/routes/environments/__snapshots__/get_all_environments.test.ts.snap diff --git a/x-pack/plugins/apm/server/lib/environments/__snapshots__/get_environments.test.ts.snap b/x-pack/plugins/apm/server/routes/environments/__snapshots__/get_environments.test.ts.snap similarity index 100% rename from x-pack/plugins/apm/server/lib/environments/__snapshots__/get_environments.test.ts.snap rename to x-pack/plugins/apm/server/routes/environments/__snapshots__/get_environments.test.ts.snap diff --git a/x-pack/plugins/apm/server/lib/environments/get_all_environments.test.ts b/x-pack/plugins/apm/server/routes/environments/get_all_environments.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/environments/get_all_environments.test.ts rename to x-pack/plugins/apm/server/routes/environments/get_all_environments.test.ts diff --git a/x-pack/plugins/apm/server/lib/environments/get_all_environments.ts b/x-pack/plugins/apm/server/routes/environments/get_all_environments.ts similarity index 93% rename from x-pack/plugins/apm/server/lib/environments/get_all_environments.ts rename to x-pack/plugins/apm/server/routes/environments/get_all_environments.ts index 7bdb21b9fda78..f479fd185b889 100644 --- a/x-pack/plugins/apm/server/lib/environments/get_all_environments.ts +++ b/x-pack/plugins/apm/server/routes/environments/get_all_environments.ts @@ -7,13 +7,13 @@ import { termQuery } from '../../../../observability/server'; import { ProcessorEvent } from '../../../common/processor_event'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; import { SERVICE_NAME, SERVICE_ENVIRONMENT, } from '../../../common/elasticsearch_fieldnames'; import { ENVIRONMENT_NOT_DEFINED } from '../../../common/environment_filter_values'; -import { getProcessorEventForTransactions } from '../helpers/transactions'; +import { getProcessorEventForTransactions } from '../../lib/helpers/transactions'; /** * This is used for getting *all* environments, and does not filter by range. diff --git a/x-pack/plugins/apm/server/lib/environments/get_environments.test.ts b/x-pack/plugins/apm/server/routes/environments/get_environments.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/environments/get_environments.test.ts rename to x-pack/plugins/apm/server/routes/environments/get_environments.test.ts diff --git a/x-pack/plugins/apm/server/lib/environments/get_environments.ts b/x-pack/plugins/apm/server/routes/environments/get_environments.ts similarity index 93% rename from x-pack/plugins/apm/server/lib/environments/get_environments.ts rename to x-pack/plugins/apm/server/routes/environments/get_environments.ts index cd5caab6d2587..34ac9cb18d796 100644 --- a/x-pack/plugins/apm/server/lib/environments/get_environments.ts +++ b/x-pack/plugins/apm/server/routes/environments/get_environments.ts @@ -12,8 +12,8 @@ import { import { ENVIRONMENT_NOT_DEFINED } from '../../../common/environment_filter_values'; import { ProcessorEvent } from '../../../common/processor_event'; import { rangeQuery, termQuery } from '../../../../observability/server'; -import { getProcessorEventForTransactions } from '../helpers/transactions'; -import { Setup } from '../helpers/setup_request'; +import { getProcessorEventForTransactions } from '../../lib/helpers/transactions'; +import { Setup } from '../../lib/helpers/setup_request'; /** * This is used for getting the list of environments for the environments selector, diff --git a/x-pack/plugins/apm/server/routes/environments.ts b/x-pack/plugins/apm/server/routes/environments/route.ts similarity index 72% rename from x-pack/plugins/apm/server/routes/environments.ts rename to x-pack/plugins/apm/server/routes/environments/route.ts index 38328a63a411e..6c980187cd331 100644 --- a/x-pack/plugins/apm/server/routes/environments.ts +++ b/x-pack/plugins/apm/server/routes/environments/route.ts @@ -6,13 +6,13 @@ */ import * as t from 'io-ts'; -import { maxSuggestions } from '../../../observability/common'; -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'; -import { createApmServerRoute } from './apm_routes/create_apm_server_route'; -import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; +import { maxSuggestions } from '../../../../observability/common'; +import { getSearchAggregatedTransactions } from '../../lib/helpers/transactions'; +import { setupRequest } from '../../lib/helpers/setup_request'; +import { getEnvironments } from './get_environments'; +import { rangeRt } from '../default_api_types'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; const environmentsRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/environments', diff --git a/x-pack/plugins/apm/server/lib/errors/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/routes/errors/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/plugins/apm/server/lib/errors/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/routes/errors/__snapshots__/queries.test.ts.snap diff --git a/x-pack/plugins/apm/server/lib/errors/distribution/__snapshots__/get_buckets.test.ts.snap b/x-pack/plugins/apm/server/routes/errors/distribution/__snapshots__/get_buckets.test.ts.snap similarity index 100% rename from x-pack/plugins/apm/server/lib/errors/distribution/__snapshots__/get_buckets.test.ts.snap rename to x-pack/plugins/apm/server/routes/errors/distribution/__snapshots__/get_buckets.test.ts.snap diff --git a/x-pack/plugins/apm/server/lib/errors/distribution/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/routes/errors/distribution/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/plugins/apm/server/lib/errors/distribution/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/routes/errors/distribution/__snapshots__/queries.test.ts.snap diff --git a/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts b/x-pack/plugins/apm/server/routes/errors/distribution/get_buckets.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts rename to x-pack/plugins/apm/server/routes/errors/distribution/get_buckets.test.ts diff --git a/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.ts b/x-pack/plugins/apm/server/routes/errors/distribution/get_buckets.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.ts rename to x-pack/plugins/apm/server/routes/errors/distribution/get_buckets.ts index 625089e99d360..dd2dd3bc9ff3e 100644 --- a/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.ts +++ b/x-pack/plugins/apm/server/routes/errors/distribution/get_buckets.ts @@ -16,7 +16,7 @@ import { termQuery, } from '../../../../../observability/server'; import { environmentQuery } from '../../../../common/utils/environment_query'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; export async function getBuckets({ environment, diff --git a/x-pack/plugins/apm/server/lib/errors/distribution/get_distribution.ts b/x-pack/plugins/apm/server/routes/errors/distribution/get_distribution.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/errors/distribution/get_distribution.ts rename to x-pack/plugins/apm/server/routes/errors/distribution/get_distribution.ts index 7d5cbe9f95584..9e7221b7cd939 100644 --- a/x-pack/plugins/apm/server/lib/errors/distribution/get_distribution.ts +++ b/x-pack/plugins/apm/server/routes/errors/distribution/get_distribution.ts @@ -6,7 +6,7 @@ */ import { offsetPreviousPeriodCoordinates } from '../../../../common/utils/offset_previous_period_coordinate'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { BUCKET_TARGET_COUNT } from '../../transactions/constants'; import { getBuckets } from './get_buckets'; diff --git a/x-pack/plugins/apm/server/lib/errors/distribution/queries.test.ts b/x-pack/plugins/apm/server/routes/errors/distribution/queries.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/errors/distribution/queries.test.ts rename to x-pack/plugins/apm/server/routes/errors/distribution/queries.test.ts diff --git a/x-pack/plugins/apm/server/lib/errors/get_error_group_sample.ts b/x-pack/plugins/apm/server/routes/errors/get_error_group_sample.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/errors/get_error_group_sample.ts rename to x-pack/plugins/apm/server/routes/errors/get_error_group_sample.ts index 35c3ce999a9ff..2c5073fb5dc66 100644 --- a/x-pack/plugins/apm/server/lib/errors/get_error_group_sample.ts +++ b/x-pack/plugins/apm/server/routes/errors/get_error_group_sample.ts @@ -14,7 +14,7 @@ import { import { ProcessorEvent } from '../../../common/processor_event'; import { rangeQuery, kqlQuery } from '../../../../observability/server'; import { environmentQuery } from '../../../common/utils/environment_query'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; import { getTransaction } from '../transactions/get_transaction'; export async function getErrorGroupSample({ diff --git a/x-pack/plugins/apm/server/lib/errors/get_error_groups.ts b/x-pack/plugins/apm/server/routes/errors/get_error_groups.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/errors/get_error_groups.ts rename to x-pack/plugins/apm/server/routes/errors/get_error_groups.ts index 4d4c935d20e76..b26f3f4e7b4fe 100644 --- a/x-pack/plugins/apm/server/lib/errors/get_error_groups.ts +++ b/x-pack/plugins/apm/server/routes/errors/get_error_groups.ts @@ -18,8 +18,8 @@ import { ERROR_LOG_MESSAGE, SERVICE_NAME, } from '../../../common/elasticsearch_fieldnames'; -import { getErrorName } from '../helpers/get_error_name'; -import { Setup } from '../helpers/setup_request'; +import { getErrorName } from '../../lib/helpers/get_error_name'; +import { Setup } from '../../lib/helpers/setup_request'; export async function getErrorGroups({ environment, diff --git a/x-pack/plugins/apm/server/lib/errors/queries.test.ts b/x-pack/plugins/apm/server/routes/errors/queries.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/errors/queries.test.ts rename to x-pack/plugins/apm/server/routes/errors/queries.test.ts diff --git a/x-pack/plugins/apm/server/routes/errors.ts b/x-pack/plugins/apm/server/routes/errors/route.ts similarity index 86% rename from x-pack/plugins/apm/server/routes/errors.ts rename to x-pack/plugins/apm/server/routes/errors/route.ts index 02df03f108083..602fed89be93c 100644 --- a/x-pack/plugins/apm/server/routes/errors.ts +++ b/x-pack/plugins/apm/server/routes/errors/route.ts @@ -6,18 +6,18 @@ */ import * as t from 'io-ts'; -import { createApmServerRoute } from './apm_routes/create_apm_server_route'; -import { getErrorDistribution } from '../lib/errors/distribution/get_distribution'; -import { getErrorGroupSample } from '../lib/errors/get_error_group_sample'; -import { getErrorGroups } from '../lib/errors/get_error_groups'; -import { setupRequest } from '../lib/helpers/setup_request'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { getErrorDistribution } from './distribution/get_distribution'; +import { getErrorGroupSample } from './get_error_group_sample'; +import { getErrorGroups } from './get_error_groups'; +import { setupRequest } from '../../lib/helpers/setup_request'; import { environmentRt, kueryRt, rangeRt, comparisonRangeRt, -} from './default_api_types'; -import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; +} from '../default_api_types'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; const errorsRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/services/{serviceName}/errors', diff --git a/x-pack/plugins/apm/server/lib/event_metadata/get_event_metadata.ts b/x-pack/plugins/apm/server/routes/event_metadata/get_event_metadata.ts similarity index 93% rename from x-pack/plugins/apm/server/lib/event_metadata/get_event_metadata.ts rename to x-pack/plugins/apm/server/routes/event_metadata/get_event_metadata.ts index b9e0dee52a42e..006c87a3dac20 100644 --- a/x-pack/plugins/apm/server/lib/event_metadata/get_event_metadata.ts +++ b/x-pack/plugins/apm/server/routes/event_metadata/get_event_metadata.ts @@ -12,7 +12,7 @@ import { TRANSACTION_ID, } from '../../../common/elasticsearch_fieldnames'; import { ProcessorEvent } from '../../../common/processor_event'; -import type { APMEventClient } from '../helpers/create_es_client/create_apm_event_client'; +import type { APMEventClient } from '../../lib/helpers/create_es_client/create_apm_event_client'; export async function getEventMetadata({ apmEventClient, diff --git a/x-pack/plugins/apm/server/routes/event_metadata.ts b/x-pack/plugins/apm/server/routes/event_metadata/route.ts similarity index 72% rename from x-pack/plugins/apm/server/routes/event_metadata.ts rename to x-pack/plugins/apm/server/routes/event_metadata/route.ts index 3a40e445007ee..3140372aa69de 100644 --- a/x-pack/plugins/apm/server/routes/event_metadata.ts +++ b/x-pack/plugins/apm/server/routes/event_metadata/route.ts @@ -6,11 +6,11 @@ */ import * as t from 'io-ts'; -import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; -import { createApmServerRoute } from './apm_routes/create_apm_server_route'; -import { getEventMetadata } from '../lib/event_metadata/get_event_metadata'; -import { processorEventRt } from '../../common/processor_event'; -import { setupRequest } from '../lib/helpers/setup_request'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { getEventMetadata } from './get_event_metadata'; +import { processorEventRt } from '../../../common/processor_event'; +import { setupRequest } from '../../lib/helpers/setup_request'; const eventMetadataRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/event_metadata/{processorEvent}/{id}', diff --git a/x-pack/plugins/apm/server/routes/fallback_to_transactions.ts b/x-pack/plugins/apm/server/routes/fallback_to_transactions/route.ts similarity index 70% rename from x-pack/plugins/apm/server/routes/fallback_to_transactions.ts rename to x-pack/plugins/apm/server/routes/fallback_to_transactions/route.ts index 53e3ebae0d4ff..77b5aeeac6ee8 100644 --- a/x-pack/plugins/apm/server/routes/fallback_to_transactions.ts +++ b/x-pack/plugins/apm/server/routes/fallback_to_transactions/route.ts @@ -6,11 +6,11 @@ */ import * as t from 'io-ts'; -import { getIsUsingTransactionEvents } from '../lib/helpers/transactions/get_is_using_transaction_events'; -import { setupRequest } from '../lib/helpers/setup_request'; -import { createApmServerRoute } from './apm_routes/create_apm_server_route'; -import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; -import { kueryRt, rangeRt } from './default_api_types'; +import { getIsUsingTransactionEvents } from '../../lib/helpers/transactions/get_is_using_transaction_events'; +import { setupRequest } from '../../lib/helpers/setup_request'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; +import { kueryRt, rangeRt } from '../default_api_types'; const fallbackToTransactionsRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/fallback_to_transactions', diff --git a/x-pack/plugins/apm/server/lib/fleet/create_cloud_apm_package_policy.ts b/x-pack/plugins/apm/server/routes/fleet/create_cloud_apm_package_policy.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/fleet/create_cloud_apm_package_policy.ts rename to x-pack/plugins/apm/server/routes/fleet/create_cloud_apm_package_policy.ts index 6726865c6c3a5..a3c7bfd079a4c 100644 --- a/x-pack/plugins/apm/server/lib/fleet/create_cloud_apm_package_policy.ts +++ b/x-pack/plugins/apm/server/routes/fleet/create_cloud_apm_package_policy.ts @@ -20,7 +20,7 @@ import { APMPluginStartDependencies, } from '../../types'; import { getApmPackagePolicyDefinition } from './get_apm_package_policy_definition'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; import { mergePackagePolicyWithApm } from './merge_package_policy_with_apm'; export async function createCloudApmPackgePolicy({ diff --git a/x-pack/plugins/apm/server/lib/fleet/get_agents.ts b/x-pack/plugins/apm/server/routes/fleet/get_agents.ts similarity index 89% rename from x-pack/plugins/apm/server/lib/fleet/get_agents.ts rename to x-pack/plugins/apm/server/routes/fleet/get_agents.ts index 86a6294e96b09..bcfe42428dbe2 100644 --- a/x-pack/plugins/apm/server/lib/fleet/get_agents.ts +++ b/x-pack/plugins/apm/server/routes/fleet/get_agents.ts @@ -11,7 +11,7 @@ import { SavedObjectsClientContract, } from 'kibana/server'; import { APMPluginStartDependencies } from '../../types'; -import { getInternalSavedObjectsClient } from '../helpers/get_internal_saved_objects_client'; +import { getInternalSavedObjectsClient } from '../../lib/helpers/get_internal_saved_objects_client'; export async function getFleetAgents({ policyIds, diff --git a/x-pack/plugins/apm/server/lib/fleet/get_apm_package_policies.ts b/x-pack/plugins/apm/server/routes/fleet/get_apm_package_policies.ts similarity index 89% rename from x-pack/plugins/apm/server/lib/fleet/get_apm_package_policies.ts rename to x-pack/plugins/apm/server/routes/fleet/get_apm_package_policies.ts index 5128339368f46..89ab9df051f70 100644 --- a/x-pack/plugins/apm/server/lib/fleet/get_apm_package_policies.ts +++ b/x-pack/plugins/apm/server/routes/fleet/get_apm_package_policies.ts @@ -11,7 +11,7 @@ import { SavedObjectsClientContract, } from 'kibana/server'; import { APMPluginStartDependencies } from '../../types'; -import { getInternalSavedObjectsClient } from '../helpers/get_internal_saved_objects_client'; +import { getInternalSavedObjectsClient } from '../../lib/helpers/get_internal_saved_objects_client'; export async function getApmPackgePolicies({ core, diff --git a/x-pack/plugins/apm/server/lib/fleet/get_apm_package_policy_definition.test.ts b/x-pack/plugins/apm/server/routes/fleet/get_apm_package_policy_definition.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/fleet/get_apm_package_policy_definition.test.ts rename to x-pack/plugins/apm/server/routes/fleet/get_apm_package_policy_definition.test.ts diff --git a/x-pack/plugins/apm/server/lib/fleet/get_apm_package_policy_definition.ts b/x-pack/plugins/apm/server/routes/fleet/get_apm_package_policy_definition.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/fleet/get_apm_package_policy_definition.ts rename to x-pack/plugins/apm/server/routes/fleet/get_apm_package_policy_definition.ts diff --git a/x-pack/plugins/apm/server/lib/fleet/get_cloud_apm_package_policy.ts b/x-pack/plugins/apm/server/routes/fleet/get_cloud_apm_package_policy.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/fleet/get_cloud_apm_package_policy.ts rename to x-pack/plugins/apm/server/routes/fleet/get_cloud_apm_package_policy.ts diff --git a/x-pack/plugins/apm/server/lib/fleet/get_unsupported_apm_server_schema.test.ts b/x-pack/plugins/apm/server/routes/fleet/get_unsupported_apm_server_schema.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/fleet/get_unsupported_apm_server_schema.test.ts rename to x-pack/plugins/apm/server/routes/fleet/get_unsupported_apm_server_schema.test.ts diff --git a/x-pack/plugins/apm/server/lib/fleet/get_unsupported_apm_server_schema.ts b/x-pack/plugins/apm/server/routes/fleet/get_unsupported_apm_server_schema.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/fleet/get_unsupported_apm_server_schema.ts rename to x-pack/plugins/apm/server/routes/fleet/get_unsupported_apm_server_schema.ts diff --git a/x-pack/plugins/apm/server/lib/fleet/is_superuser.ts b/x-pack/plugins/apm/server/routes/fleet/is_superuser.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/fleet/is_superuser.ts rename to x-pack/plugins/apm/server/routes/fleet/is_superuser.ts diff --git a/x-pack/plugins/apm/server/lib/fleet/merge_package_policy_with_apm.ts b/x-pack/plugins/apm/server/routes/fleet/merge_package_policy_with_apm.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/fleet/merge_package_policy_with_apm.ts rename to x-pack/plugins/apm/server/routes/fleet/merge_package_policy_with_apm.ts index fd3e3db700fd0..5442185decde3 100644 --- a/x-pack/plugins/apm/server/lib/fleet/merge_package_policy_with_apm.ts +++ b/x-pack/plugins/apm/server/routes/fleet/merge_package_policy_with_apm.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; import { APMPluginStartDependencies } from '../../types'; import { listConfigurations } from '../settings/agent_configuration/list_configurations'; import { diff --git a/x-pack/plugins/apm/server/lib/fleet/register_fleet_policy_callbacks.ts b/x-pack/plugins/apm/server/routes/fleet/register_fleet_policy_callbacks.ts similarity index 98% rename from x-pack/plugins/apm/server/lib/fleet/register_fleet_policy_callbacks.ts rename to x-pack/plugins/apm/server/routes/fleet/register_fleet_policy_callbacks.ts index 6fcd0433e2e83..06e55c7fdcca8 100644 --- a/x-pack/plugins/apm/server/lib/fleet/register_fleet_policy_callbacks.ts +++ b/x-pack/plugins/apm/server/routes/fleet/register_fleet_policy_callbacks.ts @@ -17,7 +17,7 @@ import { import { AgentConfiguration } from '../../../common/agent_configuration/configuration_types'; import { AGENT_NAME } from '../../../common/elasticsearch_fieldnames'; import { APMPluginStartDependencies } from '../../types'; -import { setupRequest } from '../helpers/setup_request'; +import { setupRequest } from '../../lib/helpers/setup_request'; import { mergePackagePolicyWithApm } from './merge_package_policy_with_apm'; export async function registerFleetPolicyCallbacks({ diff --git a/x-pack/plugins/apm/server/routes/fleet.ts b/x-pack/plugins/apm/server/routes/fleet/route.ts similarity index 89% rename from x-pack/plugins/apm/server/routes/fleet.ts rename to x-pack/plugins/apm/server/routes/fleet/route.ts index a6e0cb09d894a..e9e7f2254bcfe 100644 --- a/x-pack/plugins/apm/server/routes/fleet.ts +++ b/x-pack/plugins/apm/server/routes/fleet/route.ts @@ -12,20 +12,20 @@ import { keyBy } from 'lodash'; import { APM_SERVER_SCHEMA_SAVED_OBJECT_ID, APM_SERVER_SCHEMA_SAVED_OBJECT_TYPE, -} from '../../common/apm_saved_object_constants'; -import { createCloudApmPackgePolicy } from '../lib/fleet/create_cloud_apm_package_policy'; -import { getFleetAgents } from '../lib/fleet/get_agents'; -import { getApmPackgePolicies } from '../lib/fleet/get_apm_package_policies'; +} from '../../../common/apm_saved_object_constants'; +import { createCloudApmPackgePolicy } from './create_cloud_apm_package_policy'; +import { getFleetAgents } from './get_agents'; +import { getApmPackgePolicies } from './get_apm_package_policies'; import { getApmPackagePolicy, getCloudAgentPolicy, -} from '../lib/fleet/get_cloud_apm_package_policy'; -import { getUnsupportedApmServerSchema } from '../lib/fleet/get_unsupported_apm_server_schema'; -import { isSuperuser } from '../lib/fleet/is_superuser'; -import { getInternalSavedObjectsClient } from '../lib/helpers/get_internal_saved_objects_client'; -import { setupRequest } from '../lib/helpers/setup_request'; -import { createApmServerRoute } from './apm_routes/create_apm_server_route'; -import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; +} from './get_cloud_apm_package_policy'; +import { getUnsupportedApmServerSchema } from './get_unsupported_apm_server_schema'; +import { isSuperuser } from './is_superuser'; +import { getInternalSavedObjectsClient } from '../../lib/helpers/get_internal_saved_objects_client'; +import { setupRequest } from '../../lib/helpers/setup_request'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; const hasFleetDataRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/fleet/has_data', diff --git a/x-pack/plugins/apm/server/lib/fleet/source_maps.test.ts b/x-pack/plugins/apm/server/routes/fleet/source_maps.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/fleet/source_maps.test.ts rename to x-pack/plugins/apm/server/routes/fleet/source_maps.test.ts diff --git a/x-pack/plugins/apm/server/lib/fleet/source_maps.ts b/x-pack/plugins/apm/server/routes/fleet/source_maps.ts similarity index 98% rename from x-pack/plugins/apm/server/lib/fleet/source_maps.ts rename to x-pack/plugins/apm/server/routes/fleet/source_maps.ts index 8c11f80f21191..1d70076a828dd 100644 --- a/x-pack/plugins/apm/server/lib/fleet/source_maps.ts +++ b/x-pack/plugins/apm/server/routes/fleet/source_maps.ts @@ -13,7 +13,7 @@ import { import { promisify } from 'util'; import { unzip } from 'zlib'; import { Artifact } from '../../../../fleet/server'; -import { SourceMap } from '../../routes/source_maps'; +import { SourceMap } from '../source_maps/route'; import { APMPluginStartDependencies } from '../../types'; import { getApmPackgePolicies } from './get_apm_package_policies'; import { APM_SERVER, PackagePolicy } from './register_fleet_policy_callbacks'; diff --git a/x-pack/plugins/apm/server/lib/fleet/sync_agent_configs_to_apm_package_policies.ts b/x-pack/plugins/apm/server/routes/fleet/sync_agent_configs_to_apm_package_policies.ts similarity index 90% rename from x-pack/plugins/apm/server/lib/fleet/sync_agent_configs_to_apm_package_policies.ts rename to x-pack/plugins/apm/server/routes/fleet/sync_agent_configs_to_apm_package_policies.ts index 5f3a3f74598a1..c3660eee0afae 100644 --- a/x-pack/plugins/apm/server/lib/fleet/sync_agent_configs_to_apm_package_policies.ts +++ b/x-pack/plugins/apm/server/routes/fleet/sync_agent_configs_to_apm_package_policies.ts @@ -10,10 +10,10 @@ import { CoreStart, SavedObjectsClientContract, } from 'kibana/server'; -import { TelemetryUsageCounter } from '../../routes/typings'; +import { TelemetryUsageCounter } from '../typings'; import { APMPluginStartDependencies } from '../../types'; -import { getInternalSavedObjectsClient } from '../helpers/get_internal_saved_objects_client'; -import { Setup } from '../helpers/setup_request'; +import { getInternalSavedObjectsClient } from '../../lib/helpers/get_internal_saved_objects_client'; +import { Setup } from '../../lib/helpers/setup_request'; import { listConfigurations } from '../settings/agent_configuration/list_configurations'; import { getApmPackgePolicies } from './get_apm_package_policies'; import { getPackagePolicyWithAgentConfigurations } from './register_fleet_policy_callbacks'; diff --git a/x-pack/plugins/apm/server/lib/latency/get_overall_latency_distribution.ts b/x-pack/plugins/apm/server/routes/latency_distribution/get_overall_latency_distribution.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/latency/get_overall_latency_distribution.ts rename to x-pack/plugins/apm/server/routes/latency_distribution/get_overall_latency_distribution.ts diff --git a/x-pack/plugins/apm/server/lib/latency/get_percentile_threshold_value.ts b/x-pack/plugins/apm/server/routes/latency_distribution/get_percentile_threshold_value.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/latency/get_percentile_threshold_value.ts rename to x-pack/plugins/apm/server/routes/latency_distribution/get_percentile_threshold_value.ts diff --git a/x-pack/plugins/apm/server/routes/latency_distribution.ts b/x-pack/plugins/apm/server/routes/latency_distribution/route.ts similarity index 80% rename from x-pack/plugins/apm/server/routes/latency_distribution.ts rename to x-pack/plugins/apm/server/routes/latency_distribution/route.ts index 826898784835e..f30e98dd8c7b8 100644 --- a/x-pack/plugins/apm/server/routes/latency_distribution.ts +++ b/x-pack/plugins/apm/server/routes/latency_distribution/route.ts @@ -7,11 +7,11 @@ import * as t from 'io-ts'; import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt'; -import { getOverallLatencyDistribution } from '../lib/latency/get_overall_latency_distribution'; -import { setupRequest } from '../lib/helpers/setup_request'; -import { createApmServerRoute } from './apm_routes/create_apm_server_route'; -import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; -import { environmentRt, kueryRt, rangeRt } from './default_api_types'; +import { getOverallLatencyDistribution } from './get_overall_latency_distribution'; +import { setupRequest } from '../../lib/helpers/setup_request'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; +import { environmentRt, kueryRt, rangeRt } from '../default_api_types'; const latencyOverallDistributionRoute = createApmServerRoute({ endpoint: 'POST /internal/apm/latency/overall_distribution', diff --git a/x-pack/plugins/apm/server/lib/latency/types.ts b/x-pack/plugins/apm/server/routes/latency_distribution/types.ts similarity index 92% rename from x-pack/plugins/apm/server/lib/latency/types.ts rename to x-pack/plugins/apm/server/routes/latency_distribution/types.ts index 17c036f44f088..d2eb9cde0bf3b 100644 --- a/x-pack/plugins/apm/server/lib/latency/types.ts +++ b/x-pack/plugins/apm/server/routes/latency_distribution/types.ts @@ -10,7 +10,7 @@ import type { CorrelationsClientParams, } from '../../../common/correlations/types'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; export interface OverallLatencyDistributionOptions extends CorrelationsClientParams { diff --git a/x-pack/plugins/apm/server/lib/metrics/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/routes/metrics/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/plugins/apm/server/lib/metrics/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/routes/metrics/__snapshots__/queries.test.ts.snap diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/default.ts b/x-pack/plugins/apm/server/routes/metrics/by_agent/default.ts similarity index 92% rename from x-pack/plugins/apm/server/lib/metrics/by_agent/default.ts rename to x-pack/plugins/apm/server/routes/metrics/by_agent/default.ts index 54e10bd8adde0..b4e95d5217daa 100644 --- a/x-pack/plugins/apm/server/lib/metrics/by_agent/default.ts +++ b/x-pack/plugins/apm/server/routes/metrics/by_agent/default.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { getCPUChartData } from './shared/cpu'; import { getMemoryChartData } from './shared/memory'; diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.test.ts b/x-pack/plugins/apm/server/routes/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.test.ts similarity index 98% rename from x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.test.ts rename to x-pack/plugins/apm/server/routes/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.test.ts index c22c326473e2c..8b3fcbfe5ce88 100644 --- a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.test.ts +++ b/x-pack/plugins/apm/server/routes/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.test.ts @@ -9,7 +9,7 @@ import { METRIC_JAVA_GC_COUNT, METRIC_JAVA_GC_TIME, } from '../../../../../../common/elasticsearch_fieldnames'; -import { Setup } from '../../../../helpers/setup_request'; +import { Setup } from '../../../../../lib/helpers/setup_request'; import { ChartBase } from '../../../types'; import { fetchAndTransformGcMetrics } from './fetch_and_transform_gc_metrics'; diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts b/x-pack/plugins/apm/server/routes/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts rename to x-pack/plugins/apm/server/routes/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts index 2d4cf2f70ab5f..790fcf5720745 100644 --- a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts +++ b/x-pack/plugins/apm/server/routes/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts @@ -8,8 +8,8 @@ import { sum, round } from 'lodash'; import { euiLightVars as theme } from '@kbn/ui-shared-deps-src/theme'; import { isFiniteNumber } from '../../../../../../common/utils/is_finite_number'; -import { Setup } from '../../../../helpers/setup_request'; -import { getMetricsDateHistogramParams } from '../../../../helpers/metrics'; +import { Setup } from '../../../../../lib/helpers/setup_request'; +import { getMetricsDateHistogramParams } from '../../../../../lib/helpers/metrics'; import { ChartBase } from '../../../types'; import { @@ -19,7 +19,7 @@ import { METRIC_JAVA_GC_TIME, SERVICE_NAME, } from '../../../../../../common/elasticsearch_fieldnames'; -import { getBucketSize } from '../../../../helpers/get_bucket_size'; +import { getBucketSize } from '../../../../../lib/helpers/get_bucket_size'; import { getVizColorForIndex } from '../../../../../../common/viz_colors'; import { JAVA_AGENT_NAMES } from '../../../../../../common/agent_name'; import { diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_rate_chart.ts b/x-pack/plugins/apm/server/routes/metrics/by_agent/java/gc/get_gc_rate_chart.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_rate_chart.ts rename to x-pack/plugins/apm/server/routes/metrics/by_agent/java/gc/get_gc_rate_chart.ts index 22dcb3e0f08ff..a22f7df915617 100644 --- a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_rate_chart.ts +++ b/x-pack/plugins/apm/server/routes/metrics/by_agent/java/gc/get_gc_rate_chart.ts @@ -8,7 +8,7 @@ import { euiLightVars as theme } from '@kbn/ui-shared-deps-src/theme'; import { i18n } from '@kbn/i18n'; import { METRIC_JAVA_GC_COUNT } from '../../../../../../common/elasticsearch_fieldnames'; -import { Setup } from '../../../../helpers/setup_request'; +import { Setup } from '../../../../../lib/helpers/setup_request'; import { fetchAndTransformGcMetrics } from './fetch_and_transform_gc_metrics'; import { ChartBase } from '../../../types'; diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_time_chart.ts b/x-pack/plugins/apm/server/routes/metrics/by_agent/java/gc/get_gc_time_chart.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_time_chart.ts rename to x-pack/plugins/apm/server/routes/metrics/by_agent/java/gc/get_gc_time_chart.ts index 4b85ad94f6494..596d871b916f9 100644 --- a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_time_chart.ts +++ b/x-pack/plugins/apm/server/routes/metrics/by_agent/java/gc/get_gc_time_chart.ts @@ -8,7 +8,7 @@ import { euiLightVars as theme } from '@kbn/ui-shared-deps-src/theme'; import { i18n } from '@kbn/i18n'; import { METRIC_JAVA_GC_TIME } from '../../../../../../common/elasticsearch_fieldnames'; -import { Setup } from '../../../../helpers/setup_request'; +import { Setup } from '../../../../../lib/helpers/setup_request'; import { fetchAndTransformGcMetrics } from './fetch_and_transform_gc_metrics'; import { ChartBase } from '../../../types'; diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/heap_memory/index.ts b/x-pack/plugins/apm/server/routes/metrics/by_agent/java/heap_memory/index.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/metrics/by_agent/java/heap_memory/index.ts rename to x-pack/plugins/apm/server/routes/metrics/by_agent/java/heap_memory/index.ts index a872a3af76d7e..cde28e77e38ca 100644 --- a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/heap_memory/index.ts +++ b/x-pack/plugins/apm/server/routes/metrics/by_agent/java/heap_memory/index.ts @@ -13,7 +13,7 @@ import { METRIC_JAVA_HEAP_MEMORY_USED, AGENT_NAME, } from '../../../../../../common/elasticsearch_fieldnames'; -import { Setup } from '../../../../helpers/setup_request'; +import { Setup } from '../../../../../lib/helpers/setup_request'; import { fetchAndTransformMetrics } from '../../../fetch_and_transform_metrics'; import { ChartBase } from '../../../types'; import { JAVA_AGENT_NAMES } from '../../../../../../common/agent_name'; diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/index.ts b/x-pack/plugins/apm/server/routes/metrics/by_agent/java/index.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/metrics/by_agent/java/index.ts rename to x-pack/plugins/apm/server/routes/metrics/by_agent/java/index.ts index 9039bb19ebb78..5250884ed5e44 100644 --- a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/index.ts +++ b/x-pack/plugins/apm/server/routes/metrics/by_agent/java/index.ts @@ -7,7 +7,7 @@ import { withApmSpan } from '../../../../utils/with_apm_span'; import { getHeapMemoryChart } from './heap_memory'; -import { Setup } from '../../../helpers/setup_request'; +import { Setup } from '../../../../lib/helpers/setup_request'; import { getNonHeapMemoryChart } from './non_heap_memory'; import { getThreadCountChart } from './thread_count'; import { getCPUChartData } from '../shared/cpu'; diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/non_heap_memory/index.ts b/x-pack/plugins/apm/server/routes/metrics/by_agent/java/non_heap_memory/index.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/metrics/by_agent/java/non_heap_memory/index.ts rename to x-pack/plugins/apm/server/routes/metrics/by_agent/java/non_heap_memory/index.ts index 9fa758cb4dbd8..ffcce74ee6766 100644 --- a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/non_heap_memory/index.ts +++ b/x-pack/plugins/apm/server/routes/metrics/by_agent/java/non_heap_memory/index.ts @@ -13,7 +13,7 @@ import { METRIC_JAVA_NON_HEAP_MEMORY_USED, AGENT_NAME, } from '../../../../../../common/elasticsearch_fieldnames'; -import { Setup } from '../../../../helpers/setup_request'; +import { Setup } from '../../../../../lib/helpers/setup_request'; import { ChartBase } from '../../../types'; import { fetchAndTransformMetrics } from '../../../fetch_and_transform_metrics'; import { JAVA_AGENT_NAMES } from '../../../../../../common/agent_name'; diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/thread_count/index.ts b/x-pack/plugins/apm/server/routes/metrics/by_agent/java/thread_count/index.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/metrics/by_agent/java/thread_count/index.ts rename to x-pack/plugins/apm/server/routes/metrics/by_agent/java/thread_count/index.ts index 306666d27cd1c..699812ffc8463 100644 --- a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/thread_count/index.ts +++ b/x-pack/plugins/apm/server/routes/metrics/by_agent/java/thread_count/index.ts @@ -11,7 +11,7 @@ import { METRIC_JAVA_THREAD_COUNT, AGENT_NAME, } from '../../../../../../common/elasticsearch_fieldnames'; -import { Setup } from '../../../../helpers/setup_request'; +import { Setup } from '../../../../../lib/helpers/setup_request'; import { ChartBase } from '../../../types'; import { fetchAndTransformMetrics } from '../../../fetch_and_transform_metrics'; import { JAVA_AGENT_NAMES } from '../../../../../../common/agent_name'; diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/shared/cpu/index.ts b/x-pack/plugins/apm/server/routes/metrics/by_agent/shared/cpu/index.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/metrics/by_agent/shared/cpu/index.ts rename to x-pack/plugins/apm/server/routes/metrics/by_agent/shared/cpu/index.ts index 0911081b20324..95c39d4bd55cc 100644 --- a/x-pack/plugins/apm/server/lib/metrics/by_agent/shared/cpu/index.ts +++ b/x-pack/plugins/apm/server/routes/metrics/by_agent/shared/cpu/index.ts @@ -11,7 +11,7 @@ import { METRIC_SYSTEM_CPU_PERCENT, METRIC_PROCESS_CPU_PERCENT, } from '../../../../../../common/elasticsearch_fieldnames'; -import { Setup } from '../../../../helpers/setup_request'; +import { Setup } from '../../../../../lib/helpers/setup_request'; import { ChartBase } from '../../../types'; import { fetchAndTransformMetrics } from '../../../fetch_and_transform_metrics'; diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/shared/memory/index.ts b/x-pack/plugins/apm/server/routes/metrics/by_agent/shared/memory/index.ts similarity index 98% rename from x-pack/plugins/apm/server/lib/metrics/by_agent/shared/memory/index.ts rename to x-pack/plugins/apm/server/routes/metrics/by_agent/shared/memory/index.ts index 828ee28260471..d0e84211ef455 100644 --- a/x-pack/plugins/apm/server/lib/metrics/by_agent/shared/memory/index.ts +++ b/x-pack/plugins/apm/server/routes/metrics/by_agent/shared/memory/index.ts @@ -13,7 +13,7 @@ import { METRIC_SYSTEM_FREE_MEMORY, METRIC_SYSTEM_TOTAL_MEMORY, } from '../../../../../../common/elasticsearch_fieldnames'; -import { Setup } from '../../../../helpers/setup_request'; +import { Setup } from '../../../../../lib/helpers/setup_request'; import { fetchAndTransformMetrics } from '../../../fetch_and_transform_metrics'; import { ChartBase } from '../../../types'; diff --git a/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts b/x-pack/plugins/apm/server/routes/metrics/fetch_and_transform_metrics.ts similarity index 94% rename from x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts rename to x-pack/plugins/apm/server/routes/metrics/fetch_and_transform_metrics.ts index 0a24179ed9fc6..e607ae08e0b23 100644 --- a/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts +++ b/x-pack/plugins/apm/server/routes/metrics/fetch_and_transform_metrics.ts @@ -10,8 +10,9 @@ import { euiLightVars as theme } from '@kbn/ui-shared-deps-src/theme'; import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types'; import { getVizColorForIndex } from '../../../common/viz_colors'; import { AggregationOptionsByType } from '../../../../../../src/core/types/elasticsearch'; -import { getMetricsDateHistogramParams } from '../helpers/metrics'; -import { Setup } from '../helpers/setup_request'; +import { APMEventESSearchRequest } from '../../lib/helpers/create_es_client/create_apm_event_client'; +import { getMetricsDateHistogramParams } from '../../lib/helpers/metrics'; +import { Setup } from '../../lib/helpers/setup_request'; import { ChartBase } from './types'; import { environmentQuery, @@ -20,7 +21,6 @@ import { import { kqlQuery, rangeQuery } from '../../../../observability/server'; import { ProcessorEvent } from '../../../common/processor_event'; import { SERVICE_NAME } from '../../../common/elasticsearch_fieldnames'; -import { APMEventESSearchRequest } from '../helpers/create_es_client/create_apm_event_client'; import { PromiseReturnType } from '../../../../observability/typings/common'; type MetricsAggregationMap = Unionize<{ diff --git a/x-pack/plugins/apm/server/lib/metrics/get_metrics_chart_data_by_agent.ts b/x-pack/plugins/apm/server/routes/metrics/get_metrics_chart_data_by_agent.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/metrics/get_metrics_chart_data_by_agent.ts rename to x-pack/plugins/apm/server/routes/metrics/get_metrics_chart_data_by_agent.ts index 611bb8196032c..c6927417687da 100644 --- a/x-pack/plugins/apm/server/lib/metrics/get_metrics_chart_data_by_agent.ts +++ b/x-pack/plugins/apm/server/routes/metrics/get_metrics_chart_data_by_agent.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; import { getJavaMetricsCharts } from './by_agent/java'; import { getDefaultMetricsCharts } from './by_agent/default'; import { isJavaAgentName } from '../../../common/agent_name'; diff --git a/x-pack/plugins/apm/server/lib/metrics/queries.test.ts b/x-pack/plugins/apm/server/routes/metrics/queries.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/metrics/queries.test.ts rename to x-pack/plugins/apm/server/routes/metrics/queries.test.ts diff --git a/x-pack/plugins/apm/server/routes/metrics.ts b/x-pack/plugins/apm/server/routes/metrics/route.ts similarity index 76% rename from x-pack/plugins/apm/server/routes/metrics.ts rename to x-pack/plugins/apm/server/routes/metrics/route.ts index 36a504859797a..4e15188827e9b 100644 --- a/x-pack/plugins/apm/server/routes/metrics.ts +++ b/x-pack/plugins/apm/server/routes/metrics/route.ts @@ -6,11 +6,11 @@ */ import * as t from 'io-ts'; -import { setupRequest } from '../lib/helpers/setup_request'; -import { getMetricsChartDataByAgent } from '../lib/metrics/get_metrics_chart_data_by_agent'; -import { createApmServerRoute } from './apm_routes/create_apm_server_route'; -import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; -import { environmentRt, kueryRt, rangeRt } from './default_api_types'; +import { setupRequest } from '../../lib/helpers/setup_request'; +import { getMetricsChartDataByAgent } from './get_metrics_chart_data_by_agent'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; +import { environmentRt, kueryRt, rangeRt } from '../default_api_types'; const metricsChartsRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/services/{serviceName}/metrics/charts', diff --git a/x-pack/plugins/apm/server/lib/metrics/types.ts b/x-pack/plugins/apm/server/routes/metrics/types.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/metrics/types.ts rename to x-pack/plugins/apm/server/routes/metrics/types.ts diff --git a/x-pack/plugins/apm/server/lib/observability_overview/get_service_count.ts b/x-pack/plugins/apm/server/routes/observability_overview/get_service_count.ts similarity index 90% rename from x-pack/plugins/apm/server/lib/observability_overview/get_service_count.ts rename to x-pack/plugins/apm/server/routes/observability_overview/get_service_count.ts index 3eb11f668115d..74b70e5fa7d60 100644 --- a/x-pack/plugins/apm/server/lib/observability_overview/get_service_count.ts +++ b/x-pack/plugins/apm/server/routes/observability_overview/get_service_count.ts @@ -8,8 +8,8 @@ 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 { getProcessorEventForTransactions } from '../helpers/transactions'; +import { Setup } from '../../lib/helpers/setup_request'; +import { getProcessorEventForTransactions } from '../../lib/helpers/transactions'; export async function getServiceCount({ setup, diff --git a/x-pack/plugins/apm/server/lib/observability_overview/get_transactions_per_minute.ts b/x-pack/plugins/apm/server/routes/observability_overview/get_transactions_per_minute.ts similarity index 93% rename from x-pack/plugins/apm/server/lib/observability_overview/get_transactions_per_minute.ts rename to x-pack/plugins/apm/server/routes/observability_overview/get_transactions_per_minute.ts index de4d6dec4e1fe..83e51d7d638fe 100644 --- a/x-pack/plugins/apm/server/lib/observability_overview/get_transactions_per_minute.ts +++ b/x-pack/plugins/apm/server/routes/observability_overview/get_transactions_per_minute.ts @@ -11,12 +11,12 @@ import { } from '../../../common/transaction_types'; import { TRANSACTION_TYPE } from '../../../common/elasticsearch_fieldnames'; import { rangeQuery } from '../../../../observability/server'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; import { getDocumentTypeFilterForTransactions, getProcessorEventForTransactions, -} from '../helpers/transactions'; -import { calculateThroughputWithRange } from '../helpers/calculate_throughput'; +} from '../../lib/helpers/transactions'; +import { calculateThroughputWithRange } from '../../lib/helpers/calculate_throughput'; export async function getTransactionsPerMinute({ setup, diff --git a/x-pack/plugins/apm/server/lib/observability_overview/has_data.ts b/x-pack/plugins/apm/server/routes/observability_overview/has_data.ts similarity index 94% rename from x-pack/plugins/apm/server/lib/observability_overview/has_data.ts rename to x-pack/plugins/apm/server/routes/observability_overview/has_data.ts index f09b67ec98dfb..9f98af055e696 100644 --- a/x-pack/plugins/apm/server/lib/observability_overview/has_data.ts +++ b/x-pack/plugins/apm/server/routes/observability_overview/has_data.ts @@ -6,7 +6,7 @@ */ import { ProcessorEvent } from '../../../common/processor_event'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; export async function getHasData({ setup }: { setup: Setup }) { const { apmEventClient } = setup; diff --git a/x-pack/plugins/apm/server/routes/observability_overview.ts b/x-pack/plugins/apm/server/routes/observability_overview/route.ts similarity index 74% rename from x-pack/plugins/apm/server/routes/observability_overview.ts rename to x-pack/plugins/apm/server/routes/observability_overview/route.ts index 2df3212d8da70..c99586638c3de 100644 --- a/x-pack/plugins/apm/server/routes/observability_overview.ts +++ b/x-pack/plugins/apm/server/routes/observability_overview/route.ts @@ -7,15 +7,15 @@ import * as t from 'io-ts'; import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt'; -import { setupRequest } from '../lib/helpers/setup_request'; -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/transactions'; -import { withApmSpan } from '../utils/with_apm_span'; -import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; -import { createApmServerRoute } from './apm_routes/create_apm_server_route'; +import { setupRequest } from '../../lib/helpers/setup_request'; +import { getServiceCount } from './get_service_count'; +import { getTransactionsPerMinute } from './get_transactions_per_minute'; +import { getHasData } from './has_data'; +import { rangeRt } from '../default_api_types'; +import { getSearchAggregatedTransactions } from '../../lib/helpers/transactions'; +import { withApmSpan } from '../../utils/with_apm_span'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; const observabilityOverviewHasDataRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/observability_overview/has_data', diff --git a/x-pack/plugins/apm/server/lib/rum_client/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/routes/rum_client/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/plugins/apm/server/lib/rum_client/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/routes/rum_client/__snapshots__/queries.test.ts.snap diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_client_metrics.ts b/x-pack/plugins/apm/server/routes/rum_client/get_client_metrics.ts similarity index 98% rename from x-pack/plugins/apm/server/lib/rum_client/get_client_metrics.ts rename to x-pack/plugins/apm/server/routes/rum_client/get_client_metrics.ts index 206fc134a0c87..40352db9f18a6 100644 --- a/x-pack/plugins/apm/server/lib/rum_client/get_client_metrics.ts +++ b/x-pack/plugins/apm/server/routes/rum_client/get_client_metrics.ts @@ -7,7 +7,7 @@ import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions'; import { mergeProjection } from '../../projections/util/merge_projection'; -import { SetupUX } from '../../routes/rum_client'; +import { SetupUX } from './route'; import { TRANSACTION_TIME_TO_FIRST_BYTE, TRANSACTION_DURATION, diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_js_errors.ts b/x-pack/plugins/apm/server/routes/rum_client/get_js_errors.ts similarity index 98% rename from x-pack/plugins/apm/server/lib/rum_client/get_js_errors.ts rename to x-pack/plugins/apm/server/routes/rum_client/get_js_errors.ts index dca575b42cf0a..a0f7c0940b812 100644 --- a/x-pack/plugins/apm/server/lib/rum_client/get_js_errors.ts +++ b/x-pack/plugins/apm/server/routes/rum_client/get_js_errors.ts @@ -6,7 +6,7 @@ */ import { mergeProjection } from '../../projections/util/merge_projection'; -import { SetupUX } from '../../routes/rum_client'; +import { SetupUX } from './route'; import { getRumErrorsProjection } from '../../projections/rum_page_load_transactions'; import { ERROR_EXC_MESSAGE, diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_long_task_metrics.ts b/x-pack/plugins/apm/server/routes/rum_client/get_long_task_metrics.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/rum_client/get_long_task_metrics.ts rename to x-pack/plugins/apm/server/routes/rum_client/get_long_task_metrics.ts index d5cc78e2f3062..29ef955e19aa4 100644 --- a/x-pack/plugins/apm/server/lib/rum_client/get_long_task_metrics.ts +++ b/x-pack/plugins/apm/server/routes/rum_client/get_long_task_metrics.ts @@ -7,7 +7,7 @@ import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions'; import { mergeProjection } from '../../projections/util/merge_projection'; -import { SetupUX } from '../../routes/rum_client'; +import { SetupUX } from './route'; const LONG_TASK_SUM_FIELD = 'transaction.experience.longtask.sum'; const LONG_TASK_COUNT_FIELD = 'transaction.experience.longtask.count'; diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_page_load_distribution.ts b/x-pack/plugins/apm/server/routes/rum_client/get_page_load_distribution.ts similarity index 99% rename from x-pack/plugins/apm/server/lib/rum_client/get_page_load_distribution.ts rename to x-pack/plugins/apm/server/routes/rum_client/get_page_load_distribution.ts index e551b4a34746c..27c8c4668ce9b 100644 --- a/x-pack/plugins/apm/server/lib/rum_client/get_page_load_distribution.ts +++ b/x-pack/plugins/apm/server/routes/rum_client/get_page_load_distribution.ts @@ -8,7 +8,7 @@ import { TRANSACTION_DURATION } from '../../../common/elasticsearch_fieldnames'; import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions'; import { mergeProjection } from '../../projections/util/merge_projection'; -import { SetupUX } from '../../routes/rum_client'; +import { SetupUX } from './route'; export const MICRO_TO_SEC = 1000000; diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_page_view_trends.ts b/x-pack/plugins/apm/server/routes/rum_client/get_page_view_trends.ts similarity index 98% rename from x-pack/plugins/apm/server/lib/rum_client/get_page_view_trends.ts rename to x-pack/plugins/apm/server/routes/rum_client/get_page_view_trends.ts index 87766aae43272..6bcc7f66d1dfd 100644 --- a/x-pack/plugins/apm/server/lib/rum_client/get_page_view_trends.ts +++ b/x-pack/plugins/apm/server/routes/rum_client/get_page_view_trends.ts @@ -7,7 +7,7 @@ import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions'; import { mergeProjection } from '../../projections/util/merge_projection'; -import { SetupUX } from '../../routes/rum_client'; +import { SetupUX } from './route'; import { BreakdownItem } from '../../../typings/ui_filters'; export async function getPageViewTrends({ diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_pl_dist_breakdown.ts b/x-pack/plugins/apm/server/routes/rum_client/get_pl_dist_breakdown.ts similarity index 98% rename from x-pack/plugins/apm/server/lib/rum_client/get_pl_dist_breakdown.ts rename to x-pack/plugins/apm/server/routes/rum_client/get_pl_dist_breakdown.ts index 298f2a3b7ddf0..d6a67b57fa98f 100644 --- a/x-pack/plugins/apm/server/lib/rum_client/get_pl_dist_breakdown.ts +++ b/x-pack/plugins/apm/server/routes/rum_client/get_pl_dist_breakdown.ts @@ -8,7 +8,7 @@ import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions'; import { ProcessorEvent } from '../../../common/processor_event'; import { mergeProjection } from '../../projections/util/merge_projection'; -import { SetupUX } from '../../routes/rum_client'; +import { SetupUX } from './route'; import { CLIENT_GEO_COUNTRY_ISO_CODE, USER_AGENT_DEVICE, diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_rum_services.ts b/x-pack/plugins/apm/server/routes/rum_client/get_rum_services.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/rum_client/get_rum_services.ts rename to x-pack/plugins/apm/server/routes/rum_client/get_rum_services.ts index 1929f7e3ed994..e62b54f00d212 100644 --- a/x-pack/plugins/apm/server/lib/rum_client/get_rum_services.ts +++ b/x-pack/plugins/apm/server/routes/rum_client/get_rum_services.ts @@ -5,7 +5,7 @@ * 2.0. */ import { SERVICE_NAME } from '../../../common/elasticsearch_fieldnames'; -import { SetupUX } from '../../routes/rum_client'; +import { SetupUX } from './route'; import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions'; import { mergeProjection } from '../../projections/util/merge_projection'; diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_url_search.ts b/x-pack/plugins/apm/server/routes/rum_client/get_url_search.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/rum_client/get_url_search.ts rename to x-pack/plugins/apm/server/routes/rum_client/get_url_search.ts index 515df78f87bd8..0ffb836402f61 100644 --- a/x-pack/plugins/apm/server/lib/rum_client/get_url_search.ts +++ b/x-pack/plugins/apm/server/routes/rum_client/get_url_search.ts @@ -6,7 +6,7 @@ */ import { mergeProjection } from '../../projections/util/merge_projection'; -import { SetupUX } from '../../routes/rum_client'; +import { SetupUX } from './route'; import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions'; import { TRANSACTION_DURATION, diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_visitor_breakdown.ts b/x-pack/plugins/apm/server/routes/rum_client/get_visitor_breakdown.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/rum_client/get_visitor_breakdown.ts rename to x-pack/plugins/apm/server/routes/rum_client/get_visitor_breakdown.ts index ed0a4e90a4cb7..d7447889db849 100644 --- a/x-pack/plugins/apm/server/lib/rum_client/get_visitor_breakdown.ts +++ b/x-pack/plugins/apm/server/routes/rum_client/get_visitor_breakdown.ts @@ -7,7 +7,7 @@ import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions'; import { mergeProjection } from '../../projections/util/merge_projection'; -import { SetupUX } from '../../routes/rum_client'; +import { SetupUX } from './route'; import { USER_AGENT_NAME, USER_AGENT_OS, diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_web_core_vitals.ts b/x-pack/plugins/apm/server/routes/rum_client/get_web_core_vitals.ts similarity index 98% rename from x-pack/plugins/apm/server/lib/rum_client/get_web_core_vitals.ts rename to x-pack/plugins/apm/server/routes/rum_client/get_web_core_vitals.ts index 6dfa3abe117df..6a3b3a1c7b1c8 100644 --- a/x-pack/plugins/apm/server/lib/rum_client/get_web_core_vitals.ts +++ b/x-pack/plugins/apm/server/routes/rum_client/get_web_core_vitals.ts @@ -7,7 +7,7 @@ import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions'; import { mergeProjection } from '../../projections/util/merge_projection'; -import { SetupUX } from '../../routes/rum_client'; +import { SetupUX } from './route'; import { CLS_FIELD, FCP_FIELD, diff --git a/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts b/x-pack/plugins/apm/server/routes/rum_client/has_rum_data.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts rename to x-pack/plugins/apm/server/routes/rum_client/has_rum_data.ts index ba35ac5c5c89c..6cb3bc069e072 100644 --- a/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts +++ b/x-pack/plugins/apm/server/routes/rum_client/has_rum_data.ts @@ -6,7 +6,7 @@ */ import moment from 'moment'; -import { SetupUX } from '../../routes/rum_client'; +import { SetupUX } from './route'; import { SERVICE_NAME, TRANSACTION_TYPE, diff --git a/x-pack/plugins/apm/server/lib/rum_client/queries.test.ts b/x-pack/plugins/apm/server/routes/rum_client/queries.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/rum_client/queries.test.ts rename to x-pack/plugins/apm/server/routes/rum_client/queries.test.ts diff --git a/x-pack/plugins/apm/server/routes/rum_client.ts b/x-pack/plugins/apm/server/routes/rum_client/route.ts similarity index 87% rename from x-pack/plugins/apm/server/routes/rum_client.ts rename to x-pack/plugins/apm/server/routes/rum_client/route.ts index e84a281a7ce1b..482dcc0799ed0 100644 --- a/x-pack/plugins/apm/server/routes/rum_client.ts +++ b/x-pack/plugins/apm/server/routes/rum_client/route.ts @@ -7,23 +7,23 @@ import * as t from 'io-ts'; import { Logger } from 'kibana/server'; import { isoToEpochRt } from '@kbn/io-ts-utils/iso_to_epoch_rt'; -import { setupRequest, Setup } from '../lib/helpers/setup_request'; -import { getClientMetrics } from '../lib/rum_client/get_client_metrics'; -import { getJSErrors } from '../lib/rum_client/get_js_errors'; -import { getLongTaskMetrics } from '../lib/rum_client/get_long_task_metrics'; -import { getPageLoadDistribution } from '../lib/rum_client/get_page_load_distribution'; -import { getPageViewTrends } from '../lib/rum_client/get_page_view_trends'; -import { getPageLoadDistBreakdown } from '../lib/rum_client/get_pl_dist_breakdown'; -import { getRumServices } from '../lib/rum_client/get_rum_services'; -import { getUrlSearch } from '../lib/rum_client/get_url_search'; -import { getVisitorBreakdown } from '../lib/rum_client/get_visitor_breakdown'; -import { getWebCoreVitals } from '../lib/rum_client/get_web_core_vitals'; -import { hasRumData } from '../lib/rum_client/has_rum_data'; -import { createApmServerRoute } from './apm_routes/create_apm_server_route'; -import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; -import { rangeRt } from './default_api_types'; -import { UxUIFilters } from '../../typings/ui_filters'; -import { APMRouteHandlerResources } from '../routes/typings'; +import { setupRequest, Setup } from '../../lib/helpers/setup_request'; +import { getClientMetrics } from './get_client_metrics'; +import { getJSErrors } from './get_js_errors'; +import { getLongTaskMetrics } from './get_long_task_metrics'; +import { getPageLoadDistribution } from './get_page_load_distribution'; +import { getPageViewTrends } from './get_page_view_trends'; +import { getPageLoadDistBreakdown } from './get_pl_dist_breakdown'; +import { getRumServices } from './get_rum_services'; +import { getUrlSearch } from './get_url_search'; +import { getVisitorBreakdown } from './get_visitor_breakdown'; +import { getWebCoreVitals } from './get_web_core_vitals'; +import { hasRumData } from './has_rum_data'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; +import { rangeRt } from '../default_api_types'; +import { UxUIFilters } from '../../../typings/ui_filters'; +import { APMRouteHandlerResources } from '../typings'; export type SetupUX = Setup & { uiFilters: UxUIFilters; diff --git a/x-pack/plugins/apm/server/lib/rum_client/ui_filters/get_es_filter.test.ts b/x-pack/plugins/apm/server/routes/rum_client/ui_filters/get_es_filter.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/rum_client/ui_filters/get_es_filter.test.ts rename to x-pack/plugins/apm/server/routes/rum_client/ui_filters/get_es_filter.test.ts diff --git a/x-pack/plugins/apm/server/lib/rum_client/ui_filters/get_es_filter.ts b/x-pack/plugins/apm/server/routes/rum_client/ui_filters/get_es_filter.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/rum_client/ui_filters/get_es_filter.ts rename to x-pack/plugins/apm/server/routes/rum_client/ui_filters/get_es_filter.ts diff --git a/x-pack/plugins/apm/server/lib/service_map/fetch_service_paths_from_trace_ids.ts b/x-pack/plugins/apm/server/routes/service_map/fetch_service_paths_from_trace_ids.ts similarity index 99% rename from x-pack/plugins/apm/server/lib/service_map/fetch_service_paths_from_trace_ids.ts rename to x-pack/plugins/apm/server/routes/service_map/fetch_service_paths_from_trace_ids.ts index 2f725b61942cd..b3bd4d1510180 100644 --- a/x-pack/plugins/apm/server/lib/service_map/fetch_service_paths_from_trace_ids.ts +++ b/x-pack/plugins/apm/server/routes/service_map/fetch_service_paths_from_trace_ids.ts @@ -13,7 +13,7 @@ import { ExternalConnectionNode, ServiceConnectionNode, } from '../../../common/service_map'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; export async function fetchServicePathsFromTraceIds( setup: Setup, diff --git a/x-pack/plugins/apm/server/lib/service_map/get_service_anomalies.ts b/x-pack/plugins/apm/server/routes/service_map/get_service_anomalies.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/service_map/get_service_anomalies.ts rename to x-pack/plugins/apm/server/routes/service_map/get_service_anomalies.ts index 2aa2f5c6eead5..65c022b7175de 100644 --- a/x-pack/plugins/apm/server/lib/service_map/get_service_anomalies.ts +++ b/x-pack/plugins/apm/server/routes/service_map/get_service_anomalies.ts @@ -20,8 +20,8 @@ import { } from '../../../common/transaction_types'; import { rangeQuery } from '../../../../observability/server'; import { withApmSpan } from '../../utils/with_apm_span'; -import { getMlJobsWithAPMGroup } from '../anomaly_detection/get_ml_jobs_with_apm_group'; -import { Setup } from '../helpers/setup_request'; +import { getMlJobsWithAPMGroup } from '../../lib/anomaly_detection/get_ml_jobs_with_apm_group'; +import { Setup } from '../../lib/helpers/setup_request'; import { apmMlAnomalyQuery } from '../../../common/anomaly_detection/apm_ml_anomaly_query'; import { ApmMlDetectorIndex } from '../../../common/anomaly_detection/apm_ml_detectors'; diff --git a/x-pack/plugins/apm/server/lib/service_map/get_service_map.ts b/x-pack/plugins/apm/server/routes/service_map/get_service_map.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/service_map/get_service_map.ts rename to x-pack/plugins/apm/server/routes/service_map/get_service_map.ts index 9f94bdd9275c0..d7eb101f77e38 100644 --- a/x-pack/plugins/apm/server/lib/service_map/get_service_map.ts +++ b/x-pack/plugins/apm/server/routes/service_map/get_service_map.ts @@ -17,7 +17,7 @@ import { } from '../../../common/elasticsearch_fieldnames'; import { environmentQuery } from '../../../common/utils/environment_query'; import { withApmSpan } from '../../utils/with_apm_span'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; import { DEFAULT_ANOMALIES, getServiceAnomalies, @@ -26,7 +26,7 @@ import { getServiceMapFromTraceIds } from './get_service_map_from_trace_ids'; import { getTraceSampleIds } from './get_trace_sample_ids'; import { transformServiceMapResponses } from './transform_service_map_responses'; import { ENVIRONMENT_ALL } from '../../../common/environment_filter_values'; -import { getProcessorEventForTransactions } from '../helpers/transactions'; +import { getProcessorEventForTransactions } from '../../lib/helpers/transactions'; export interface IEnvOptions { setup: Setup; diff --git a/x-pack/plugins/apm/server/lib/service_map/get_service_map_backend_node_info.ts b/x-pack/plugins/apm/server/routes/service_map/get_service_map_backend_node_info.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/service_map/get_service_map_backend_node_info.ts rename to x-pack/plugins/apm/server/routes/service_map/get_service_map_backend_node_info.ts index c8242731e756c..3866bac88ef44 100644 --- a/x-pack/plugins/apm/server/lib/service_map/get_service_map_backend_node_info.ts +++ b/x-pack/plugins/apm/server/routes/service_map/get_service_map_backend_node_info.ts @@ -16,8 +16,8 @@ import { EventOutcome } from '../../../common/event_outcome'; import { ProcessorEvent } from '../../../common/processor_event'; import { environmentQuery } from '../../../common/utils/environment_query'; import { withApmSpan } from '../../utils/with_apm_span'; -import { calculateThroughput } from '../helpers/calculate_throughput'; -import { Setup } from '../helpers/setup_request'; +import { calculateThroughput } from '../../lib/helpers/calculate_throughput'; +import { Setup } from '../../lib/helpers/setup_request'; interface Options { setup: Setup; diff --git a/x-pack/plugins/apm/server/lib/service_map/get_service_map_from_trace_ids.test.ts b/x-pack/plugins/apm/server/routes/service_map/get_service_map_from_trace_ids.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/service_map/get_service_map_from_trace_ids.test.ts rename to x-pack/plugins/apm/server/routes/service_map/get_service_map_from_trace_ids.test.ts diff --git a/x-pack/plugins/apm/server/lib/service_map/get_service_map_from_trace_ids.ts b/x-pack/plugins/apm/server/routes/service_map/get_service_map_from_trace_ids.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/service_map/get_service_map_from_trace_ids.ts rename to x-pack/plugins/apm/server/routes/service_map/get_service_map_from_trace_ids.ts index e77e127aebb42..6a61a514881b0 100644 --- a/x-pack/plugins/apm/server/lib/service_map/get_service_map_from_trace_ids.ts +++ b/x-pack/plugins/apm/server/routes/service_map/get_service_map_from_trace_ids.ts @@ -7,7 +7,7 @@ import { find, uniqBy } from 'lodash'; import { Connection, ConnectionNode } from '../../../common/service_map'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; import { fetchServicePathsFromTraceIds } from './fetch_service_paths_from_trace_ids'; export function getConnections({ diff --git a/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.test.ts b/x-pack/plugins/apm/server/routes/service_map/get_service_map_service_node_info.test.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.test.ts rename to x-pack/plugins/apm/server/routes/service_map/get_service_map_service_node_info.test.ts index e064d97bb7aee..9f65481d07489 100644 --- a/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.test.ts +++ b/x-pack/plugins/apm/server/routes/service_map/get_service_map_service_node_info.test.ts @@ -6,8 +6,8 @@ */ import { getServiceMapServiceNodeInfo } from './get_service_map_service_node_info'; -import { Setup } from '../helpers/setup_request'; -import * as getErrorRateModule from '../transaction_groups/get_error_rate'; +import { Setup } from '../../lib/helpers/setup_request'; +import * as getErrorRateModule from '../../lib/transaction_groups/get_error_rate'; import { ENVIRONMENT_ALL } from '../../../common/environment_filter_values'; describe('getServiceMapServiceNodeInfo', () => { diff --git a/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.ts b/x-pack/plugins/apm/server/routes/service_map/get_service_map_service_node_info.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.ts rename to x-pack/plugins/apm/server/routes/service_map/get_service_map_service_node_info.ts index 2f089adf70c1c..d6eb7729effaf 100644 --- a/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.ts +++ b/x-pack/plugins/apm/server/routes/service_map/get_service_map_service_node_info.ts @@ -26,13 +26,13 @@ import { getDocumentTypeFilterForTransactions, getTransactionDurationFieldForTransactions, getProcessorEventForTransactions, -} from '../helpers/transactions'; -import { Setup } from '../helpers/setup_request'; +} from '../../lib/helpers/transactions'; +import { Setup } from '../../lib/helpers/setup_request'; import { percentCgroupMemoryUsedScript, percentSystemMemoryUsedScript, } from '../metrics/by_agent/shared/memory'; -import { getErrorRate } from '../transaction_groups/get_error_rate'; +import { getErrorRate } from '../../lib/transaction_groups/get_error_rate'; interface Options { setup: Setup; diff --git a/x-pack/plugins/apm/server/lib/service_map/get_trace_sample_ids.ts b/x-pack/plugins/apm/server/routes/service_map/get_trace_sample_ids.ts similarity index 98% rename from x-pack/plugins/apm/server/lib/service_map/get_trace_sample_ids.ts rename to x-pack/plugins/apm/server/routes/service_map/get_trace_sample_ids.ts index 7e16e69498e7c..af24953833a27 100644 --- a/x-pack/plugins/apm/server/lib/service_map/get_trace_sample_ids.ts +++ b/x-pack/plugins/apm/server/routes/service_map/get_trace_sample_ids.ts @@ -18,7 +18,7 @@ import { ProcessorEvent } from '../../../common/processor_event'; import { SERVICE_MAP_TIMEOUT_ERROR } from '../../../common/service_map'; import { rangeQuery } from '../../../../observability/server'; import { environmentQuery } from '../../../common/utils/environment_query'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; const MAX_TRACES_TO_INSPECT = 1000; diff --git a/x-pack/plugins/apm/server/lib/service_map/group_resource_nodes.test.ts b/x-pack/plugins/apm/server/routes/service_map/group_resource_nodes.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/service_map/group_resource_nodes.test.ts rename to x-pack/plugins/apm/server/routes/service_map/group_resource_nodes.test.ts diff --git a/x-pack/plugins/apm/server/lib/service_map/group_resource_nodes.ts b/x-pack/plugins/apm/server/routes/service_map/group_resource_nodes.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/service_map/group_resource_nodes.ts rename to x-pack/plugins/apm/server/routes/service_map/group_resource_nodes.ts diff --git a/x-pack/plugins/apm/server/lib/service_map/mock_responses/group_resource_nodes_grouped.json b/x-pack/plugins/apm/server/routes/service_map/mock_responses/group_resource_nodes_grouped.json similarity index 100% rename from x-pack/plugins/apm/server/lib/service_map/mock_responses/group_resource_nodes_grouped.json rename to x-pack/plugins/apm/server/routes/service_map/mock_responses/group_resource_nodes_grouped.json diff --git a/x-pack/plugins/apm/server/lib/service_map/mock_responses/group_resource_nodes_pregrouped.json b/x-pack/plugins/apm/server/routes/service_map/mock_responses/group_resource_nodes_pregrouped.json similarity index 100% rename from x-pack/plugins/apm/server/lib/service_map/mock_responses/group_resource_nodes_pregrouped.json rename to x-pack/plugins/apm/server/routes/service_map/mock_responses/group_resource_nodes_pregrouped.json diff --git a/x-pack/plugins/apm/server/routes/service_map.ts b/x-pack/plugins/apm/server/routes/service_map/route.ts similarity index 81% rename from x-pack/plugins/apm/server/routes/service_map.ts rename to x-pack/plugins/apm/server/routes/service_map/route.ts index e75b4ec832d82..97d0c01ed6a44 100644 --- a/x-pack/plugins/apm/server/routes/service_map.ts +++ b/x-pack/plugins/apm/server/routes/service_map/route.ts @@ -7,17 +7,17 @@ import Boom from '@hapi/boom'; 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/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'; -import { getServiceMapServiceNodeInfo } from '../lib/service_map/get_service_map_service_node_info'; -import { createApmServerRoute } from './apm_routes/create_apm_server_route'; -import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; -import { environmentRt, rangeRt } from './default_api_types'; +import { isActivePlatinumLicense } from '../../../common/license_check'; +import { invalidLicenseMessage } from '../../../common/service_map'; +import { notifyFeatureUsage } from '../../feature'; +import { getSearchAggregatedTransactions } from '../../lib/helpers/transactions'; +import { setupRequest } from '../../lib/helpers/setup_request'; +import { getServiceMap } from './get_service_map'; +import { getServiceMapBackendNodeInfo } from './get_service_map_backend_node_info'; +import { getServiceMapServiceNodeInfo } from './get_service_map_service_node_info'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; +import { environmentRt, rangeRt } from '../default_api_types'; const serviceMapRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/service-map', diff --git a/x-pack/plugins/apm/server/lib/service_map/transform_service_map_responses.test.ts b/x-pack/plugins/apm/server/routes/service_map/transform_service_map_responses.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/service_map/transform_service_map_responses.test.ts rename to x-pack/plugins/apm/server/routes/service_map/transform_service_map_responses.test.ts diff --git a/x-pack/plugins/apm/server/lib/service_map/transform_service_map_responses.ts b/x-pack/plugins/apm/server/routes/service_map/transform_service_map_responses.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/service_map/transform_service_map_responses.ts rename to x-pack/plugins/apm/server/routes/service_map/transform_service_map_responses.ts diff --git a/x-pack/plugins/apm/server/lib/service_nodes/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/routes/service_nodes/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/plugins/apm/server/lib/service_nodes/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/routes/service_nodes/__snapshots__/queries.test.ts.snap diff --git a/x-pack/plugins/apm/server/lib/service_nodes/index.ts b/x-pack/plugins/apm/server/routes/service_nodes/get_service_nodes.ts similarity index 98% rename from x-pack/plugins/apm/server/lib/service_nodes/index.ts rename to x-pack/plugins/apm/server/routes/service_nodes/get_service_nodes.ts index 541fbb79c9e50..ebd56cb9768ce 100644 --- a/x-pack/plugins/apm/server/lib/service_nodes/index.ts +++ b/x-pack/plugins/apm/server/routes/service_nodes/get_service_nodes.ts @@ -21,7 +21,7 @@ import { import { ProcessorEvent } from '../../../common/processor_event'; import { kqlQuery, rangeQuery } from '../../../../observability/server'; import { environmentQuery } from '../../../common/utils/environment_query'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; const getServiceNodes = async ({ kuery, diff --git a/x-pack/plugins/apm/server/lib/service_nodes/queries.test.ts b/x-pack/plugins/apm/server/routes/service_nodes/queries.test.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/service_nodes/queries.test.ts rename to x-pack/plugins/apm/server/routes/service_nodes/queries.test.ts index f8bc3879d5794..470be6142aaed 100644 --- a/x-pack/plugins/apm/server/lib/service_nodes/queries.test.ts +++ b/x-pack/plugins/apm/server/routes/service_nodes/queries.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { getServiceNodes } from './'; +import { getServiceNodes } from './get_service_nodes'; import { SearchParamsMock, inspectSearchParams, diff --git a/x-pack/plugins/apm/server/routes/service_nodes.ts b/x-pack/plugins/apm/server/routes/service_nodes/route.ts similarity index 72% rename from x-pack/plugins/apm/server/routes/service_nodes.ts rename to x-pack/plugins/apm/server/routes/service_nodes/route.ts index 61d58bfa3cf38..027a907dd2659 100644 --- a/x-pack/plugins/apm/server/routes/service_nodes.ts +++ b/x-pack/plugins/apm/server/routes/service_nodes/route.ts @@ -6,12 +6,12 @@ */ import * as t from 'io-ts'; -import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; -import { createApmServerRoute } from './apm_routes/create_apm_server_route'; -import { setupRequest } from '../lib/helpers/setup_request'; -import { getServiceNodes } from '../lib/service_nodes'; -import { rangeRt, kueryRt } from './default_api_types'; -import { environmentRt } from '../../common/environment_rt'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { setupRequest } from '../../lib/helpers/setup_request'; +import { getServiceNodes } from './get_service_nodes'; +import { rangeRt, kueryRt } from '../default_api_types'; +import { environmentRt } from '../../../common/environment_rt'; const serviceNodesRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/services/{serviceName}/serviceNodes', diff --git a/x-pack/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/routes/services/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/routes/services/__snapshots__/queries.test.ts.snap diff --git a/x-pack/plugins/apm/server/lib/services/annotations/__fixtures__/multiple_versions.json b/x-pack/plugins/apm/server/routes/services/annotations/__fixtures__/multiple_versions.json similarity index 100% rename from x-pack/plugins/apm/server/lib/services/annotations/__fixtures__/multiple_versions.json rename to x-pack/plugins/apm/server/routes/services/annotations/__fixtures__/multiple_versions.json diff --git a/x-pack/plugins/apm/server/lib/services/annotations/__fixtures__/no_versions.json b/x-pack/plugins/apm/server/routes/services/annotations/__fixtures__/no_versions.json similarity index 100% rename from x-pack/plugins/apm/server/lib/services/annotations/__fixtures__/no_versions.json rename to x-pack/plugins/apm/server/routes/services/annotations/__fixtures__/no_versions.json diff --git a/x-pack/plugins/apm/server/lib/services/annotations/__fixtures__/one_version.json b/x-pack/plugins/apm/server/routes/services/annotations/__fixtures__/one_version.json similarity index 100% rename from x-pack/plugins/apm/server/lib/services/annotations/__fixtures__/one_version.json rename to x-pack/plugins/apm/server/routes/services/annotations/__fixtures__/one_version.json diff --git a/x-pack/plugins/apm/server/lib/services/annotations/__fixtures__/versions_first_seen.json b/x-pack/plugins/apm/server/routes/services/annotations/__fixtures__/versions_first_seen.json similarity index 100% rename from x-pack/plugins/apm/server/lib/services/annotations/__fixtures__/versions_first_seen.json rename to x-pack/plugins/apm/server/routes/services/annotations/__fixtures__/versions_first_seen.json diff --git a/x-pack/plugins/apm/server/lib/services/annotations/get_derived_service_annotations.ts b/x-pack/plugins/apm/server/routes/services/annotations/get_derived_service_annotations.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/services/annotations/get_derived_service_annotations.ts rename to x-pack/plugins/apm/server/routes/services/annotations/get_derived_service_annotations.ts index 22b37e33a26e2..523775de170e7 100644 --- a/x-pack/plugins/apm/server/lib/services/annotations/get_derived_service_annotations.ts +++ b/x-pack/plugins/apm/server/routes/services/annotations/get_derived_service_annotations.ts @@ -17,8 +17,8 @@ import { environmentQuery } from '../../../../common/utils/environment_query'; import { getDocumentTypeFilterForTransactions, getProcessorEventForTransactions, -} from '../../helpers/transactions'; -import { Setup } from '../../helpers/setup_request'; +} from '../../../lib/helpers/transactions'; +import { Setup } from '../../../lib/helpers/setup_request'; export async function getDerivedServiceAnnotations({ setup, diff --git a/x-pack/plugins/apm/server/lib/services/annotations/get_stored_annotations.ts b/x-pack/plugins/apm/server/routes/services/annotations/get_stored_annotations.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/services/annotations/get_stored_annotations.ts rename to x-pack/plugins/apm/server/routes/services/annotations/get_stored_annotations.ts diff --git a/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts b/x-pack/plugins/apm/server/routes/services/annotations/index.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/services/annotations/index.test.ts rename to x-pack/plugins/apm/server/routes/services/annotations/index.test.ts diff --git a/x-pack/plugins/apm/server/lib/services/annotations/index.ts b/x-pack/plugins/apm/server/routes/services/annotations/index.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/services/annotations/index.ts rename to x-pack/plugins/apm/server/routes/services/annotations/index.ts index 677530522f6ca..488a4ce6e4c20 100644 --- a/x-pack/plugins/apm/server/lib/services/annotations/index.ts +++ b/x-pack/plugins/apm/server/routes/services/annotations/index.ts @@ -8,7 +8,7 @@ import { ElasticsearchClient, Logger } from 'kibana/server'; import { ScopedAnnotationsClient } from '../../../../../observability/server'; import { getDerivedServiceAnnotations } from './get_derived_service_annotations'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { getStoredAnnotations } from './get_stored_annotations'; export async function getServiceAnnotations({ diff --git a/x-pack/plugins/apm/server/lib/services/get_service_agent.ts b/x-pack/plugins/apm/server/routes/services/get_service_agent.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/services/get_service_agent.ts rename to x-pack/plugins/apm/server/routes/services/get_service_agent.ts index dc3fee20fdf68..8117729eb9b59 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_agent.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_agent.ts @@ -12,7 +12,7 @@ import { SERVICE_RUNTIME_NAME, } from '../../../common/elasticsearch_fieldnames'; import { rangeQuery } from '../../../../observability/server'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; interface ServiceAgent { agent?: { diff --git a/x-pack/plugins/apm/server/lib/services/get_service_alerts.ts b/x-pack/plugins/apm/server/routes/services/get_service_alerts.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/services/get_service_alerts.ts rename to x-pack/plugins/apm/server/routes/services/get_service_alerts.ts diff --git a/x-pack/plugins/apm/server/lib/services/get_service_dependencies.ts b/x-pack/plugins/apm/server/routes/services/get_service_dependencies.ts similarity index 77% rename from x-pack/plugins/apm/server/lib/services/get_service_dependencies.ts rename to x-pack/plugins/apm/server/routes/services/get_service_dependencies.ts index d4472d495230a..cf60502e9861b 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_dependencies.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_dependencies.ts @@ -7,9 +7,9 @@ import { SERVICE_NAME } from '../../../common/elasticsearch_fieldnames'; import { environmentQuery } from '../../../common/utils/environment_query'; -import { getConnectionStats } from '../connections/get_connection_stats'; -import { getConnectionStatsItemsWithRelativeImpact } from '../connections/get_connection_stats/get_connection_stats_items_with_relative_impact'; -import { Setup } from '../helpers/setup_request'; +import { getConnectionStats } from '../../lib/connections/get_connection_stats'; +import { getConnectionStatsItemsWithRelativeImpact } from '../../lib/connections/get_connection_stats/get_connection_stats_items_with_relative_impact'; +import { Setup } from '../../lib/helpers/setup_request'; export async function getServiceDependencies({ setup, diff --git a/x-pack/plugins/apm/server/lib/services/get_service_dependencies_breakdown.ts b/x-pack/plugins/apm/server/routes/services/get_service_dependencies_breakdown.ts similarity index 90% rename from x-pack/plugins/apm/server/lib/services/get_service_dependencies_breakdown.ts rename to x-pack/plugins/apm/server/routes/services/get_service_dependencies_breakdown.ts index c0e1af40d98db..a0b8eb1768d6f 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_dependencies_breakdown.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_dependencies_breakdown.ts @@ -9,8 +9,8 @@ import { getNodeName } from '../../../common/connections'; import { kqlQuery } from '../../../../observability/server'; import { SERVICE_NAME } from '../../../common/elasticsearch_fieldnames'; import { environmentQuery } from '../../../common/utils/environment_query'; -import { Setup } from '../helpers/setup_request'; -import { getConnectionStats } from '../connections/get_connection_stats'; +import { Setup } from '../../lib/helpers/setup_request'; +import { getConnectionStats } from '../../lib/connections/get_connection_stats'; export async function getServiceDependenciesBreakdown({ setup, diff --git a/x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_detailed_statistics.ts b/x-pack/plugins/apm/server/routes/services/get_service_error_groups/get_service_error_group_detailed_statistics.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_detailed_statistics.ts rename to x-pack/plugins/apm/server/routes/services/get_service_error_groups/get_service_error_group_detailed_statistics.ts index 9a0b6155fe84d..17c538d0fd7ea 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_detailed_statistics.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_error_groups/get_service_error_group_detailed_statistics.ts @@ -15,8 +15,8 @@ import { import { ProcessorEvent } from '../../../../common/processor_event'; import { rangeQuery, kqlQuery } from '../../../../../observability/server'; import { environmentQuery } from '../../../../common/utils/environment_query'; -import { getBucketSize } from '../../helpers/get_bucket_size'; -import { Setup } from '../../helpers/setup_request'; +import { getBucketSize } from '../../../lib/helpers/get_bucket_size'; +import { Setup } from '../../../lib/helpers/setup_request'; export async function getServiceErrorGroupDetailedStatistics({ kuery, diff --git a/x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_main_statistics.ts b/x-pack/plugins/apm/server/routes/services/get_service_error_groups/get_service_error_group_main_statistics.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_main_statistics.ts rename to x-pack/plugins/apm/server/routes/services/get_service_error_groups/get_service_error_group_main_statistics.ts index 1a25b18f81aac..8d174abb1bed5 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_main_statistics.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_error_groups/get_service_error_group_main_statistics.ts @@ -15,8 +15,8 @@ import { } from '../../../../common/elasticsearch_fieldnames'; import { ProcessorEvent } from '../../../../common/processor_event'; import { environmentQuery } from '../../../../common/utils/environment_query'; -import { getErrorName } from '../../helpers/get_error_name'; -import { Setup } from '../../helpers/setup_request'; +import { getErrorName } from '../../../lib/helpers/get_error_name'; +import { Setup } from '../../../lib/helpers/setup_request'; export async function getServiceErrorGroupMainStatistics({ kuery, diff --git a/x-pack/plugins/apm/server/lib/services/get_service_error_groups/index.ts b/x-pack/plugins/apm/server/routes/services/get_service_error_groups/index.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/services/get_service_error_groups/index.ts rename to x-pack/plugins/apm/server/routes/services/get_service_error_groups/index.ts index 83cb38da6e0a3..1a853231bb09a 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_error_groups/index.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_error_groups/index.ts @@ -19,9 +19,9 @@ import { import { ProcessorEvent } from '../../../../common/processor_event'; import { environmentQuery } from '../../../../common/utils/environment_query'; import { withApmSpan } from '../../../utils/with_apm_span'; -import { getBucketSize } from '../../helpers/get_bucket_size'; -import { getErrorName } from '../../helpers/get_error_name'; -import { Setup } from '../../helpers/setup_request'; +import { getBucketSize } from '../../../lib/helpers/get_bucket_size'; +import { getErrorName } from '../../../lib/helpers/get_error_name'; +import { Setup } from '../../../lib/helpers/setup_request'; export type ServiceErrorGroupItem = ValuesType< PromiseReturnType diff --git a/x-pack/plugins/apm/server/lib/services/get_service_infrastructure.ts b/x-pack/plugins/apm/server/routes/services/get_service_infrastructure.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/services/get_service_infrastructure.ts rename to x-pack/plugins/apm/server/routes/services/get_service_infrastructure.ts index 09946187b90a2..cda0beb6b2d70 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_infrastructure.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_infrastructure.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; import { rangeQuery, kqlQuery } from '../../../../observability/server'; import { environmentQuery } from '../../../common/utils/environment_query'; import { ProcessorEvent } from '../../../common/processor_event'; diff --git a/x-pack/plugins/apm/server/lib/services/get_service_instance_metadata_details.ts b/x-pack/plugins/apm/server/routes/services/get_service_instance_metadata_details.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/services/get_service_instance_metadata_details.ts rename to x-pack/plugins/apm/server/routes/services/get_service_instance_metadata_details.ts index d349ca3ce0399..957d655b98e5d 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_instance_metadata_details.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_instance_metadata_details.ts @@ -12,12 +12,12 @@ import { SERVICE_NODE_NAME, } from '../../../common/elasticsearch_fieldnames'; import { rangeQuery } from '../../../../observability/server'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; import { maybe } from '../../../common/utils/maybe'; import { getDocumentTypeFilterForTransactions, getProcessorEventForTransactions, -} from '../helpers/transactions'; +} from '../../lib/helpers/transactions'; export async function getServiceInstanceMetadataDetails({ serviceName, diff --git a/x-pack/plugins/apm/server/lib/services/get_service_instances/detailed_statistics.ts b/x-pack/plugins/apm/server/routes/services/get_service_instances/detailed_statistics.ts similarity index 98% rename from x-pack/plugins/apm/server/lib/services/get_service_instances/detailed_statistics.ts rename to x-pack/plugins/apm/server/routes/services/get_service_instances/detailed_statistics.ts index fd6f0f6d03c66..10393e3434779 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_instances/detailed_statistics.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_instances/detailed_statistics.ts @@ -11,7 +11,7 @@ import { Coordinate } from '../../../../typings/timeseries'; import { LatencyAggregationType } from '../../../../common/latency_aggregation_types'; import { joinByKey } from '../../../../common/utils/join_by_key'; import { withApmSpan } from '../../../utils/with_apm_span'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { getServiceInstancesSystemMetricStatistics } from './get_service_instances_system_metric_statistics'; import { getServiceInstancesTransactionStatistics } from './get_service_instances_transaction_statistics'; diff --git a/x-pack/plugins/apm/server/lib/services/get_service_instances/get_service_instances_system_metric_statistics.ts b/x-pack/plugins/apm/server/routes/services/get_service_instances/get_service_instances_system_metric_statistics.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/services/get_service_instances/get_service_instances_system_metric_statistics.ts rename to x-pack/plugins/apm/server/routes/services/get_service_instances/get_service_instances_system_metric_statistics.ts index 61e89ed8ca5e3..11fcbd8ce6561 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_instances/get_service_instances_system_metric_statistics.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_instances/get_service_instances_system_metric_statistics.ts @@ -19,8 +19,8 @@ import { SERVICE_NODE_NAME_MISSING } from '../../../../common/service_nodes'; import { Coordinate } from '../../../../typings/timeseries'; import { kqlQuery, rangeQuery } from '../../../../../observability/server'; import { environmentQuery } from '../../../../common/utils/environment_query'; -import { getBucketSize } from '../../helpers/get_bucket_size'; -import { Setup } from '../../helpers/setup_request'; +import { getBucketSize } from '../../../lib/helpers/get_bucket_size'; +import { Setup } from '../../../lib/helpers/setup_request'; import { percentCgroupMemoryUsedScript, percentSystemMemoryUsedScript, 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/routes/services/get_service_instances/get_service_instances_transaction_statistics.ts similarity index 94% rename from x-pack/plugins/apm/server/lib/services/get_service_instances/get_service_instances_transaction_statistics.ts rename to x-pack/plugins/apm/server/routes/services/get_service_instances/get_service_instances_transaction_statistics.ts index b0f64036a1845..166e8d61142ea 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_instances/get_service_instances_transaction_statistics.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_instances/get_service_instances_transaction_statistics.ts @@ -20,14 +20,14 @@ import { getDocumentTypeFilterForTransactions, getTransactionDurationFieldForTransactions, getProcessorEventForTransactions, -} from '../../helpers/transactions'; -import { calculateThroughput } from '../../helpers/calculate_throughput'; -import { getBucketSizeForAggregatedTransactions } from '../../helpers/get_bucket_size_for_aggregated_transactions'; +} from '../../../lib/helpers/transactions'; +import { calculateThroughput } from '../../../lib/helpers/calculate_throughput'; +import { getBucketSizeForAggregatedTransactions } from '../../../lib/helpers/get_bucket_size_for_aggregated_transactions'; import { getLatencyAggregation, getLatencyValue, -} from '../../helpers/latency_aggregation_type'; -import { Setup } from '../../helpers/setup_request'; +} from '../../../lib/helpers/latency_aggregation_type'; +import { Setup } from '../../../lib/helpers/setup_request'; interface ServiceInstanceTransactionPrimaryStatistics { serviceNodeName: string; diff --git a/x-pack/plugins/apm/server/lib/services/get_service_instances/main_statistics.ts b/x-pack/plugins/apm/server/routes/services/get_service_instances/main_statistics.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/services/get_service_instances/main_statistics.ts rename to x-pack/plugins/apm/server/routes/services/get_service_instances/main_statistics.ts index ea34693bceb30..a064c71496de9 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_instances/main_statistics.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_instances/main_statistics.ts @@ -8,7 +8,7 @@ import { LatencyAggregationType } from '../../../../common/latency_aggregation_types'; import { joinByKey } from '../../../../common/utils/join_by_key'; import { withApmSpan } from '../../../utils/with_apm_span'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { getServiceInstancesSystemMetricStatistics } from './get_service_instances_system_metric_statistics'; import { getServiceInstancesTransactionStatistics } from './get_service_instances_transaction_statistics'; diff --git a/x-pack/plugins/apm/server/lib/services/get_service_metadata_details.ts b/x-pack/plugins/apm/server/routes/services/get_service_metadata_details.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/services/get_service_metadata_details.ts rename to x-pack/plugins/apm/server/routes/services/get_service_metadata_details.ts index e2852a51b0c06..b7ce68a0de578 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_metadata_details.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_metadata_details.ts @@ -22,8 +22,8 @@ import { import { ContainerType } from '../../../common/service_metadata'; import { rangeQuery } from '../../../../observability/server'; import { TransactionRaw } from '../../../typings/es_schemas/raw/transaction_raw'; -import { getProcessorEventForTransactions } from '../helpers/transactions'; -import { Setup } from '../helpers/setup_request'; +import { getProcessorEventForTransactions } from '../../lib/helpers/transactions'; +import { Setup } from '../../lib/helpers/setup_request'; import { should } from './get_service_metadata_icons'; type ServiceMetadataDetailsRaw = Pick< diff --git a/x-pack/plugins/apm/server/lib/services/get_service_metadata_icons.ts b/x-pack/plugins/apm/server/routes/services/get_service_metadata_icons.ts similarity index 94% rename from x-pack/plugins/apm/server/lib/services/get_service_metadata_icons.ts rename to x-pack/plugins/apm/server/routes/services/get_service_metadata_icons.ts index 2c93a298cb134..ca97e9d58f060 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_metadata_icons.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_metadata_icons.ts @@ -18,8 +18,8 @@ import { import { ContainerType } from '../../../common/service_metadata'; import { rangeQuery } from '../../../../observability/server'; import { TransactionRaw } from '../../../typings/es_schemas/raw/transaction_raw'; -import { getProcessorEventForTransactions } from '../helpers/transactions'; -import { Setup } from '../helpers/setup_request'; +import { getProcessorEventForTransactions } from '../../lib/helpers/transactions'; +import { Setup } from '../../lib/helpers/setup_request'; type ServiceMetadataIconsRaw = Pick< TransactionRaw, diff --git a/x-pack/plugins/apm/server/lib/services/get_service_node_metadata.ts b/x-pack/plugins/apm/server/routes/services/get_service_node_metadata.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/services/get_service_node_metadata.ts rename to x-pack/plugins/apm/server/routes/services/get_service_node_metadata.ts index ab0fa91529917..89e0e42e95914 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_node_metadata.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_node_metadata.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; import { HOST_NAME, CONTAINER_ID, diff --git a/x-pack/plugins/apm/server/lib/services/get_service_transaction_group_detailed_statistics.ts b/x-pack/plugins/apm/server/routes/services/get_service_transaction_group_detailed_statistics.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/services/get_service_transaction_group_detailed_statistics.ts rename to x-pack/plugins/apm/server/routes/services/get_service_transaction_group_detailed_statistics.ts index 35256e6a7ecd6..70f77c26fdbf9 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_transaction_group_detailed_statistics.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_transaction_group_detailed_statistics.ts @@ -22,14 +22,14 @@ import { getDocumentTypeFilterForTransactions, getTransactionDurationFieldForTransactions, getProcessorEventForTransactions, -} from '../helpers/transactions'; -import { getBucketSizeForAggregatedTransactions } from '../helpers/get_bucket_size_for_aggregated_transactions'; +} from '../../lib/helpers/transactions'; +import { getBucketSizeForAggregatedTransactions } from '../../lib/helpers/get_bucket_size_for_aggregated_transactions'; import { getLatencyAggregation, getLatencyValue, -} from '../helpers/latency_aggregation_type'; -import { Setup } from '../helpers/setup_request'; -import { calculateFailedTransactionRate } from '../helpers/transaction_error_rate'; +} from '../../lib/helpers/latency_aggregation_type'; +import { Setup } from '../../lib/helpers/setup_request'; +import { calculateFailedTransactionRate } from '../../lib/helpers/transaction_error_rate'; export async function getServiceTransactionGroupDetailedStatistics({ environment, diff --git a/x-pack/plugins/apm/server/lib/services/get_service_transaction_groups.ts b/x-pack/plugins/apm/server/routes/services/get_service_transaction_groups.ts similarity index 92% rename from x-pack/plugins/apm/server/lib/services/get_service_transaction_groups.ts rename to x-pack/plugins/apm/server/routes/services/get_service_transaction_groups.ts index 7f624693a3b9c..711d6964221bd 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_transaction_groups.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_transaction_groups.ts @@ -19,14 +19,14 @@ import { getDocumentTypeFilterForTransactions, getTransactionDurationFieldForTransactions, getProcessorEventForTransactions, -} from '../helpers/transactions'; -import { calculateThroughput } from '../helpers/calculate_throughput'; +} from '../../lib/helpers/transactions'; +import { calculateThroughput } from '../../lib/helpers/calculate_throughput'; import { getLatencyAggregation, getLatencyValue, -} from '../helpers/latency_aggregation_type'; -import { Setup } from '../helpers/setup_request'; -import { calculateFailedTransactionRate } from '../helpers/transaction_error_rate'; +} from '../../lib/helpers/latency_aggregation_type'; +import { Setup } from '../../lib/helpers/setup_request'; +import { calculateFailedTransactionRate } from '../../lib/helpers/transaction_error_rate'; export type ServiceOverviewTransactionGroupSortField = | 'name' diff --git a/x-pack/plugins/apm/server/lib/services/get_service_transaction_types.ts b/x-pack/plugins/apm/server/routes/services/get_service_transaction_types.ts similarity index 94% rename from x-pack/plugins/apm/server/lib/services/get_service_transaction_types.ts rename to x-pack/plugins/apm/server/routes/services/get_service_transaction_types.ts index 1c2d1c9207bc3..a3761df72156e 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_transaction_types.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_transaction_types.ts @@ -10,11 +10,11 @@ import { TRANSACTION_TYPE, } from '../../../common/elasticsearch_fieldnames'; import { rangeQuery } from '../../../../observability/server'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; import { getDocumentTypeFilterForTransactions, getProcessorEventForTransactions, -} from '../helpers/transactions'; +} from '../../lib/helpers/transactions'; export async function getServiceTransactionTypes({ setup, diff --git a/x-pack/plugins/apm/server/lib/services/get_services/get_health_statuses.ts b/x-pack/plugins/apm/server/routes/services/get_services/get_health_statuses.ts similarity index 92% rename from x-pack/plugins/apm/server/lib/services/get_services/get_health_statuses.ts rename to x-pack/plugins/apm/server/routes/services/get_services/get_health_statuses.ts index af6d0d9613b35..65fb04b821ffa 100644 --- a/x-pack/plugins/apm/server/lib/services/get_services/get_health_statuses.ts +++ b/x-pack/plugins/apm/server/routes/services/get_services/get_health_statuses.ts @@ -7,7 +7,7 @@ import { getSeverity } from '../../../../common/anomaly_detection'; import { getServiceHealthStatus } from '../../../../common/service_health_status'; -import { getServiceAnomalies } from '../../service_map/get_service_anomalies'; +import { getServiceAnomalies } from '../../../routes/service_map/get_service_anomalies'; import { ServicesItemsSetup } from './get_services_items'; interface AggregationParams { diff --git a/x-pack/plugins/apm/server/lib/services/get_services/get_legacy_data_status.ts b/x-pack/plugins/apm/server/routes/services/get_services/get_legacy_data_status.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/services/get_services/get_legacy_data_status.ts rename to x-pack/plugins/apm/server/routes/services/get_services/get_legacy_data_status.ts index 5b94bb2314258..7275e34786e36 100644 --- a/x-pack/plugins/apm/server/lib/services/get_services/get_legacy_data_status.ts +++ b/x-pack/plugins/apm/server/routes/services/get_services/get_legacy_data_status.ts @@ -8,7 +8,7 @@ import { rangeQuery } from '../../../../../observability/server'; import { ProcessorEvent } from '../../../../common/processor_event'; import { OBSERVER_VERSION_MAJOR } from '../../../../common/elasticsearch_fieldnames'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; // returns true if 6.x data is found export async function getLegacyDataStatus( diff --git a/x-pack/plugins/apm/server/lib/services/get_services/get_service_transaction_stats.ts b/x-pack/plugins/apm/server/routes/services/get_services/get_service_transaction_stats.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/services/get_services/get_service_transaction_stats.ts rename to x-pack/plugins/apm/server/routes/services/get_services/get_service_transaction_stats.ts index 36903f9ca229f..3eaa8053b6709 100644 --- a/x-pack/plugins/apm/server/lib/services/get_services/get_service_transaction_stats.ts +++ b/x-pack/plugins/apm/server/routes/services/get_services/get_service_transaction_stats.ts @@ -22,12 +22,12 @@ import { getDocumentTypeFilterForTransactions, getTransactionDurationFieldForTransactions, getProcessorEventForTransactions, -} from '../../helpers/transactions'; -import { calculateThroughput } from '../../helpers/calculate_throughput'; +} from '../../../lib/helpers/transactions'; +import { calculateThroughput } from '../../../lib/helpers/calculate_throughput'; import { calculateFailedTransactionRate, getOutcomeAggregation, -} from '../../helpers/transaction_error_rate'; +} from '../../../lib/helpers/transaction_error_rate'; import { ServicesItemsSetup } from './get_services_items'; interface AggregationParams { diff --git a/x-pack/plugins/apm/server/lib/services/get_services/get_services_from_metric_documents.ts b/x-pack/plugins/apm/server/routes/services/get_services/get_services_from_metric_documents.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/services/get_services/get_services_from_metric_documents.ts rename to x-pack/plugins/apm/server/routes/services/get_services/get_services_from_metric_documents.ts index cffd106d13348..055d82a807815 100644 --- a/x-pack/plugins/apm/server/lib/services/get_services/get_services_from_metric_documents.ts +++ b/x-pack/plugins/apm/server/routes/services/get_services/get_services_from_metric_documents.ts @@ -14,7 +14,7 @@ import { import { kqlQuery, rangeQuery } from '../../../../../observability/server'; import { environmentQuery } from '../../../../common/utils/environment_query'; import { ProcessorEvent } from '../../../../common/processor_event'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; export async function getServicesFromMetricDocuments({ environment, diff --git a/x-pack/plugins/apm/server/lib/services/get_services/get_services_items.ts b/x-pack/plugins/apm/server/routes/services/get_services/get_services_items.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/services/get_services/get_services_items.ts rename to x-pack/plugins/apm/server/routes/services/get_services/get_services_items.ts index 47f1f6e7e6430..db3377b6710c5 100644 --- a/x-pack/plugins/apm/server/lib/services/get_services/get_services_items.ts +++ b/x-pack/plugins/apm/server/routes/services/get_services/get_services_items.ts @@ -7,7 +7,7 @@ import { Logger } from '@kbn/logging'; import { withApmSpan } from '../../../utils/with_apm_span'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { getHealthStatuses } from './get_health_statuses'; import { getServicesFromMetricDocuments } from './get_services_from_metric_documents'; import { getServiceTransactionStats } from './get_service_transaction_stats'; diff --git a/x-pack/plugins/apm/server/lib/services/get_services/index.ts b/x-pack/plugins/apm/server/routes/services/get_services/index.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/services/get_services/index.ts rename to x-pack/plugins/apm/server/routes/services/get_services/index.ts index d6a940bc14b5f..9d1670fe84582 100644 --- a/x-pack/plugins/apm/server/lib/services/get_services/index.ts +++ b/x-pack/plugins/apm/server/routes/services/get_services/index.ts @@ -7,7 +7,7 @@ import { Logger } from '@kbn/logging'; import { withApmSpan } from '../../../utils/with_apm_span'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { getLegacyDataStatus } from './get_legacy_data_status'; import { getServicesItems } from './get_services_items'; diff --git a/x-pack/plugins/apm/server/lib/services/get_services/merge_service_stats.test.ts b/x-pack/plugins/apm/server/routes/services/get_services/merge_service_stats.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/services/get_services/merge_service_stats.test.ts rename to x-pack/plugins/apm/server/routes/services/get_services/merge_service_stats.test.ts diff --git a/x-pack/plugins/apm/server/lib/services/get_services/merge_service_stats.ts b/x-pack/plugins/apm/server/routes/services/get_services/merge_service_stats.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/services/get_services/merge_service_stats.ts rename to x-pack/plugins/apm/server/routes/services/get_services/merge_service_stats.ts 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/routes/services/get_services_detailed_statistics/get_service_transaction_detailed_statistics.ts similarity index 92% rename from x-pack/plugins/apm/server/lib/services/get_services_detailed_statistics/get_service_transaction_detailed_statistics.ts rename to x-pack/plugins/apm/server/routes/services/get_services_detailed_statistics/get_service_transaction_detailed_statistics.ts index ea153a5ddcd4c..95f2c6f400de9 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/routes/services/get_services_detailed_statistics/get_service_transaction_detailed_statistics.ts @@ -21,14 +21,14 @@ import { 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'; +} from '../../../lib/helpers/transactions'; +import { calculateThroughput } from '../../../lib/helpers/calculate_throughput'; +import { getBucketSizeForAggregatedTransactions } from '../../../lib/helpers/get_bucket_size_for_aggregated_transactions'; +import { Setup } from '../../../lib/helpers/setup_request'; import { calculateFailedTransactionRate, getOutcomeAggregation, -} from '../../helpers/transaction_error_rate'; +} from '../../../lib/helpers/transaction_error_rate'; export async function getServiceTransactionDetailedStatistics({ serviceNames, diff --git a/x-pack/plugins/apm/server/lib/services/get_services_detailed_statistics/index.ts b/x-pack/plugins/apm/server/routes/services/get_services_detailed_statistics/index.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/services/get_services_detailed_statistics/index.ts rename to x-pack/plugins/apm/server/routes/services/get_services_detailed_statistics/index.ts index e2f2ee226ab1e..228add10184ba 100644 --- a/x-pack/plugins/apm/server/lib/services/get_services_detailed_statistics/index.ts +++ b/x-pack/plugins/apm/server/routes/services/get_services_detailed_statistics/index.ts @@ -6,7 +6,7 @@ */ import { withApmSpan } from '../../../utils/with_apm_span'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { getServiceTransactionDetailedStatistics } from './get_service_transaction_detailed_statistics'; export async function getServicesDetailedStatistics({ diff --git a/x-pack/plugins/apm/server/lib/services/get_throughput.ts b/x-pack/plugins/apm/server/routes/services/get_throughput.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/services/get_throughput.ts rename to x-pack/plugins/apm/server/routes/services/get_throughput.ts index 3161066ebadf9..4a0366cc2f6ae 100644 --- a/x-pack/plugins/apm/server/lib/services/get_throughput.ts +++ b/x-pack/plugins/apm/server/routes/services/get_throughput.ts @@ -20,8 +20,8 @@ import { environmentQuery } from '../../../common/utils/environment_query'; import { getDocumentTypeFilterForTransactions, getProcessorEventForTransactions, -} from '../helpers/transactions'; -import { Setup } from '../helpers/setup_request'; +} from '../../lib/helpers/transactions'; +import { Setup } from '../../lib/helpers/setup_request'; interface Options { environment: string; diff --git a/x-pack/plugins/apm/server/lib/services/profiling/get_service_profiling_statistics.ts b/x-pack/plugins/apm/server/routes/services/profiling/get_service_profiling_statistics.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/services/profiling/get_service_profiling_statistics.ts rename to x-pack/plugins/apm/server/routes/services/profiling/get_service_profiling_statistics.ts index 0b96a6bd3d456..009d974e33721 100644 --- a/x-pack/plugins/apm/server/lib/services/profiling/get_service_profiling_statistics.ts +++ b/x-pack/plugins/apm/server/routes/services/profiling/get_service_profiling_statistics.ts @@ -23,8 +23,8 @@ import { } from '../../../../common/elasticsearch_fieldnames'; import { rangeQuery, kqlQuery } from '../../../../../observability/server'; import { environmentQuery } from '../../../../common/utils/environment_query'; -import { APMEventClient } from '../../helpers/create_es_client/create_apm_event_client'; -import { Setup } from '../../helpers/setup_request'; +import { APMEventClient } from '../../../lib/helpers/create_es_client/create_apm_event_client'; +import { Setup } from '../../../lib/helpers/setup_request'; import { withApmSpan } from '../../../utils/with_apm_span'; const MAX_STACK_IDS = 10000; diff --git a/x-pack/plugins/apm/server/lib/services/profiling/get_service_profiling_timeline.ts b/x-pack/plugins/apm/server/routes/services/profiling/get_service_profiling_timeline.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/services/profiling/get_service_profiling_timeline.ts rename to x-pack/plugins/apm/server/routes/services/profiling/get_service_profiling_timeline.ts index ce1580fc48290..47df939467d0e 100644 --- a/x-pack/plugins/apm/server/lib/services/profiling/get_service_profiling_timeline.ts +++ b/x-pack/plugins/apm/server/routes/services/profiling/get_service_profiling_timeline.ts @@ -14,8 +14,8 @@ import { getValueTypeConfig, ProfilingValueType, } from '../../../../common/profiling'; -import { Setup } from '../../helpers/setup_request'; -import { getBucketSize } from '../../helpers/get_bucket_size'; +import { Setup } from '../../../lib/helpers/setup_request'; +import { getBucketSize } from '../../../lib/helpers/get_bucket_size'; import { environmentQuery } from '../../../../common/utils/environment_query'; import { kqlQuery, rangeQuery } from '../../../../../observability/server'; diff --git a/x-pack/plugins/apm/server/lib/services/queries.test.ts b/x-pack/plugins/apm/server/routes/services/queries.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/services/queries.test.ts rename to x-pack/plugins/apm/server/routes/services/queries.test.ts diff --git a/x-pack/plugins/apm/server/routes/services.ts b/x-pack/plugins/apm/server/routes/services/route.ts similarity index 89% rename from x-pack/plugins/apm/server/routes/services.ts rename to x-pack/plugins/apm/server/routes/services/route.ts index cb557f56d8165..d395be4c6adce 100644 --- a/x-pack/plugins/apm/server/routes/services.ts +++ b/x-pack/plugins/apm/server/routes/services/route.ts @@ -11,42 +11,42 @@ import { isoToEpochRt } from '@kbn/io-ts-utils/iso_to_epoch_rt'; import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt'; 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/transactions'; -import { setupRequest } from '../lib/helpers/setup_request'; -import { getServiceAnnotations } from '../lib/services/annotations'; -import { getServices } from '../lib/services/get_services'; -import { getServiceAgent } from '../lib/services/get_service_agent'; -import { getServiceAlerts } from '../lib/services/get_service_alerts'; -import { getServiceDependencies } from '../lib/services/get_service_dependencies'; -import { getServiceInstanceMetadataDetails } from '../lib/services/get_service_instance_metadata_details'; -import { getServiceErrorGroupPeriods } from '../lib/services/get_service_error_groups/get_service_error_group_detailed_statistics'; -import { getServiceErrorGroupMainStatistics } from '../lib/services/get_service_error_groups/get_service_error_group_main_statistics'; -import { getServiceInstancesDetailedStatisticsPeriods } from '../lib/services/get_service_instances/detailed_statistics'; -import { getServiceInstancesMainStatistics } from '../lib/services/get_service_instances/main_statistics'; -import { getServiceMetadataDetails } from '../lib/services/get_service_metadata_details'; -import { getServiceMetadataIcons } from '../lib/services/get_service_metadata_icons'; -import { getServiceNodeMetadata } from '../lib/services/get_service_node_metadata'; -import { getServiceTransactionTypes } from '../lib/services/get_service_transaction_types'; -import { getThroughput } from '../lib/services/get_throughput'; -import { getServiceProfilingStatistics } from '../lib/services/profiling/get_service_profiling_statistics'; -import { getServiceProfilingTimeline } from '../lib/services/profiling/get_service_profiling_timeline'; -import { getServiceInfrastructure } from '../lib/services/get_service_infrastructure'; -import { withApmSpan } from '../utils/with_apm_span'; -import { createApmServerRoute } from './apm_routes/create_apm_server_route'; -import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; +import { latencyAggregationTypeRt } from '../../../common/latency_aggregation_types'; +import { ProfilingValueType } from '../../../common/profiling'; +import { getSearchAggregatedTransactions } from '../../lib/helpers/transactions'; +import { setupRequest } from '../../lib/helpers/setup_request'; +import { getServiceAnnotations } from './annotations'; +import { getServices } from './get_services'; +import { getServiceAgent } from './get_service_agent'; +import { getServiceAlerts } from './get_service_alerts'; +import { getServiceDependencies } from './get_service_dependencies'; +import { getServiceInstanceMetadataDetails } from './get_service_instance_metadata_details'; +import { getServiceErrorGroupPeriods } from './get_service_error_groups/get_service_error_group_detailed_statistics'; +import { getServiceErrorGroupMainStatistics } from './get_service_error_groups/get_service_error_group_main_statistics'; +import { getServiceInstancesDetailedStatisticsPeriods } from './get_service_instances/detailed_statistics'; +import { getServiceInstancesMainStatistics } from './get_service_instances/main_statistics'; +import { getServiceMetadataDetails } from './get_service_metadata_details'; +import { getServiceMetadataIcons } from './get_service_metadata_icons'; +import { getServiceNodeMetadata } from './get_service_node_metadata'; +import { getServiceTransactionTypes } from './get_service_transaction_types'; +import { getThroughput } from './get_throughput'; +import { getServiceProfilingStatistics } from './profiling/get_service_profiling_statistics'; +import { getServiceProfilingTimeline } from './profiling/get_service_profiling_timeline'; +import { getServiceInfrastructure } from './get_service_infrastructure'; +import { withApmSpan } from '../../utils/with_apm_span'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; import { comparisonRangeRt, environmentRt, kueryRt, offsetRt, rangeRt, -} from './default_api_types'; -import { offsetPreviousPeriodCoordinates } from '../../common/utils/offset_previous_period_coordinate'; -import { getServicesDetailedStatistics } from '../lib/services/get_services_detailed_statistics'; -import { getServiceDependenciesBreakdown } from '../lib/services/get_service_dependencies_breakdown'; -import { getBucketSizeForAggregatedTransactions } from '../lib/helpers/get_bucket_size_for_aggregated_transactions'; +} from '../default_api_types'; +import { offsetPreviousPeriodCoordinates } from '../../../common/utils/offset_previous_period_coordinate'; +import { getServicesDetailedStatistics } from './get_services_detailed_statistics'; +import { getServiceDependenciesBreakdown } from './get_service_dependencies_breakdown'; +import { getBucketSizeForAggregatedTransactions } from '../../lib/helpers/get_bucket_size_for_aggregated_transactions'; const servicesRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/services', diff --git a/x-pack/plugins/apm/server/lib/settings/agent_configuration/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/routes/settings/agent_configuration/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/plugins/apm/server/lib/settings/agent_configuration/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/routes/settings/agent_configuration/__snapshots__/queries.test.ts.snap diff --git a/x-pack/plugins/apm/server/lib/settings/agent_configuration/convert_settings_to_string.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration/convert_settings_to_string.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/settings/agent_configuration/convert_settings_to_string.ts rename to x-pack/plugins/apm/server/routes/settings/agent_configuration/convert_settings_to_string.ts diff --git a/x-pack/plugins/apm/server/lib/settings/agent_configuration/create_agent_config_index.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration/create_agent_config_index.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/settings/agent_configuration/create_agent_config_index.ts rename to x-pack/plugins/apm/server/routes/settings/agent_configuration/create_agent_config_index.ts diff --git a/x-pack/plugins/apm/server/lib/settings/agent_configuration/create_or_update_configuration.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration/create_or_update_configuration.ts similarity index 89% rename from x-pack/plugins/apm/server/lib/settings/agent_configuration/create_or_update_configuration.ts rename to x-pack/plugins/apm/server/routes/settings/agent_configuration/create_or_update_configuration.ts index c112c3be3362b..07a9f79829306 100644 --- a/x-pack/plugins/apm/server/lib/settings/agent_configuration/create_or_update_configuration.ts +++ b/x-pack/plugins/apm/server/routes/settings/agent_configuration/create_or_update_configuration.ts @@ -6,12 +6,12 @@ */ import hash from 'object-hash'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { AgentConfiguration, AgentConfigurationIntake, } from '../../../../common/agent_configuration/configuration_types'; -import { APMIndexDocumentParams } from '../../helpers/create_es_client/create_internal_es_client'; +import { APMIndexDocumentParams } from '../../../lib/helpers/create_es_client/create_internal_es_client'; export function createOrUpdateConfiguration({ configurationId, diff --git a/x-pack/plugins/apm/server/lib/settings/agent_configuration/delete_configuration.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration/delete_configuration.ts similarity index 91% rename from x-pack/plugins/apm/server/lib/settings/agent_configuration/delete_configuration.ts rename to x-pack/plugins/apm/server/routes/settings/agent_configuration/delete_configuration.ts index 125c97730a6fa..5ac8437b15786 100644 --- a/x-pack/plugins/apm/server/lib/settings/agent_configuration/delete_configuration.ts +++ b/x-pack/plugins/apm/server/routes/settings/agent_configuration/delete_configuration.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; export async function deleteConfiguration({ configurationId, diff --git a/x-pack/plugins/apm/server/lib/settings/agent_configuration/find_exact_configuration.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration/find_exact_configuration.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/settings/agent_configuration/find_exact_configuration.ts rename to x-pack/plugins/apm/server/routes/settings/agent_configuration/find_exact_configuration.ts index 90f82442f9bfa..ac95f36107994 100644 --- a/x-pack/plugins/apm/server/lib/settings/agent_configuration/find_exact_configuration.ts +++ b/x-pack/plugins/apm/server/routes/settings/agent_configuration/find_exact_configuration.ts @@ -11,7 +11,7 @@ import { SERVICE_ENVIRONMENT, SERVICE_NAME, } from '../../../../common/elasticsearch_fieldnames'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { convertConfigSettingsToString } from './convert_settings_to_string'; export async function findExactConfiguration({ diff --git a/x-pack/plugins/apm/server/lib/settings/agent_configuration/get_agent_name_by_service.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration/get_agent_name_by_service.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/settings/agent_configuration/get_agent_name_by_service.ts rename to x-pack/plugins/apm/server/routes/settings/agent_configuration/get_agent_name_by_service.ts index 6ea3e2a578050..d16af2d95d22a 100644 --- a/x-pack/plugins/apm/server/lib/settings/agent_configuration/get_agent_name_by_service.ts +++ b/x-pack/plugins/apm/server/routes/settings/agent_configuration/get_agent_name_by_service.ts @@ -6,7 +6,7 @@ */ import { ProcessorEvent } from '../../../../common/processor_event'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { SERVICE_NAME } from '../../../../common/elasticsearch_fieldnames'; import { AGENT_NAME } from '../../../../common/elasticsearch_fieldnames'; diff --git a/x-pack/plugins/apm/server/lib/settings/agent_configuration/get_environments/get_existing_environments_for_service.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration/get_environments/get_existing_environments_for_service.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/settings/agent_configuration/get_environments/get_existing_environments_for_service.ts rename to x-pack/plugins/apm/server/routes/settings/agent_configuration/get_environments/get_existing_environments_for_service.ts index 4fd351f8708a2..a3925c060a1c5 100644 --- a/x-pack/plugins/apm/server/lib/settings/agent_configuration/get_environments/get_existing_environments_for_service.ts +++ b/x-pack/plugins/apm/server/routes/settings/agent_configuration/get_environments/get_existing_environments_for_service.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Setup } from '../../../helpers/setup_request'; +import { Setup } from '../../../../lib/helpers/setup_request'; import { SERVICE_NAME, SERVICE_ENVIRONMENT, diff --git a/x-pack/plugins/apm/server/lib/settings/agent_configuration/get_environments/index.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration/get_environments/index.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/settings/agent_configuration/get_environments/index.ts rename to x-pack/plugins/apm/server/routes/settings/agent_configuration/get_environments/index.ts index a22c1d35dc663..46ab82152caad 100644 --- a/x-pack/plugins/apm/server/lib/settings/agent_configuration/get_environments/index.ts +++ b/x-pack/plugins/apm/server/routes/settings/agent_configuration/get_environments/index.ts @@ -7,7 +7,7 @@ import { withApmSpan } from '../../../../utils/with_apm_span'; import { getAllEnvironments } from '../../../environments/get_all_environments'; -import { Setup } from '../../../helpers/setup_request'; +import { Setup } from '../../../../lib/helpers/setup_request'; import { getExistingEnvironmentsForService } from './get_existing_environments_for_service'; import { ALL_OPTION_VALUE } from '../../../../../common/agent_configuration/all_option'; diff --git a/x-pack/plugins/apm/server/lib/settings/agent_configuration/get_service_names.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration/get_service_names.ts similarity index 90% rename from x-pack/plugins/apm/server/lib/settings/agent_configuration/get_service_names.ts rename to x-pack/plugins/apm/server/routes/settings/agent_configuration/get_service_names.ts index fc5167159b98d..18e359c5b9425 100644 --- a/x-pack/plugins/apm/server/lib/settings/agent_configuration/get_service_names.ts +++ b/x-pack/plugins/apm/server/routes/settings/agent_configuration/get_service_names.ts @@ -6,10 +6,10 @@ */ import { ProcessorEvent } from '../../../../common/processor_event'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { SERVICE_NAME } from '../../../../common/elasticsearch_fieldnames'; import { ALL_OPTION_VALUE } from '../../../../common/agent_configuration/all_option'; -import { getProcessorEventForTransactions } from '../../helpers/transactions'; +import { getProcessorEventForTransactions } from '../../../lib/helpers/transactions'; export async function getServiceNames({ setup, diff --git a/x-pack/plugins/apm/server/lib/settings/agent_configuration/list_configurations.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration/list_configurations.ts similarity index 93% rename from x-pack/plugins/apm/server/lib/settings/agent_configuration/list_configurations.ts rename to x-pack/plugins/apm/server/routes/settings/agent_configuration/list_configurations.ts index 098888c23ccbc..bc105106cb5e4 100644 --- a/x-pack/plugins/apm/server/lib/settings/agent_configuration/list_configurations.ts +++ b/x-pack/plugins/apm/server/routes/settings/agent_configuration/list_configurations.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { AgentConfiguration } from '../../../../common/agent_configuration/configuration_types'; import { convertConfigSettingsToString } from './convert_settings_to_string'; diff --git a/x-pack/plugins/apm/server/lib/settings/agent_configuration/mark_applied_by_agent.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration/mark_applied_by_agent.ts similarity index 93% rename from x-pack/plugins/apm/server/lib/settings/agent_configuration/mark_applied_by_agent.ts rename to x-pack/plugins/apm/server/routes/settings/agent_configuration/mark_applied_by_agent.ts index 5fa4993921570..78e0ce68624a6 100644 --- a/x-pack/plugins/apm/server/lib/settings/agent_configuration/mark_applied_by_agent.ts +++ b/x-pack/plugins/apm/server/routes/settings/agent_configuration/mark_applied_by_agent.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { AgentConfiguration } from '../../../../common/agent_configuration/configuration_types'; // We're not wrapping this function with a span as it is not blocking the request diff --git a/x-pack/plugins/apm/server/lib/settings/agent_configuration/queries.test.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration/queries.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/settings/agent_configuration/queries.test.ts rename to x-pack/plugins/apm/server/routes/settings/agent_configuration/queries.test.ts diff --git a/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration/route.ts similarity index 86% rename from x-pack/plugins/apm/server/routes/settings/agent_configuration.ts rename to x-pack/plugins/apm/server/routes/settings/agent_configuration/route.ts index 563fa40c6c0d9..1122c2095ed3d 100644 --- a/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts +++ b/x-pack/plugins/apm/server/routes/settings/agent_configuration/route.ts @@ -8,25 +8,25 @@ import * as t from 'io-ts'; import Boom from '@hapi/boom'; import { toBooleanRt } from '@kbn/io-ts-utils/to_boolean_rt'; -import { maxSuggestions } from '../../../../observability/common'; -import { setupRequest } from '../../lib/helpers/setup_request'; -import { getServiceNames } from '../../lib/settings/agent_configuration/get_service_names'; -import { createOrUpdateConfiguration } from '../../lib/settings/agent_configuration/create_or_update_configuration'; -import { searchConfigurations } from '../../lib/settings/agent_configuration/search_configurations'; -import { findExactConfiguration } from '../../lib/settings/agent_configuration/find_exact_configuration'; -import { listConfigurations } from '../../lib/settings/agent_configuration/list_configurations'; -import { getEnvironments } from '../../lib/settings/agent_configuration/get_environments'; -import { deleteConfiguration } from '../../lib/settings/agent_configuration/delete_configuration'; -import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; -import { getAgentNameByService } from '../../lib/settings/agent_configuration/get_agent_name_by_service'; -import { markAppliedByAgent } from '../../lib/settings/agent_configuration/mark_applied_by_agent'; +import { maxSuggestions } from '../../../../../observability/common'; +import { setupRequest } from '../../../lib/helpers/setup_request'; +import { getServiceNames } from './get_service_names'; +import { createOrUpdateConfiguration } from './create_or_update_configuration'; +import { searchConfigurations } from './search_configurations'; +import { findExactConfiguration } from './find_exact_configuration'; +import { listConfigurations } from './list_configurations'; +import { getEnvironments } from './get_environments'; +import { deleteConfiguration } from './delete_configuration'; +import { createApmServerRoute } from '../../apm_routes/create_apm_server_route'; +import { getAgentNameByService } from './get_agent_name_by_service'; +import { markAppliedByAgent } from './mark_applied_by_agent'; import { serviceRt, agentConfigurationIntakeRt, -} from '../../../common/agent_configuration/runtime_types/agent_configuration_intake_rt'; -import { getSearchAggregatedTransactions } from '../../lib/helpers/transactions'; -import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; -import { syncAgentConfigsToApmPackagePolicies } from '../../lib/fleet/sync_agent_configs_to_apm_package_policies'; +} from '../../../../common/agent_configuration/runtime_types/agent_configuration_intake_rt'; +import { getSearchAggregatedTransactions } from '../../../lib/helpers/transactions'; +import { createApmServerRouteRepository } from '../../apm_routes/create_apm_server_route_repository'; +import { syncAgentConfigsToApmPackagePolicies } from '../../fleet/sync_agent_configs_to_apm_package_policies'; // get list of configurations const agentConfigurationRoute = createApmServerRoute({ diff --git a/x-pack/plugins/apm/server/lib/settings/agent_configuration/search_configurations.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration/search_configurations.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/settings/agent_configuration/search_configurations.ts rename to x-pack/plugins/apm/server/routes/settings/agent_configuration/search_configurations.ts index 1e37ae9108573..194e1eff4e657 100644 --- a/x-pack/plugins/apm/server/lib/settings/agent_configuration/search_configurations.ts +++ b/x-pack/plugins/apm/server/routes/settings/agent_configuration/search_configurations.ts @@ -10,7 +10,7 @@ import { SERVICE_NAME, SERVICE_ENVIRONMENT, } from '../../../../common/elasticsearch_fieldnames'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { AgentConfiguration } from '../../../../common/agent_configuration/configuration_types'; import { convertConfigSettingsToString } from './convert_settings_to_string'; diff --git a/x-pack/plugins/apm/server/routes/settings/anomaly_detection.ts b/x-pack/plugins/apm/server/routes/settings/anomaly_detection/route.ts similarity index 74% rename from x-pack/plugins/apm/server/routes/settings/anomaly_detection.ts rename to x-pack/plugins/apm/server/routes/settings/anomaly_detection/route.ts index e8b2ef5e119cd..a924a9214977d 100644 --- a/x-pack/plugins/apm/server/routes/settings/anomaly_detection.ts +++ b/x-pack/plugins/apm/server/routes/settings/anomaly_detection/route.ts @@ -7,19 +7,19 @@ import * as t from 'io-ts'; import Boom from '@hapi/boom'; -import { maxSuggestions } from '../../../../observability/common'; -import { isActivePlatinumLicense } from '../../../common/license_check'; -import { ML_ERRORS } from '../../../common/anomaly_detection'; -import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; -import { getAnomalyDetectionJobs } from '../../lib/anomaly_detection/get_anomaly_detection_jobs'; -import { createAnomalyDetectionJobs } from '../../lib/anomaly_detection/create_anomaly_detection_jobs'; -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/transactions'; -import { notifyFeatureUsage } from '../../feature'; -import { withApmSpan } from '../../utils/with_apm_span'; -import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; +import { maxSuggestions } from '../../../../../observability/common'; +import { isActivePlatinumLicense } from '../../../../common/license_check'; +import { ML_ERRORS } from '../../../../common/anomaly_detection'; +import { createApmServerRoute } from '../../apm_routes/create_apm_server_route'; +import { getAnomalyDetectionJobs } from '../../../lib/anomaly_detection/get_anomaly_detection_jobs'; +import { createAnomalyDetectionJobs } from '../../../lib/anomaly_detection/create_anomaly_detection_jobs'; +import { setupRequest } from '../../../lib/helpers/setup_request'; +import { getAllEnvironments } from '../../environments/get_all_environments'; +import { hasLegacyJobs } from '../../../lib/anomaly_detection/has_legacy_jobs'; +import { getSearchAggregatedTransactions } from '../../../lib/helpers/transactions'; +import { notifyFeatureUsage } from '../../../feature'; +import { withApmSpan } from '../../../utils/with_apm_span'; +import { createApmServerRouteRepository } from '../../apm_routes/create_apm_server_route_repository'; // get ML anomaly detection jobs for each environment const anomalyDetectionJobsRoute = createApmServerRoute({ diff --git a/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts b/x-pack/plugins/apm/server/routes/settings/apm_indices/get_apm_indices.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts rename to x-pack/plugins/apm/server/routes/settings/apm_indices/get_apm_indices.ts index a37720cbc3790..6b917919bade5 100644 --- a/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts +++ b/x-pack/plugins/apm/server/routes/settings/apm_indices/get_apm_indices.ts @@ -12,7 +12,7 @@ import { APM_INDICES_SAVED_OBJECT_ID, } from '../../../../common/apm_saved_object_constants'; import { APMConfig } from '../../..'; -import { APMRouteHandlerResources } from '../../../routes/typings'; +import { APMRouteHandlerResources } from '../../typings'; import { withApmSpan } from '../../../utils/with_apm_span'; import { ApmIndicesConfig } from '../../../../../observability/common/typings'; diff --git a/x-pack/plugins/apm/server/routes/settings/apm_indices.ts b/x-pack/plugins/apm/server/routes/settings/apm_indices/route.ts similarity index 82% rename from x-pack/plugins/apm/server/routes/settings/apm_indices.ts rename to x-pack/plugins/apm/server/routes/settings/apm_indices/route.ts index ed99f0c8862f0..485ff8af88843 100644 --- a/x-pack/plugins/apm/server/routes/settings/apm_indices.ts +++ b/x-pack/plugins/apm/server/routes/settings/apm_indices/route.ts @@ -6,14 +6,11 @@ */ import * as t from 'io-ts'; -import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; -import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; -import { - getApmIndices, - getApmIndexSettings, -} from '../../lib/settings/apm_indices/get_apm_indices'; -import { saveApmIndices } from '../../lib/settings/apm_indices/save_apm_indices'; -import { APMConfig } from '../..'; +import { createApmServerRouteRepository } from '../../apm_routes/create_apm_server_route_repository'; +import { createApmServerRoute } from '../../apm_routes/create_apm_server_route'; +import { getApmIndices, getApmIndexSettings } from './get_apm_indices'; +import { saveApmIndices } from './save_apm_indices'; +import { APMConfig } from '../../../'; // get list of apm indices and values const apmIndexSettingsRoute = createApmServerRoute({ diff --git a/x-pack/plugins/apm/server/lib/settings/apm_indices/save_apm_indices.test.ts b/x-pack/plugins/apm/server/routes/settings/apm_indices/save_apm_indices.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/settings/apm_indices/save_apm_indices.test.ts rename to x-pack/plugins/apm/server/routes/settings/apm_indices/save_apm_indices.test.ts diff --git a/x-pack/plugins/apm/server/lib/settings/apm_indices/save_apm_indices.ts b/x-pack/plugins/apm/server/routes/settings/apm_indices/save_apm_indices.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/settings/apm_indices/save_apm_indices.ts rename to x-pack/plugins/apm/server/routes/settings/apm_indices/save_apm_indices.ts diff --git a/x-pack/plugins/apm/server/lib/settings/custom_link/__snapshots__/get_transaction.test.ts.snap b/x-pack/plugins/apm/server/routes/settings/custom_link/__snapshots__/get_transaction.test.ts.snap similarity index 100% rename from x-pack/plugins/apm/server/lib/settings/custom_link/__snapshots__/get_transaction.test.ts.snap rename to x-pack/plugins/apm/server/routes/settings/custom_link/__snapshots__/get_transaction.test.ts.snap diff --git a/x-pack/plugins/apm/server/lib/settings/custom_link/__snapshots__/list_custom_links.test.ts.snap b/x-pack/plugins/apm/server/routes/settings/custom_link/__snapshots__/list_custom_links.test.ts.snap similarity index 100% rename from x-pack/plugins/apm/server/lib/settings/custom_link/__snapshots__/list_custom_links.test.ts.snap rename to x-pack/plugins/apm/server/routes/settings/custom_link/__snapshots__/list_custom_links.test.ts.snap diff --git a/x-pack/plugins/apm/server/lib/settings/custom_link/create_custom_link_index.ts b/x-pack/plugins/apm/server/routes/settings/custom_link/create_custom_link_index.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/settings/custom_link/create_custom_link_index.ts rename to x-pack/plugins/apm/server/routes/settings/custom_link/create_custom_link_index.ts diff --git a/x-pack/plugins/apm/server/lib/settings/custom_link/create_or_update_custom_link.test.ts b/x-pack/plugins/apm/server/routes/settings/custom_link/create_or_update_custom_link.test.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/settings/custom_link/create_or_update_custom_link.test.ts rename to x-pack/plugins/apm/server/routes/settings/custom_link/create_or_update_custom_link.test.ts index 1cec38ad4af69..7690210ac0123 100644 --- a/x-pack/plugins/apm/server/lib/settings/custom_link/create_or_update_custom_link.test.ts +++ b/x-pack/plugins/apm/server/routes/settings/custom_link/create_or_update_custom_link.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { mockNow } from '../../../utils/test_helpers'; import { CustomLink } from '../../../../common/custom_link/custom_link_types'; import { createOrUpdateCustomLink } from './create_or_update_custom_link'; diff --git a/x-pack/plugins/apm/server/lib/settings/custom_link/create_or_update_custom_link.ts b/x-pack/plugins/apm/server/routes/settings/custom_link/create_or_update_custom_link.ts similarity index 86% rename from x-pack/plugins/apm/server/lib/settings/custom_link/create_or_update_custom_link.ts rename to x-pack/plugins/apm/server/routes/settings/custom_link/create_or_update_custom_link.ts index 8f14e87fe183b..6431390936763 100644 --- a/x-pack/plugins/apm/server/lib/settings/custom_link/create_or_update_custom_link.ts +++ b/x-pack/plugins/apm/server/routes/settings/custom_link/create_or_update_custom_link.ts @@ -9,9 +9,9 @@ import { CustomLink, CustomLinkES, } from '../../../../common/custom_link/custom_link_types'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { toESFormat } from './helper'; -import { APMIndexDocumentParams } from '../../helpers/create_es_client/create_internal_es_client'; +import { APMIndexDocumentParams } from '../../../lib/helpers/create_es_client/create_internal_es_client'; export function createOrUpdateCustomLink({ customLinkId, diff --git a/x-pack/plugins/apm/server/lib/settings/custom_link/custom_link_types.ts b/x-pack/plugins/apm/server/routes/settings/custom_link/custom_link_types.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/settings/custom_link/custom_link_types.ts rename to x-pack/plugins/apm/server/routes/settings/custom_link/custom_link_types.ts diff --git a/x-pack/plugins/apm/server/lib/settings/custom_link/delete_custom_link.ts b/x-pack/plugins/apm/server/routes/settings/custom_link/delete_custom_link.ts similarity index 90% rename from x-pack/plugins/apm/server/lib/settings/custom_link/delete_custom_link.ts rename to x-pack/plugins/apm/server/routes/settings/custom_link/delete_custom_link.ts index bf7cfb33d87ac..6366bbcfd9f07 100644 --- a/x-pack/plugins/apm/server/lib/settings/custom_link/delete_custom_link.ts +++ b/x-pack/plugins/apm/server/routes/settings/custom_link/delete_custom_link.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; export function deleteCustomLink({ customLinkId, diff --git a/x-pack/plugins/apm/server/lib/settings/custom_link/get_transaction.test.ts b/x-pack/plugins/apm/server/routes/settings/custom_link/get_transaction.test.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/settings/custom_link/get_transaction.test.ts rename to x-pack/plugins/apm/server/routes/settings/custom_link/get_transaction.test.ts index 03d0120b0043b..e6ba932ca58d6 100644 --- a/x-pack/plugins/apm/server/lib/settings/custom_link/get_transaction.test.ts +++ b/x-pack/plugins/apm/server/routes/settings/custom_link/get_transaction.test.ts @@ -10,7 +10,7 @@ import { SearchParamsMock, } from '../../../utils/test_helpers'; import { getTransaction } from './get_transaction'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { SERVICE_NAME, TRANSACTION_TYPE, diff --git a/x-pack/plugins/apm/server/lib/settings/custom_link/get_transaction.ts b/x-pack/plugins/apm/server/routes/settings/custom_link/get_transaction.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/settings/custom_link/get_transaction.ts rename to x-pack/plugins/apm/server/routes/settings/custom_link/get_transaction.ts index 1c3d1465527ba..88d2ae9f339ac 100644 --- a/x-pack/plugins/apm/server/lib/settings/custom_link/get_transaction.ts +++ b/x-pack/plugins/apm/server/routes/settings/custom_link/get_transaction.ts @@ -7,7 +7,7 @@ import * as t from 'io-ts'; import { compact } from 'lodash'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { ProcessorEvent } from '../../../../common/processor_event'; import { filterOptionsRt } from './custom_link_types'; import { splitFilterValueByComma } from './helper'; diff --git a/x-pack/plugins/apm/server/lib/settings/custom_link/helper.test.ts b/x-pack/plugins/apm/server/routes/settings/custom_link/helper.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/settings/custom_link/helper.test.ts rename to x-pack/plugins/apm/server/routes/settings/custom_link/helper.test.ts diff --git a/x-pack/plugins/apm/server/lib/settings/custom_link/helper.ts b/x-pack/plugins/apm/server/routes/settings/custom_link/helper.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/settings/custom_link/helper.ts rename to x-pack/plugins/apm/server/routes/settings/custom_link/helper.ts diff --git a/x-pack/plugins/apm/server/lib/settings/custom_link/list_custom_links.test.ts b/x-pack/plugins/apm/server/routes/settings/custom_link/list_custom_links.test.ts similarity index 94% rename from x-pack/plugins/apm/server/lib/settings/custom_link/list_custom_links.test.ts rename to x-pack/plugins/apm/server/routes/settings/custom_link/list_custom_links.test.ts index 844f886c21a46..8ea4061e46cf2 100644 --- a/x-pack/plugins/apm/server/lib/settings/custom_link/list_custom_links.test.ts +++ b/x-pack/plugins/apm/server/routes/settings/custom_link/list_custom_links.test.ts @@ -10,7 +10,7 @@ import { inspectSearchParams, SearchParamsMock, } from '../../../utils/test_helpers'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { SERVICE_NAME, TRANSACTION_NAME, diff --git a/x-pack/plugins/apm/server/lib/settings/custom_link/list_custom_links.ts b/x-pack/plugins/apm/server/routes/settings/custom_link/list_custom_links.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/settings/custom_link/list_custom_links.ts rename to x-pack/plugins/apm/server/routes/settings/custom_link/list_custom_links.ts index 633545e16acfd..a64d958dabd09 100644 --- a/x-pack/plugins/apm/server/lib/settings/custom_link/list_custom_links.ts +++ b/x-pack/plugins/apm/server/routes/settings/custom_link/list_custom_links.ts @@ -11,7 +11,7 @@ import { CustomLink, CustomLinkES, } from '../../../../common/custom_link/custom_link_types'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { fromESFormat } from './helper'; import { filterOptionsRt } from './custom_link_types'; diff --git a/x-pack/plugins/apm/server/routes/settings/custom_link.ts b/x-pack/plugins/apm/server/routes/settings/custom_link/route.ts similarity index 79% rename from x-pack/plugins/apm/server/routes/settings/custom_link.ts rename to x-pack/plugins/apm/server/routes/settings/custom_link/route.ts index 044b56c3c273d..42232581f1af3 100644 --- a/x-pack/plugins/apm/server/routes/settings/custom_link.ts +++ b/x-pack/plugins/apm/server/routes/settings/custom_link/route.ts @@ -8,21 +8,18 @@ import Boom from '@hapi/boom'; import * as t from 'io-ts'; import { pick } from 'lodash'; -import { isActiveGoldLicense } from '../../../common/license_check'; -import { INVALID_LICENSE } from '../../../common/custom_link'; -import { FILTER_OPTIONS } from '../../../common/custom_link/custom_link_filter_options'; -import { notifyFeatureUsage } from '../../feature'; -import { setupRequest } from '../../lib/helpers/setup_request'; -import { createOrUpdateCustomLink } from '../../lib/settings/custom_link/create_or_update_custom_link'; -import { - filterOptionsRt, - payloadRt, -} from '../../lib/settings/custom_link/custom_link_types'; -import { deleteCustomLink } from '../../lib/settings/custom_link/delete_custom_link'; -import { getTransaction } from '../../lib/settings/custom_link/get_transaction'; -import { listCustomLinks } from '../../lib/settings/custom_link/list_custom_links'; -import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; -import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; +import { isActiveGoldLicense } from '../../../../common/license_check'; +import { INVALID_LICENSE } from '../../../../common/custom_link'; +import { FILTER_OPTIONS } from '../../../../common/custom_link/custom_link_filter_options'; +import { notifyFeatureUsage } from '../../../feature'; +import { setupRequest } from '../../../lib/helpers/setup_request'; +import { createOrUpdateCustomLink } from './create_or_update_custom_link'; +import { filterOptionsRt, payloadRt } from './custom_link_types'; +import { deleteCustomLink } from './delete_custom_link'; +import { getTransaction } from './get_transaction'; +import { listCustomLinks } from './list_custom_links'; +import { createApmServerRoute } from '../../apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from '../../apm_routes/create_apm_server_route_repository'; const customLinkTransactionRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/settings/custom_links/transaction', diff --git a/x-pack/plugins/apm/server/routes/source_maps.ts b/x-pack/plugins/apm/server/routes/source_maps/route.ts similarity index 91% rename from x-pack/plugins/apm/server/routes/source_maps.ts rename to x-pack/plugins/apm/server/routes/source_maps/route.ts index 602a3a725eac4..b0b7eb5134fcf 100644 --- a/x-pack/plugins/apm/server/routes/source_maps.ts +++ b/x-pack/plugins/apm/server/routes/source_maps/route.ts @@ -14,11 +14,11 @@ import { listArtifacts, updateSourceMapsOnFleetPolicies, getCleanedBundleFilePath, -} from '../lib/fleet/source_maps'; -import { getInternalSavedObjectsClient } from '../lib/helpers/get_internal_saved_objects_client'; -import { createApmServerRoute } from './apm_routes/create_apm_server_route'; -import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; -import { stringFromBufferRt } from '../utils/string_from_buffer_rt'; +} from '../fleet/source_maps'; +import { getInternalSavedObjectsClient } from '../../lib/helpers/get_internal_saved_objects_client'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; +import { stringFromBufferRt } from '../../utils/string_from_buffer_rt'; export const sourceMapRt = t.intersection([ t.type({ diff --git a/x-pack/plugins/apm/server/lib/suggestions/get_suggestions.ts b/x-pack/plugins/apm/server/routes/suggestions/get_suggestions.ts similarity index 87% rename from x-pack/plugins/apm/server/lib/suggestions/get_suggestions.ts rename to x-pack/plugins/apm/server/routes/suggestions/get_suggestions.ts index 5ea28debc4437..624bf2bb4c018 100644 --- a/x-pack/plugins/apm/server/lib/suggestions/get_suggestions.ts +++ b/x-pack/plugins/apm/server/routes/suggestions/get_suggestions.ts @@ -6,8 +6,8 @@ */ import { ProcessorEvent } from '../../../common/processor_event'; -import { getProcessorEventForTransactions } from '../helpers/transactions'; -import { Setup } from '../helpers/setup_request'; +import { getProcessorEventForTransactions } from '../../lib/helpers/transactions'; +import { Setup } from '../../lib/helpers/setup_request'; export async function getSuggestions({ field, diff --git a/x-pack/plugins/apm/server/routes/suggestions.ts b/x-pack/plugins/apm/server/routes/suggestions/route.ts similarity index 72% rename from x-pack/plugins/apm/server/routes/suggestions.ts rename to x-pack/plugins/apm/server/routes/suggestions/route.ts index 9b8952d09d162..de3636c2c1502 100644 --- a/x-pack/plugins/apm/server/routes/suggestions.ts +++ b/x-pack/plugins/apm/server/routes/suggestions/route.ts @@ -6,12 +6,12 @@ */ import * as t from 'io-ts'; -import { maxSuggestions } from '../../../observability/common'; -import { getSuggestions } from '../lib/suggestions/get_suggestions'; -import { getSearchAggregatedTransactions } from '../lib/helpers/transactions'; -import { setupRequest } from '../lib/helpers/setup_request'; -import { createApmServerRoute } from './apm_routes/create_apm_server_route'; -import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; +import { maxSuggestions } from '../../../../observability/common'; +import { getSuggestions } from '../suggestions/get_suggestions'; +import { getSearchAggregatedTransactions } from '../../lib/helpers/transactions'; +import { setupRequest } from '../../lib/helpers/setup_request'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; const suggestionsRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/suggestions', diff --git a/x-pack/plugins/apm/server/lib/traces/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/routes/traces/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/plugins/apm/server/lib/traces/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/routes/traces/__snapshots__/queries.test.ts.snap diff --git a/x-pack/plugins/apm/server/lib/traces/get_trace_items.ts b/x-pack/plugins/apm/server/routes/traces/get_trace_items.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/traces/get_trace_items.ts rename to x-pack/plugins/apm/server/routes/traces/get_trace_items.ts index 55204786b8e67..419c3e44d68a6 100644 --- a/x-pack/plugins/apm/server/lib/traces/get_trace_items.ts +++ b/x-pack/plugins/apm/server/routes/traces/get_trace_items.ts @@ -15,7 +15,7 @@ import { ERROR_LOG_LEVEL, } from '../../../common/elasticsearch_fieldnames'; import { rangeQuery } from '../../../../observability/server'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; export async function getTraceItems( traceId: string, diff --git a/x-pack/plugins/apm/server/lib/traces/queries.test.ts b/x-pack/plugins/apm/server/routes/traces/queries.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/traces/queries.test.ts rename to x-pack/plugins/apm/server/routes/traces/queries.test.ts diff --git a/x-pack/plugins/apm/server/routes/traces.ts b/x-pack/plugins/apm/server/routes/traces/route.ts similarity index 79% rename from x-pack/plugins/apm/server/routes/traces.ts rename to x-pack/plugins/apm/server/routes/traces/route.ts index 5fdac470a81ed..24b5faeedfc00 100644 --- a/x-pack/plugins/apm/server/routes/traces.ts +++ b/x-pack/plugins/apm/server/routes/traces/route.ts @@ -6,15 +6,15 @@ */ import * as t from 'io-ts'; -import { setupRequest } from '../lib/helpers/setup_request'; -import { getTraceItems } from '../lib/traces/get_trace_items'; -import { getTopTransactionGroupList } from '../lib/transaction_groups'; -import { createApmServerRoute } from './apm_routes/create_apm_server_route'; -import { environmentRt, kueryRt, rangeRt } from './default_api_types'; -import { getSearchAggregatedTransactions } from '../lib/helpers/transactions'; -import { getRootTransactionByTraceId } from '../lib/transactions/get_transaction_by_trace'; -import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; -import { getTransaction } from '../lib/transactions/get_transaction'; +import { setupRequest } from '../../lib/helpers/setup_request'; +import { getTraceItems } from './get_trace_items'; +import { getTopTransactionGroupList } from '../../lib/transaction_groups'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { environmentRt, kueryRt, rangeRt } from '../default_api_types'; +import { getSearchAggregatedTransactions } from '../../lib/helpers/transactions'; +import { getRootTransactionByTraceId } from '../transactions/get_transaction_by_trace'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; +import { getTransaction } from '../transactions/get_transaction'; const tracesRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/traces', diff --git a/x-pack/plugins/apm/server/lib/transactions/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/routes/transactions/__snapshots__/queries.test.ts.snap similarity index 100% rename from x-pack/plugins/apm/server/lib/transactions/__snapshots__/queries.test.ts.snap rename to x-pack/plugins/apm/server/routes/transactions/__snapshots__/queries.test.ts.snap diff --git a/x-pack/plugins/apm/server/lib/transactions/breakdown/constants.ts b/x-pack/plugins/apm/server/routes/transactions/breakdown/constants.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/transactions/breakdown/constants.ts rename to x-pack/plugins/apm/server/routes/transactions/breakdown/constants.ts diff --git a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts b/x-pack/plugins/apm/server/routes/transactions/breakdown/index.test.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts rename to x-pack/plugins/apm/server/routes/transactions/breakdown/index.test.ts index 41d4c60fd72b4..1d2602dcafc75 100644 --- a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts +++ b/x-pack/plugins/apm/server/routes/transactions/breakdown/index.test.ts @@ -11,7 +11,7 @@ import noDataResponse from './mock_responses/no_data.json'; import dataResponse from './mock_responses/data.json'; import { APMConfig } from '../../..'; import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values'; -import { ApmIndicesConfig } from '../../settings/apm_indices/get_apm_indices'; +import { ApmIndicesConfig } from '../../../routes/settings/apm_indices/get_apm_indices'; const mockIndices: ApmIndicesConfig = { sourcemap: 'myIndex', diff --git a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.ts b/x-pack/plugins/apm/server/routes/transactions/breakdown/index.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/transactions/breakdown/index.ts rename to x-pack/plugins/apm/server/routes/transactions/breakdown/index.ts index a5c11776c70b0..2c3bca8443db0 100644 --- a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.ts +++ b/x-pack/plugins/apm/server/routes/transactions/breakdown/index.ts @@ -17,10 +17,10 @@ import { TRANSACTION_NAME, TRANSACTION_BREAKDOWN_COUNT, } from '../../../../common/elasticsearch_fieldnames'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { rangeQuery, kqlQuery } from '../../../../../observability/server'; import { environmentQuery } from '../../../../common/utils/environment_query'; -import { getMetricsDateHistogramParams } from '../../helpers/metrics'; +import { getMetricsDateHistogramParams } from '../../../lib/helpers/metrics'; import { MAX_KPIS } from './constants'; import { getVizColorForIndex } from '../../../../common/viz_colors'; diff --git a/x-pack/plugins/apm/server/lib/transactions/breakdown/mock_responses/data.json b/x-pack/plugins/apm/server/routes/transactions/breakdown/mock_responses/data.json similarity index 100% rename from x-pack/plugins/apm/server/lib/transactions/breakdown/mock_responses/data.json rename to x-pack/plugins/apm/server/routes/transactions/breakdown/mock_responses/data.json diff --git a/x-pack/plugins/apm/server/lib/transactions/breakdown/mock_responses/no_data.json b/x-pack/plugins/apm/server/routes/transactions/breakdown/mock_responses/no_data.json similarity index 100% rename from x-pack/plugins/apm/server/lib/transactions/breakdown/mock_responses/no_data.json rename to x-pack/plugins/apm/server/routes/transactions/breakdown/mock_responses/no_data.json diff --git a/x-pack/plugins/apm/server/lib/transactions/constants.ts b/x-pack/plugins/apm/server/routes/transactions/constants.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/transactions/constants.ts rename to x-pack/plugins/apm/server/routes/transactions/constants.ts diff --git a/x-pack/plugins/apm/server/lib/transactions/get_anomaly_data/fetcher.ts b/x-pack/plugins/apm/server/routes/transactions/get_anomaly_data/fetcher.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/transactions/get_anomaly_data/fetcher.ts rename to x-pack/plugins/apm/server/routes/transactions/get_anomaly_data/fetcher.ts index dd723f24abe1b..704bc751e5772 100644 --- a/x-pack/plugins/apm/server/lib/transactions/get_anomaly_data/fetcher.ts +++ b/x-pack/plugins/apm/server/routes/transactions/get_anomaly_data/fetcher.ts @@ -11,7 +11,7 @@ import { PromiseReturnType } from '../../../../../observability/typings/common'; import { rangeQuery } from '../../../../../observability/server'; import { asMutableArray } from '../../../../common/utils/as_mutable_array'; import { withApmSpan } from '../../../utils/with_apm_span'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { apmMlAnomalyQuery } from '../../../../common/anomaly_detection/apm_ml_anomaly_query'; import { ApmMlDetectorIndex } from '../../../../common/anomaly_detection/apm_ml_detectors'; diff --git a/x-pack/plugins/apm/server/lib/transactions/get_anomaly_data/index.ts b/x-pack/plugins/apm/server/routes/transactions/get_anomaly_data/index.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/transactions/get_anomaly_data/index.ts rename to x-pack/plugins/apm/server/routes/transactions/get_anomaly_data/index.ts index c1123182586b7..0cdbe1774504a 100644 --- a/x-pack/plugins/apm/server/lib/transactions/get_anomaly_data/index.ts +++ b/x-pack/plugins/apm/server/routes/transactions/get_anomaly_data/index.ts @@ -10,8 +10,8 @@ import { Logger } from 'src/core/server'; import { isFiniteNumber } from '../../../../common/utils/is_finite_number'; import { maybe } from '../../../../common/utils/maybe'; import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values'; -import { getBucketSize } from '../../helpers/get_bucket_size'; -import { Setup } from '../../helpers/setup_request'; +import { getBucketSize } from '../../../lib/helpers/get_bucket_size'; +import { Setup } from '../../../lib/helpers/setup_request'; import { anomalySeriesFetcher } from './fetcher'; import { getMLJobIds } from '../../service_map/get_service_anomalies'; import { ANOMALY_THRESHOLD } from '../../../../common/ml_constants'; diff --git a/x-pack/plugins/apm/server/lib/transactions/get_latency_charts/index.ts b/x-pack/plugins/apm/server/routes/transactions/get_latency_charts/index.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/transactions/get_latency_charts/index.ts rename to x-pack/plugins/apm/server/routes/transactions/get_latency_charts/index.ts index 4612d399b54a1..5375da3606f18 100644 --- a/x-pack/plugins/apm/server/lib/transactions/get_latency_charts/index.ts +++ b/x-pack/plugins/apm/server/routes/transactions/get_latency_charts/index.ts @@ -25,11 +25,11 @@ import { getProcessorEventForTransactions, } from '../../../lib/helpers/transactions'; import { Setup } from '../../../lib/helpers/setup_request'; -import { getBucketSizeForAggregatedTransactions } from '../../helpers/get_bucket_size_for_aggregated_transactions'; +import { getBucketSizeForAggregatedTransactions } from '../../../lib/helpers/get_bucket_size_for_aggregated_transactions'; import { getLatencyAggregation, getLatencyValue, -} from '../../helpers/latency_aggregation_type'; +} from '../../../lib/helpers/latency_aggregation_type'; export type LatencyChartsSearchResponse = PromiseReturnType< typeof searchLatency >; diff --git a/x-pack/plugins/apm/server/lib/transactions/get_transaction/index.ts b/x-pack/plugins/apm/server/routes/transactions/get_transaction/index.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/transactions/get_transaction/index.ts rename to x-pack/plugins/apm/server/routes/transactions/get_transaction/index.ts index 6d0bbcdb55ca4..0522fb3a1899d 100644 --- a/x-pack/plugins/apm/server/lib/transactions/get_transaction/index.ts +++ b/x-pack/plugins/apm/server/routes/transactions/get_transaction/index.ts @@ -10,7 +10,7 @@ import { TRANSACTION_ID, } from '../../../../common/elasticsearch_fieldnames'; import { rangeQuery, termQuery } from '../../../../../observability/server'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { ProcessorEvent } from '../../../../common/processor_event'; import { asMutableArray } from '../../../../common/utils/as_mutable_array'; diff --git a/x-pack/plugins/apm/server/lib/transactions/get_transaction_by_trace/index.ts b/x-pack/plugins/apm/server/routes/transactions/get_transaction_by_trace/index.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/transactions/get_transaction_by_trace/index.ts rename to x-pack/plugins/apm/server/routes/transactions/get_transaction_by_trace/index.ts index 568ce16e7aedc..d9c6a64bdbcc6 100644 --- a/x-pack/plugins/apm/server/lib/transactions/get_transaction_by_trace/index.ts +++ b/x-pack/plugins/apm/server/routes/transactions/get_transaction_by_trace/index.ts @@ -9,7 +9,7 @@ import { TRACE_ID, PARENT_ID, } from '../../../../common/elasticsearch_fieldnames'; -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { ProcessorEvent } from '../../../../common/processor_event'; export async function getRootTransactionByTraceId( diff --git a/x-pack/plugins/apm/server/lib/transactions/queries.test.ts b/x-pack/plugins/apm/server/routes/transactions/queries.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/transactions/queries.test.ts rename to x-pack/plugins/apm/server/routes/transactions/queries.test.ts diff --git a/x-pack/plugins/apm/server/routes/transactions.ts b/x-pack/plugins/apm/server/routes/transactions/route.ts similarity index 90% rename from x-pack/plugins/apm/server/routes/transactions.ts rename to x-pack/plugins/apm/server/routes/transactions/route.ts index c0d83bac6e8e4..5b3f4e4f3bd4c 100644 --- a/x-pack/plugins/apm/server/routes/transactions.ts +++ b/x-pack/plugins/apm/server/routes/transactions/route.ts @@ -11,24 +11,24 @@ import * as t from 'io-ts'; import { LatencyAggregationType, latencyAggregationTypeRt, -} from '../../common/latency_aggregation_types'; -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'; -import { getTransactionBreakdown } from '../lib/transactions/breakdown'; -import { getTransactionTraceSamples } from '../lib/transactions/trace_samples'; -import { getAnomalySeries } from '../lib/transactions/get_anomaly_data'; -import { getLatencyPeriods } from '../lib/transactions/get_latency_charts'; -import { getErrorRatePeriods } from '../lib/transaction_groups/get_error_rate'; -import { createApmServerRoute } from './apm_routes/create_apm_server_route'; -import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; +} from '../../../common/latency_aggregation_types'; +import { getSearchAggregatedTransactions } from '../../lib/helpers/transactions'; +import { setupRequest } from '../../lib/helpers/setup_request'; +import { getServiceTransactionGroups } from '../services/get_service_transaction_groups'; +import { getServiceTransactionGroupDetailedStatisticsPeriods } from '../services/get_service_transaction_group_detailed_statistics'; +import { getTransactionBreakdown } from './breakdown'; +import { getTransactionTraceSamples } from './trace_samples'; +import { getAnomalySeries } from './get_anomaly_data'; +import { getLatencyPeriods } from './get_latency_charts'; +import { getErrorRatePeriods } from '../../lib/transaction_groups/get_error_rate'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; import { comparisonRangeRt, environmentRt, kueryRt, rangeRt, -} from './default_api_types'; +} from '../default_api_types'; const transactionGroupsMainStatisticsRoute = createApmServerRoute({ endpoint: diff --git a/x-pack/plugins/apm/server/lib/transactions/trace_samples/get_trace_samples/index.ts b/x-pack/plugins/apm/server/routes/transactions/trace_samples/get_trace_samples/index.ts similarity index 97% rename from x-pack/plugins/apm/server/lib/transactions/trace_samples/get_trace_samples/index.ts rename to x-pack/plugins/apm/server/routes/transactions/trace_samples/get_trace_samples/index.ts index 9b96cf19c516d..d4ceafd9f6306 100644 --- a/x-pack/plugins/apm/server/lib/transactions/trace_samples/get_trace_samples/index.ts +++ b/x-pack/plugins/apm/server/routes/transactions/trace_samples/get_trace_samples/index.ts @@ -17,7 +17,7 @@ import { import { ProcessorEvent } from '../../../../../common/processor_event'; import { rangeQuery, kqlQuery } from '../../../../../../observability/server'; import { environmentQuery } from '../../../../../common/utils/environment_query'; -import { Setup } from '../../../helpers/setup_request'; +import { Setup } from '../../../../lib/helpers/setup_request'; const TRACE_SAMPLES_SIZE = 500; diff --git a/x-pack/plugins/apm/server/lib/transactions/trace_samples/index.ts b/x-pack/plugins/apm/server/routes/transactions/trace_samples/index.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/transactions/trace_samples/index.ts rename to x-pack/plugins/apm/server/routes/transactions/trace_samples/index.ts index e422be417438b..89bae10db5e87 100644 --- a/x-pack/plugins/apm/server/lib/transactions/trace_samples/index.ts +++ b/x-pack/plugins/apm/server/routes/transactions/trace_samples/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Setup } from '../../helpers/setup_request'; +import { Setup } from '../../../lib/helpers/setup_request'; import { getTraceSamples } from './get_trace_samples'; import { withApmSpan } from '../../../utils/with_apm_span'; diff --git a/x-pack/plugins/apm/server/tutorial/index.ts b/x-pack/plugins/apm/server/tutorial/index.ts index f04b794091ff2..5d3ff8636df4d 100644 --- a/x-pack/plugins/apm/server/tutorial/index.ts +++ b/x-pack/plugins/apm/server/tutorial/index.ts @@ -14,8 +14,8 @@ import { } from '../../../../../src/plugins/home/server'; import { CloudSetup } from '../../../cloud/server'; import { APM_STATIC_INDEX_PATTERN_ID } from '../../common/index_pattern_constants'; -import { getApmDataViewTitle } from '../lib/data_view/get_apm_data_view_title'; -import { ApmIndicesConfig } from '../lib/settings/apm_indices/get_apm_indices'; +import { getApmDataViewTitle } from '../routes/data_view/get_apm_data_view_title'; +import { ApmIndicesConfig } from '../routes/settings/apm_indices/get_apm_indices'; import { createElasticCloudInstructions } from './envs/elastic_cloud'; import { onPremInstructions } from './envs/on_prem'; import apmDataView from './index_pattern.json'; diff --git a/x-pack/plugins/apm/server/types.ts b/x-pack/plugins/apm/server/types.ts index c686c42beb6ef..02aae547407e5 100644 --- a/x-pack/plugins/apm/server/types.ts +++ b/x-pack/plugins/apm/server/types.ts @@ -47,7 +47,7 @@ import { FleetStartContract as FleetPluginStart, } from '../../fleet/server'; import { APMConfig } from '.'; -import { getApmIndices } from './lib/settings/apm_indices/get_apm_indices'; +import { getApmIndices } from './routes/settings/apm_indices/get_apm_indices'; import { createApmEventClient } from './lib/helpers/create_es_client/create_apm_event_client'; import { ApmPluginRequestHandlerContext } from './routes/typings'; diff --git a/x-pack/plugins/apm/server/utils/test_helpers.tsx b/x-pack/plugins/apm/server/utils/test_helpers.tsx index 0e1b9f2ba8051..19644b5bc87f8 100644 --- a/x-pack/plugins/apm/server/utils/test_helpers.tsx +++ b/x-pack/plugins/apm/server/utils/test_helpers.tsx @@ -12,7 +12,7 @@ import { ESSearchResponse, } from '../../../../../src/core/types/elasticsearch'; import { UxUIFilters } from '../../typings/ui_filters'; -import { ApmIndicesConfig } from '../lib/settings/apm_indices/get_apm_indices'; +import { ApmIndicesConfig } from '../routes/settings/apm_indices/get_apm_indices'; interface Options { mockResponse?: ( diff --git a/x-pack/test/apm_api_integration/tests/metrics_charts/metrics_charts.spec.ts b/x-pack/test/apm_api_integration/tests/metrics_charts/metrics_charts.spec.ts index d70ee347d4c2d..beaaae24fb220 100644 --- a/x-pack/test/apm_api_integration/tests/metrics_charts/metrics_charts.spec.ts +++ b/x-pack/test/apm_api_integration/tests/metrics_charts/metrics_charts.spec.ts @@ -7,7 +7,7 @@ import expect from '@kbn/expect'; import { first } from 'lodash'; -import { GenericMetricsChart } from '../../../../plugins/apm/server/lib/metrics/fetch_and_transform_metrics'; +import { GenericMetricsChart } from '../../../../plugins/apm/server/routes/metrics/fetch_and_transform_metrics'; import { SupertestReturnType } from '../../common/apm_api_supertest'; import { FtrProviderContext } from '../../common/ftr_provider_context'; diff --git a/x-pack/test/apm_api_integration/tests/settings/agent_configuration.spec.ts b/x-pack/test/apm_api_integration/tests/settings/agent_configuration.spec.ts index df504ec7444d7..cea718c2c69d5 100644 --- a/x-pack/test/apm_api_integration/tests/settings/agent_configuration.spec.ts +++ b/x-pack/test/apm_api_integration/tests/settings/agent_configuration.spec.ts @@ -10,7 +10,7 @@ import { inspect } from 'util'; import expect from '@kbn/expect'; import { omit, orderBy } from 'lodash'; import { AgentConfigurationIntake } from '../../../../plugins/apm/common/agent_configuration/configuration_types'; -import { AgentConfigSearchParams } from '../../../../plugins/apm/server/routes/settings/agent_configuration'; +import { AgentConfigSearchParams } from '../../../../plugins/apm/server/routes/settings/agent_configuration/route'; import { FtrProviderContext } from '../../common/ftr_provider_context';