diff --git a/test/plugin_functional/test_suites/core_plugins/rendering.ts b/test/plugin_functional/test_suites/core_plugins/rendering.ts index b2decd2293108..b223801fff83b 100644 --- a/test/plugin_functional/test_suites/core_plugins/rendering.ts +++ b/test/plugin_functional/test_suites/core_plugins/rendering.ts @@ -163,6 +163,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) { 'monitoring.ui.enabled (boolean?)', 'monitoring.ui.min_interval_seconds (number?)', 'monitoring.ui.show_license_expiration (boolean?)', + 'monitoring.ui.logs.index (string?)', 'newsfeed.fetchInterval (duration?)', 'newsfeed.mainInterval (duration?)', 'newsfeed.service.pathTemplate (string?)', diff --git a/x-pack/plugins/monitoring/common/constants.ts b/x-pack/plugins/monitoring/common/constants.ts index 25b22722a33b4..89dcba5637787 100644 --- a/x-pack/plugins/monitoring/common/constants.ts +++ b/x-pack/plugins/monitoring/common/constants.ts @@ -151,11 +151,6 @@ export const METRICBEAT_INDEX_NAME_UNIQUE_TOKEN = '-mb-'; // We use this for metricbeat migration to identify specific products that we do not have constants for export const ELASTICSEARCH_SYSTEM_ID = 'elasticsearch'; -/** - * The id of the infra source owned by the monitoring plugin. - */ -export const INFRA_SOURCE_ID = 'internal-stack-monitoring'; - /* * These constants represent code paths within `getClustersFromRequest` * that an api call wants to invoke. This is meant as an optimization to diff --git a/x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.test.ts b/x-pack/plugins/monitoring/common/get_index_patterns.test.ts similarity index 98% rename from x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.test.ts rename to x-pack/plugins/monitoring/common/get_index_patterns.test.ts index c13217ab0abc6..7727d5e04916a 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.test.ts +++ b/x-pack/plugins/monitoring/common/get_index_patterns.test.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { DS_INDEX_PATTERN_TYPES } from '../../../common/constants'; -import { MonitoringConfig } from '../..'; +import { DS_INDEX_PATTERN_TYPES } from './constants'; +import { MonitoringConfig } from '../server'; import { getElasticsearchDataset, getKibanaDataset, diff --git a/x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.ts b/x-pack/plugins/monitoring/common/get_index_patterns.ts similarity index 96% rename from x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.ts rename to x-pack/plugins/monitoring/common/get_index_patterns.ts index 4f293baf613bf..d0f19e622eedf 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.ts +++ b/x-pack/plugins/monitoring/common/get_index_patterns.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { prefixIndexPatternWithCcs } from '../../../common/ccs_utils'; +import { prefixIndexPatternWithCcs } from './ccs_utils'; import { INDEX_PATTERN_ELASTICSEARCH, INDEX_PATTERN_ELASTICSEARCH_ECS, @@ -16,8 +16,8 @@ import { DS_INDEX_PATTERN_METRICS, INDEX_PATTERN_TYPES, INDEX_PATTERN_ENTERPRISE_SEARCH, -} from '../../../common/constants'; -import { MonitoringConfig } from '../../config'; +} from './constants'; +import type { MonitoringConfig } from '../server/config'; interface CommonIndexPatternArgs { config: MonitoringConfig; diff --git a/x-pack/plugins/monitoring/kibana.jsonc b/x-pack/plugins/monitoring/kibana.jsonc index 74b730055b787..abdd802152da9 100644 --- a/x-pack/plugins/monitoring/kibana.jsonc +++ b/x-pack/plugins/monitoring/kibana.jsonc @@ -20,7 +20,6 @@ ], "optionalPlugins": [ "infra", - "logsShared", "usageCollection", "home", "cloud", @@ -35,7 +34,6 @@ "kibanaUtils", "alerting", "kibanaReact", - "logsShared" ] } } diff --git a/x-pack/plugins/monitoring/public/components/logs/__snapshots__/logs.test.js.snap b/x-pack/plugins/monitoring/public/components/logs/__snapshots__/logs.test.js.snap index a3d5e96d6ef2f..91b3dea5ab049 100644 --- a/x-pack/plugins/monitoring/public/components/logs/__snapshots__/logs.test.js.snap +++ b/x-pack/plugins/monitoring/public/components/logs/__snapshots__/logs.test.js.snap @@ -12,10 +12,8 @@ exports[`Logs should render a link to filter by cluster uuid 1`] = ` id="xpack.monitoring.logs.listing.linkText" values={ Object { - "link": - Logs + "link": + Discover , } } @@ -36,10 +34,8 @@ exports[`Logs should render a link to filter by cluster uuid and index uuid 1`] id="xpack.monitoring.logs.listing.linkText" values={ Object { - "link": - Logs + "link": + Discover , } } @@ -60,10 +56,8 @@ exports[`Logs should render a link to filter by cluster uuid and node uuid 1`] = id="xpack.monitoring.logs.listing.linkText" values={ Object { - "link": - Logs + "link": + Discover , } } @@ -290,10 +284,8 @@ exports[`Logs should render normally 1`] = ` id="xpack.monitoring.logs.listing.linkText" values={ Object { - "link": - Logs + "link": + Discover , } } diff --git a/x-pack/plugins/monitoring/public/components/logs/logs.js b/x-pack/plugins/monitoring/public/components/logs/logs.js index 3da4bc9dc13ff..82fdac6ea1f0d 100644 --- a/x-pack/plugins/monitoring/public/components/logs/logs.js +++ b/x-pack/plugins/monitoring/public/components/logs/logs.js @@ -5,7 +5,7 @@ * 2.0. */ -import React, { PureComponent } from 'react'; +import React, { PureComponent, useContext } from 'react'; import { RedirectAppLinks } from '@kbn/shared-ux-link-redirect-app'; import { upperFirst } from 'lodash'; import { Legacy } from '../../legacy_shims'; @@ -15,7 +15,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import { Reason } from './reason'; import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { getLogsLocatorsFromUrlService } from '@kbn/logs-shared-plugin/common'; +import { ExternalConfigContext } from '../../application/contexts/external_config_context'; const getFormattedDateTimeLocal = (timestamp) => { const timezone = Legacy.shims.uiSettings?.get('dateFormat:tz'); @@ -111,7 +111,7 @@ const clusterColumns = [ }, ]; -function getLogsUiLink(clusterUuid, nodeId, indexUuid, sharePlugin) { +function getLogsUiLink(clusterUuid, nodeId, indexUuid, sharePlugin, logsIndices) { const params = []; if (clusterUuid) { params.push(`elasticsearch.cluster.uuid:${clusterUuid}`); @@ -124,10 +124,17 @@ function getLogsUiLink(clusterUuid, nodeId, indexUuid, sharePlugin) { } const filter = params.join(' and '); - const { logsLocator } = getLogsLocatorsFromUrlService(sharePlugin.url); + const discoverLocator = sharePlugin.url.locators.get('DISCOVER_APP_LOCATOR'); - const base = logsLocator.getRedirectUrl({ - filter, + const base = discoverLocator.getRedirectUrl({ + dataViewSpec: { + id: logsIndices, + title: logsIndices, + }, + query: { + language: 'kuery', + query: filter, + }, }); return base; @@ -137,7 +144,8 @@ export const Logs = (props) => { const { services: { share }, } = useKibana(); - return ; + const externalConfig = useContext(ExternalConfigContext); + return ; }; export class LogsContent extends PureComponent { renderLogs() { @@ -168,13 +176,15 @@ export class LogsContent extends PureComponent { renderCallout() { const { capabilities: uiCapabilities, infra, kibanaServices } = Legacy.shims; - const show = uiCapabilities.logs && uiCapabilities.logs.show; + const show = uiCapabilities.discover && uiCapabilities.discover.show; + const { logs: { enabled }, nodeId, clusterUuid, indexUuid, sharePlugin, + logsIndices, } = this.props; if (!enabled || !show) { @@ -195,9 +205,11 @@ export class LogsContent extends PureComponent { defaultMessage="Visit {link} to dive deeper." values={{ link: ( - + {i18n.translate('xpack.monitoring.logs.listing.calloutLinkText', { - defaultMessage: 'Logs', + defaultMessage: 'Discover', })} ), diff --git a/x-pack/plugins/monitoring/public/components/logs/logs.test.js b/x-pack/plugins/monitoring/public/components/logs/logs.test.js index 1117a484a294c..9d3f68c854505 100644 --- a/x-pack/plugins/monitoring/public/components/logs/logs.test.js +++ b/x-pack/plugins/monitoring/public/components/logs/logs.test.js @@ -10,32 +10,26 @@ import { shallow } from 'enzyme'; import { LogsContent } from './logs'; import { sharePluginMock } from '@kbn/share-plugin/public/mocks'; -const sharePlugin = sharePluginMock.createStartContract(); - -jest.mock('@kbn/logs-shared-plugin/common', () => { - return { - getLogsLocatorsFromUrlService: jest.fn().mockReturnValue({ - logsLocator: { getRedirectUrl: jest.fn(() => '') }, - }), - }; -}); - jest.mock('../../legacy_shims', () => ({ Legacy: { shims: { getBasePath: () => '', - capabilities: { logs: { show: true } }, - infra: { - locators: { - logsLocator: { - getRedirectUrl: () => '', - }, - }, - }, + capabilities: { discover: { show: true } }, + infra: {}, }, }, })); +const sharePlugin = { + url: { + locators: { + get: () => { + return sharePluginMock.createLocator(); + }, + }, + }, +}; + const logs = { enabled: true, limit: 10, @@ -134,39 +128,69 @@ const logs = { describe('Logs', () => { it('should render normally', () => { - const component = shallow(); + const component = shallow( + + ); expect(component).toMatchSnapshot(); }); it('should render fewer columns for node or index view', () => { - const component = shallow(); + const component = shallow( + + ); expect(component.find('EuiBasicTable').prop('columns')).toMatchSnapshot(); }); it('should render a link to filter by cluster uuid', () => { const component = shallow( - + ); expect(component.find('EuiCallOut')).toMatchSnapshot(); }); it('should render a link to filter by cluster uuid and node uuid', () => { const component = shallow( - + ); expect(component.find('EuiCallOut')).toMatchSnapshot(); }); it('should render a link to filter by cluster uuid and index uuid', () => { const component = shallow( - + ); expect(component.find('EuiCallOut')).toMatchSnapshot(); }); it('should render a reason if the logs are disabled', () => { const component = shallow( - + ); expect(component).toMatchSnapshot(); }); diff --git a/x-pack/plugins/monitoring/public/plugin.ts b/x-pack/plugins/monitoring/public/plugin.ts index e29faa9ca5d86..02033d839e1ae 100644 --- a/x-pack/plugins/monitoring/public/plugin.ts +++ b/x-pack/plugins/monitoring/public/plugin.ts @@ -19,6 +19,7 @@ import type { HomePublicPluginSetup } from '@kbn/home-plugin/public'; import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; import { TriggersAndActionsUIPublicPluginSetup } from '@kbn/triggers-actions-ui-plugin/public'; import { + CCS_REMOTE_PATTERN, RULE_DETAILS, RULE_THREAD_POOL_SEARCH_REJECTIONS, RULE_THREAD_POOL_WRITE_REJECTIONS, @@ -38,6 +39,7 @@ import { MonitoringStartPluginDependencies, LegacyMonitoringStartPluginDependencies, } from './types'; +import { getIndexPatterns } from '../common/get_index_patterns'; interface MonitoringSetupPluginDependencies { home?: HomePublicPluginSetup; @@ -154,6 +156,7 @@ export class MonitoringPlugin monitoring.ui.kibana.reporting.stale_status_threshold_seconds, ], ['isCcsEnabled', monitoring.ui.ccs.enabled], + ['logsIndices', getLogsIndices(monitoring)], ]; } @@ -188,3 +191,11 @@ export class MonitoringPlugin } } } + +const getLogsIndices = (config: MonitoringConfig) => { + return getIndexPatterns({ + config, + type: 'logs', + ccs: CCS_REMOTE_PATTERN, + }); +}; diff --git a/x-pack/plugins/monitoring/server/index.ts b/x-pack/plugins/monitoring/server/index.ts index f39af9fffe7d6..24062f0b947a0 100644 --- a/x-pack/plugins/monitoring/server/index.ts +++ b/x-pack/plugins/monitoring/server/index.ts @@ -35,6 +35,7 @@ export const config: PluginConfigDescriptor> = { stale_status_threshold_seconds: true, }, }, + logs: true, }, kibana: true, }, diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_ccr_read_exceptions.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_ccr_read_exceptions.ts index f7535c26f2e43..50cc76225f418 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_ccr_read_exceptions.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_ccr_read_exceptions.ts @@ -10,7 +10,7 @@ import { get } from 'lodash'; import { isCCSRemoteIndexName } from '@kbn/es-query'; import { CCS_REMOTE_PATTERN } from '../../../common/constants'; import { CCRReadExceptionsStats } from '../../../common/types/alerts'; -import { getIndexPatterns, getElasticsearchDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../common/get_index_patterns'; import { createDatasetFilter } from './create_dataset_query_filter'; import { Globals } from '../../static_globals'; diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_cluster_health.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_cluster_health.ts index a4ef0b1321fa7..1d35440d65ae3 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_cluster_health.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_cluster_health.ts @@ -10,7 +10,7 @@ import { AlertCluster, AlertClusterHealth } from '../../../common/types/alerts'; import { ElasticsearchSource } from '../../../common/types/es'; import { createDatasetFilter } from './create_dataset_query_filter'; import { Globals } from '../../static_globals'; -import { getIndexPatterns, getElasticsearchDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../common/get_index_patterns'; import { CCS_REMOTE_PATTERN } from '../../../common/constants'; export async function fetchClusterHealth( diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_clusters.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_clusters.ts index 80b1128ddf162..870d1dde9e4ca 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_clusters.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_clusters.ts @@ -8,7 +8,7 @@ import { ElasticsearchClient } from '@kbn/core/server'; import { get } from 'lodash'; import { AlertCluster } from '../../../common/types/alerts'; -import { getIndexPatterns, getElasticsearchDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../common/get_index_patterns'; import { createDatasetFilter } from './create_dataset_query_filter'; import { Globals } from '../../static_globals'; import { CCS_REMOTE_PATTERN } from '../../../common/constants'; diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_cpu_usage_node_stats.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_cpu_usage_node_stats.ts index b74b1b78b495b..761d3087d8c73 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_cpu_usage_node_stats.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_cpu_usage_node_stats.ts @@ -11,7 +11,7 @@ import moment from 'moment'; import { NORMALIZED_DERIVATIVE_UNIT } from '../../../common/constants'; import { AlertCluster, AlertCpuUsageNodeStats } from '../../../common/types/alerts'; import { createDatasetFilter } from './create_dataset_query_filter'; -import { getIndexPatterns, getElasticsearchDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../common/get_index_patterns'; import { Globals } from '../../static_globals'; import { CCS_REMOTE_PATTERN } from '../../../common/constants'; diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_disk_usage_node_stats.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_disk_usage_node_stats.ts index 7bf405985e57b..1c8f9808a04a5 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_disk_usage_node_stats.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_disk_usage_node_stats.ts @@ -11,7 +11,7 @@ import { AlertCluster, AlertDiskUsageNodeStats } from '../../../common/types/ale import { createDatasetFilter } from './create_dataset_query_filter'; import { Globals } from '../../static_globals'; import { CCS_REMOTE_PATTERN } from '../../../common/constants'; -import { getIndexPatterns, getElasticsearchDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../common/get_index_patterns'; export async function fetchDiskUsageNodeStats( esClient: ElasticsearchClient, diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_elasticsearch_versions.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_elasticsearch_versions.ts index 4c5f6b06d39e4..a82cb77c047af 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_elasticsearch_versions.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_elasticsearch_versions.ts @@ -10,7 +10,7 @@ import { ElasticsearchSource } from '../../../common/types/es'; import { createDatasetFilter } from './create_dataset_query_filter'; import { Globals } from '../../static_globals'; import { CCS_REMOTE_PATTERN } from '../../../common/constants'; -import { getIndexPatterns, getElasticsearchDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../common/get_index_patterns'; export async function fetchElasticsearchVersions( esClient: ElasticsearchClient, diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_index_shard_size.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_index_shard_size.ts index 5c32794cbf212..7b5affc78702a 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_index_shard_size.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_index_shard_size.ts @@ -12,7 +12,7 @@ import { ESGlobPatterns, RegExPatterns } from '../../../common/es_glob_patterns' import { createDatasetFilter } from './create_dataset_query_filter'; import { Globals } from '../../static_globals'; import { CCS_REMOTE_PATTERN } from '../../../common/constants'; -import { getIndexPatterns, getElasticsearchDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../common/get_index_patterns'; type TopHitType = ElasticsearchResponseHit & { _source: { index_stats?: Partial }; diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_kibana_versions.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_kibana_versions.ts index bd6f7d3255abf..3f6282c049aa7 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_kibana_versions.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_kibana_versions.ts @@ -10,7 +10,7 @@ import { AlertCluster, AlertVersions } from '../../../common/types/alerts'; import { createDatasetFilter } from './create_dataset_query_filter'; import { Globals } from '../../static_globals'; import { CCS_REMOTE_PATTERN } from '../../../common/constants'; -import { getIndexPatterns, getKibanaDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getKibanaDataset } from '../../../common/get_index_patterns'; interface ESAggResponse { key: string; diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_licenses.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_licenses.ts index 30c1317696d7e..b7216b259302a 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_licenses.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_licenses.ts @@ -10,7 +10,7 @@ import { ElasticsearchSource } from '../../../common/types/es'; import { createDatasetFilter } from './create_dataset_query_filter'; import { Globals } from '../../static_globals'; import { CCS_REMOTE_PATTERN } from '../../../common/constants'; -import { getIndexPatterns, getElasticsearchDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../common/get_index_patterns'; export async function fetchLicenses( esClient: ElasticsearchClient, diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_logstash_versions.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_logstash_versions.ts index 2d4223091051b..5bbaf32442694 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_logstash_versions.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_logstash_versions.ts @@ -10,7 +10,7 @@ import { AlertCluster, AlertVersions } from '../../../common/types/alerts'; import { createDatasetFilter } from './create_dataset_query_filter'; import { Globals } from '../../static_globals'; import { CCS_REMOTE_PATTERN } from '../../../common/constants'; -import { getIndexPatterns, getLogstashDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getLogstashDataset } from '../../../common/get_index_patterns'; interface ESAggResponse { key: string; diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_memory_usage_node_stats.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_memory_usage_node_stats.ts index 4d05843c6703c..da943945aebce 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_memory_usage_node_stats.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_memory_usage_node_stats.ts @@ -11,7 +11,7 @@ import { AlertCluster, AlertMemoryUsageNodeStats } from '../../../common/types/a import { createDatasetFilter } from './create_dataset_query_filter'; import { Globals } from '../../static_globals'; import { CCS_REMOTE_PATTERN } from '../../../common/constants'; -import { getIndexPatterns, getElasticsearchDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../common/get_index_patterns'; export async function fetchMemoryUsageNodeStats( esClient: ElasticsearchClient, diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_missing_monitoring_data.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_missing_monitoring_data.ts index 35f37c14b98ac..5343604011710 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_missing_monitoring_data.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_missing_monitoring_data.ts @@ -10,7 +10,7 @@ import { get } from 'lodash'; import { AlertCluster, AlertMissingData } from '../../../common/types/alerts'; import { Globals } from '../../static_globals'; import { CCS_REMOTE_PATTERN } from '../../../common/constants'; -import { getIndexPatterns, getElasticsearchDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../common/get_index_patterns'; import { createDatasetFilter } from './create_dataset_query_filter'; interface ClusterBucketESResponse { diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_nodes_from_cluster_stats.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_nodes_from_cluster_stats.ts index cb8f0e4e14b82..f4cf1f5cb4f7a 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_nodes_from_cluster_stats.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_nodes_from_cluster_stats.ts @@ -10,7 +10,7 @@ import { ElasticsearchSource } from '../../../common/types/es'; import { createDatasetFilter } from './create_dataset_query_filter'; import { Globals } from '../../static_globals'; import { CCS_REMOTE_PATTERN } from '../../../common/constants'; -import { getIndexPatterns, getElasticsearchDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../common/get_index_patterns'; function formatNode( nodes: NonNullable['nodes']> | undefined diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_thread_pool_rejections_stats.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_thread_pool_rejections_stats.ts index 0cf69df44a181..3e26d9eb77028 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_thread_pool_rejections_stats.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_thread_pool_rejections_stats.ts @@ -11,7 +11,7 @@ import { AlertCluster, AlertThreadPoolRejectionsStats } from '../../../common/ty import { createDatasetFilter } from './create_dataset_query_filter'; import { Globals } from '../../static_globals'; import { CCS_REMOTE_PATTERN } from '../../../common/constants'; -import { getIndexPatterns, getElasticsearchDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../common/get_index_patterns'; const invalidNumberValue = (value: number) => { return isNaN(value) || value === undefined || value === null; diff --git a/x-pack/plugins/monitoring/server/lib/apm/create_apm_query.ts b/x-pack/plugins/monitoring/server/lib/apm/create_apm_query.ts index 85958eccfe2d4..1929f5c695314 100644 --- a/x-pack/plugins/monitoring/server/lib/apm/create_apm_query.ts +++ b/x-pack/plugins/monitoring/server/lib/apm/create_apm_query.ts @@ -7,7 +7,7 @@ import { ApmMetric, ApmMetricFields } from '../metrics'; import { createQuery } from '../create_query'; -import { getBeatDataset } from '../cluster/get_index_patterns'; +import { getBeatDataset } from '../../../common/get_index_patterns'; /** * {@code createQuery} for all APM instances. diff --git a/x-pack/plugins/monitoring/server/lib/apm/get_apms_for_clusters.ts b/x-pack/plugins/monitoring/server/lib/apm/get_apms_for_clusters.ts index 072f296fc52a3..5764d787142c9 100644 --- a/x-pack/plugins/monitoring/server/lib/apm/get_apms_for_clusters.ts +++ b/x-pack/plugins/monitoring/server/lib/apm/get_apms_for_clusters.ts @@ -11,7 +11,7 @@ import { ApmMetric } from '../metrics'; import { apmAggResponseHandler, apmUuidsAgg, apmAggFilterPath } from './_apm_stats'; import { getTimeOfLastEvent } from './_get_time_of_last_event'; import { ElasticsearchResponse } from '../../../common/types/es'; -import { getIndexPatterns } from '../cluster/get_index_patterns'; +import { getIndexPatterns } from '../../../common/get_index_patterns'; import { Globals } from '../../static_globals'; export function handleResponse(clusterUuid: string, response: ElasticsearchResponse) { diff --git a/x-pack/plugins/monitoring/server/lib/beats/create_beats_query.ts b/x-pack/plugins/monitoring/server/lib/beats/create_beats_query.ts index 9a59620a154ef..cdb41945bd053 100644 --- a/x-pack/plugins/monitoring/server/lib/beats/create_beats_query.ts +++ b/x-pack/plugins/monitoring/server/lib/beats/create_beats_query.ts @@ -7,7 +7,7 @@ import { BeatsMetric, BeatsMetricFields } from '../metrics'; import { createQuery } from '../create_query'; -import { getBeatDataset } from '../cluster/get_index_patterns'; +import { getBeatDataset } from '../../../common/get_index_patterns'; /** * {@code createQuery} for all Beats instances. diff --git a/x-pack/plugins/monitoring/server/lib/beats/get_beats_for_clusters.ts b/x-pack/plugins/monitoring/server/lib/beats/get_beats_for_clusters.ts index f1914d0bc9f2b..8e0a6236a2fd9 100644 --- a/x-pack/plugins/monitoring/server/lib/beats/get_beats_for_clusters.ts +++ b/x-pack/plugins/monitoring/server/lib/beats/get_beats_for_clusters.ts @@ -10,7 +10,7 @@ import { createBeatsQuery } from './create_beats_query'; import { beatsAggFilterPath, beatsUuidsAgg, beatsAggResponseHandler } from './_beats_stats'; import type { ElasticsearchResponse } from '../../../common/types/es'; import { LegacyRequest, Cluster } from '../../types'; -import { getIndexPatterns } from '../cluster/get_index_patterns'; +import { getIndexPatterns } from '../../../common/get_index_patterns'; import { Globals } from '../../static_globals'; export function handleResponse(clusterUuid: string, response: ElasticsearchResponse) { diff --git a/x-pack/plugins/monitoring/server/lib/cluster/flag_supported_clusters.ts b/x-pack/plugins/monitoring/server/lib/cluster/flag_supported_clusters.ts index d4ea1363054f6..f5ea6aa19c0fe 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/flag_supported_clusters.ts +++ b/x-pack/plugins/monitoring/server/lib/cluster/flag_supported_clusters.ts @@ -10,7 +10,7 @@ import { TimeRange } from '../../../common/http_api/shared'; import { ElasticsearchResponse } from '../../../common/types/es'; import { Globals } from '../../static_globals'; import { Cluster, LegacyRequest } from '../../types'; -import { getIndexPatterns, getKibanaDataset } from './get_index_patterns'; +import { getIndexPatterns, getKibanaDataset } from '../../../common/get_index_patterns'; export interface FindSupportClusterRequestPayload { timeRange: TimeRange; diff --git a/x-pack/plugins/monitoring/server/lib/cluster/get_cluster_license.ts b/x-pack/plugins/monitoring/server/lib/cluster/get_cluster_license.ts index b0144c3a84391..bc25cf3280182 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/get_cluster_license.ts +++ b/x-pack/plugins/monitoring/server/lib/cluster/get_cluster_license.ts @@ -9,7 +9,7 @@ import { createQuery } from '../create_query'; import { ElasticsearchMetric } from '../metrics'; import { ElasticsearchResponse } from '../../../common/types/es'; import { LegacyRequest } from '../../types'; -import { getIndexPatterns, getElasticsearchDataset } from './get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../common/get_index_patterns'; import { Globals } from '../../static_globals'; // is this being used anywhere? not called within the app diff --git a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.ts b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.ts index 6f082dcdb97ac..52c0c2a6b7334 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.ts +++ b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.ts @@ -41,7 +41,7 @@ import { LegacyRequest, Cluster } from '../../types'; import { RulesByType } from '../../../common/types/alerts'; import { getClusterRuleDataForClusters, getInstanceRuleDataForClusters } from '../kibana/rules'; import { Globals } from '../../static_globals'; -import { getIndexPatterns } from './get_index_patterns'; +import { getIndexPatterns } from '../../../common/get_index_patterns'; /** * Get all clusters or the cluster associated with {@code clusterUuid} when it is defined. diff --git a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_state.ts b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_state.ts index 3415ac09dad25..4d6ca01e3e6e7 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_state.ts +++ b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_state.ts @@ -8,7 +8,7 @@ import { find } from 'lodash'; import { ElasticsearchResponse, ElasticsearchModifiedSource } from '../../../common/types/es'; import { LegacyRequest } from '../../types'; -import { getIndexPatterns } from './get_index_patterns'; +import { getIndexPatterns } from '../../../common/get_index_patterns'; import { Globals } from '../../static_globals'; /** diff --git a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_stats.ts b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_stats.ts index 240607eb8a08b..59a66b8b9ea4d 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_stats.ts +++ b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_stats.ts @@ -11,7 +11,7 @@ import { parseCrossClusterPrefix } from '../../../common/ccs_utils'; import { getClustersState } from './get_clusters_state'; import { ElasticsearchResponse, ElasticsearchModifiedSource } from '../../../common/types/es'; import { LegacyRequest } from '../../types'; -import { getIndexPatterns, getElasticsearchDataset } from './get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../common/get_index_patterns'; import { Globals } from '../../static_globals'; /** diff --git a/x-pack/plugins/monitoring/server/lib/details/get_series.ts b/x-pack/plugins/monitoring/server/lib/details/get_series.ts index 3b325864d8036..854c5a67db307 100644 --- a/x-pack/plugins/monitoring/server/lib/details/get_series.ts +++ b/x-pack/plugins/monitoring/server/lib/details/get_series.ts @@ -22,7 +22,7 @@ import { DS_INDEX_PATTERN_METRICS, } from '../../../common/constants'; import { formatUTCTimestampForTimezone } from '../format_timezone'; -import { getIndexPatterns } from '../cluster/get_index_patterns'; +import { getIndexPatterns } from '../../../common/get_index_patterns'; import { Globals } from '../../static_globals'; import type { Metric } from '../metrics/metrics'; diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/ccr.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/ccr.ts index 4dd568bc2f877..f809e6e358e7c 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/ccr.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/ccr.ts @@ -10,7 +10,7 @@ import { ElasticsearchMetric } from '../metrics'; import { createQuery } from '../create_query'; import { ElasticsearchResponse } from '../../../common/types/es'; import { LegacyRequest } from '../../types'; -import { getIndexPatterns, getElasticsearchDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../common/get_index_patterns'; import { Globals } from '../../static_globals'; export async function checkCcrEnabled(req: LegacyRequest, ccs: string) { diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/get_last_recovery.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/get_last_recovery.ts index 81262ddb3e3f0..baaa06c1421ab 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/get_last_recovery.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/get_last_recovery.ts @@ -16,7 +16,7 @@ import { ElasticsearchResponseHit, } from '../../../common/types/es'; import { LegacyRequest } from '../../types'; -import { getIndexPatterns, getElasticsearchDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../common/get_index_patterns'; import { Globals } from '../../static_globals'; /** diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/get_ml_jobs.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/get_ml_jobs.ts index f26d9df66201b..ab724a2c49cf1 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/get_ml_jobs.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/get_ml_jobs.ts @@ -11,7 +11,7 @@ import { ElasticsearchMetric } from '../metrics'; import { ML_SUPPORTED_LICENSES } from '../../../common/constants'; import { ElasticsearchResponse } from '../../../common/types/es'; import { LegacyRequest, Cluster } from '../../types'; -import { getIndexPatterns, getElasticsearchDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../common/get_index_patterns'; import { Globals } from '../../static_globals'; /* diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/indices/get_index_summary.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/indices/get_index_summary.ts index b2cffbcf36671..4da1099fd5836 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/indices/get_index_summary.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/indices/get_index_summary.ts @@ -11,7 +11,7 @@ import { createQuery } from '../../create_query'; import { ElasticsearchMetric } from '../../metrics'; import { ElasticsearchResponse } from '../../../../common/types/es'; import { LegacyRequest } from '../../../types'; -import { getIndexPatterns, getElasticsearchDataset } from '../../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../../common/get_index_patterns'; import { Globals } from '../../../static_globals'; export function handleResponse(shardStats: any, indexUuid: string) { diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/indices/get_indices.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/indices/get_indices.ts index e11971ac4f8d1..6b40c8480603d 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/indices/get_indices.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/indices/get_indices.ts @@ -13,7 +13,7 @@ import { calculateRate } from '../../calculate_rate'; import { getUnassignedShards } from '../shards'; import { ElasticsearchResponse } from '../../../../common/types/es'; import { LegacyRequest } from '../../../types'; -import { getIndexPatterns, getElasticsearchDataset } from '../../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../../common/get_index_patterns'; import { Globals } from '../../../static_globals'; export function handleResponse( diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_node_summary.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_node_summary.ts index e210187ab7f90..c050f5fac52b2 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_node_summary.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_node_summary.ts @@ -17,7 +17,7 @@ import { ElasticsearchLegacySource, } from '../../../../common/types/es'; import { LegacyRequest } from '../../../types'; -import { getIndexPatterns, getElasticsearchDataset } from '../../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../../common/get_index_patterns'; import { Globals } from '../../../static_globals'; export function handleResponse( diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_node_ids.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_node_ids.ts index 27c458a4fbd28..968e5200d7040 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_node_ids.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_node_ids.ts @@ -10,7 +10,10 @@ import { get } from 'lodash'; import { ElasticsearchMetric } from '../../../metrics'; import { createQuery } from '../../../create_query'; import { LegacyRequest, Bucket } from '../../../../types'; -import { getIndexPatterns, getElasticsearchDataset } from '../../../cluster/get_index_patterns'; +import { + getIndexPatterns, + getElasticsearchDataset, +} from '../../../../../common/get_index_patterns'; import { Globals } from '../../../../static_globals'; export async function getNodeIds( diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_nodes.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_nodes.ts index 4308e60ed64a7..66004202df261 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_nodes.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_nodes.ts @@ -14,7 +14,10 @@ import { handleResponse } from './handle_response'; import { LISTING_METRICS_NAMES, LISTING_METRICS_PATHS } from './nodes_listing_metrics'; import { LegacyRequest } from '../../../../types'; import { ElasticsearchModifiedSource } from '../../../../../common/types/es'; -import { getIndexPatterns, getElasticsearchDataset } from '../../../cluster/get_index_patterns'; +import { + getIndexPatterns, + getElasticsearchDataset, +} from '../../../../../common/get_index_patterns'; import { Globals } from '../../../../static_globals'; /* Run an aggregation on node_stats to get stat data for the selected time diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_indices_unassigned_shard_stats.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_indices_unassigned_shard_stats.ts index 2d30159a4cab1..dd346cc279591 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_indices_unassigned_shard_stats.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_indices_unassigned_shard_stats.ts @@ -11,7 +11,7 @@ import { ElasticsearchMetric } from '../../metrics'; import { calculateIndicesTotals } from './calculate_shard_stat_indices_totals'; import { LegacyRequest } from '../../../types'; import { ElasticsearchModifiedSource } from '../../../../common/types/es'; -import { getIndexPatterns, getElasticsearchDataset } from '../../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../../common/get_index_patterns'; import { Globals } from '../../../static_globals'; async function getUnassignedShardData(req: LegacyRequest, cluster: ElasticsearchModifiedSource) { diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_nodes_shard_count.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_nodes_shard_count.ts index c0dd5c29b4f2f..c5be726403745 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_nodes_shard_count.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_nodes_shard_count.ts @@ -10,7 +10,7 @@ import { createQuery } from '../../create_query'; import { ElasticsearchMetric } from '../../metrics'; import { LegacyRequest } from '../../../types'; import { ElasticsearchModifiedSource } from '../../../../common/types/es'; -import { getIndexPatterns, getElasticsearchDataset } from '../../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../../common/get_index_patterns'; import { Globals } from '../../../static_globals'; async function getShardCountPerNode(req: LegacyRequest, cluster: ElasticsearchModifiedSource) { diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_allocation.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_allocation.ts index b4cb77f2a6c10..0aac81e202f0b 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_allocation.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_allocation.ts @@ -9,7 +9,7 @@ import { createQuery } from '../../create_query'; import { ElasticsearchMetric } from '../../metrics'; import { ElasticsearchResponse, ElasticsearchLegacySource } from '../../../../common/types/es'; import { LegacyRequest } from '../../../types'; -import { getIndexPatterns, getElasticsearchDataset } from '../../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../../common/get_index_patterns'; import { Globals } from '../../../static_globals'; export function handleResponse(response: ElasticsearchResponse) { diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_stats.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_stats.ts index d5af43e216834..717dc38814ae2 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_stats.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_stats.ts @@ -9,7 +9,7 @@ import { get } from 'lodash'; import { ElasticsearchModifiedSource, ElasticsearchResponse } from '../../../../common/types/es'; import { Globals } from '../../../static_globals'; import { LegacyRequest } from '../../../types'; -import { getIndexPatterns, getElasticsearchDataset } from '../../cluster/get_index_patterns'; +import { getIndexPatterns, getElasticsearchDataset } from '../../../../common/get_index_patterns'; import { createQuery } from '../../create_query'; import { ElasticsearchMetric } from '../../metrics'; import { calculateIndicesTotals } from './calculate_shard_stat_indices_totals'; diff --git a/x-pack/plugins/monitoring/server/lib/enterprise_search/create_enterprise_search_query.ts b/x-pack/plugins/monitoring/server/lib/enterprise_search/create_enterprise_search_query.ts index 4204166b4a381..ddda97decbdd9 100644 --- a/x-pack/plugins/monitoring/server/lib/enterprise_search/create_enterprise_search_query.ts +++ b/x-pack/plugins/monitoring/server/lib/enterprise_search/create_enterprise_search_query.ts @@ -8,7 +8,7 @@ import { EnterpriseSearchMetric, EnterpriseSearchMetricFields } from '../metrics'; import { createQuery } from '../create_query'; import { STANDALONE_CLUSTER_CLUSTER_UUID } from '../../../common/constants'; -import { getEntsearchDataset } from '../cluster/get_index_patterns'; +import { getEntsearchDataset } from '../../../common/get_index_patterns'; /** * {@code createQuery} for all Enterprise Search instances. diff --git a/x-pack/plugins/monitoring/server/lib/enterprise_search/get_enterprise_search_for_clusters.ts b/x-pack/plugins/monitoring/server/lib/enterprise_search/get_enterprise_search_for_clusters.ts index 0011c965c8654..89af39c7b04e3 100644 --- a/x-pack/plugins/monitoring/server/lib/enterprise_search/get_enterprise_search_for_clusters.ts +++ b/x-pack/plugins/monitoring/server/lib/enterprise_search/get_enterprise_search_for_clusters.ts @@ -9,7 +9,7 @@ import { TimeRange } from '../../../common/http_api/shared'; import { ElasticsearchResponse } from '../../../common/types/es'; import { Globals } from '../../static_globals'; import { Cluster, LegacyRequest } from '../../types'; -import { getIndexPatterns } from '../cluster/get_index_patterns'; +import { getIndexPatterns } from '../../../common/get_index_patterns'; import { EnterpriseSearchMetric } from '../metrics'; import { createEnterpriseSearchQuery } from './create_enterprise_search_query'; import { diff --git a/x-pack/plugins/monitoring/server/lib/enterprise_search/get_stats.ts b/x-pack/plugins/monitoring/server/lib/enterprise_search/get_stats.ts index 526e7ec919405..63c09d388b5de 100644 --- a/x-pack/plugins/monitoring/server/lib/enterprise_search/get_stats.ts +++ b/x-pack/plugins/monitoring/server/lib/enterprise_search/get_stats.ts @@ -10,7 +10,7 @@ import { TimeRange } from '../../../common/http_api/shared'; import { ElasticsearchResponse } from '../../../common/types/es'; import { Globals } from '../../static_globals'; import { LegacyRequest } from '../../types'; -import { getIndexPatterns } from '../cluster/get_index_patterns'; +import { getIndexPatterns } from '../../../common/get_index_patterns'; import { createEnterpriseSearchQuery } from './create_enterprise_search_query'; import { entSearchAggFilterPath, diff --git a/x-pack/plugins/monitoring/server/lib/kibana/get_kibana_info.ts b/x-pack/plugins/monitoring/server/lib/kibana/get_kibana_info.ts index 610a83d814289..4ab11001c8990 100644 --- a/x-pack/plugins/monitoring/server/lib/kibana/get_kibana_info.ts +++ b/x-pack/plugins/monitoring/server/lib/kibana/get_kibana_info.ts @@ -9,7 +9,7 @@ import { merge } from 'lodash'; import { ElasticsearchResponse } from '../../../common/types/es'; import { Globals } from '../../static_globals'; import { LegacyRequest } from '../../types'; -import { getIndexPatterns, getKibanaDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getKibanaDataset } from '../../../common/get_index_patterns'; import { MissingRequiredError } from '../error_missing_required'; import { buildKibanaInfo } from './build_kibana_info'; import { isKibanaStatusStale } from './is_kibana_status_stale'; diff --git a/x-pack/plugins/monitoring/server/lib/kibana/get_kibanas.ts b/x-pack/plugins/monitoring/server/lib/kibana/get_kibanas.ts index 9f45b0125b93a..4796a340aaa4c 100644 --- a/x-pack/plugins/monitoring/server/lib/kibana/get_kibanas.ts +++ b/x-pack/plugins/monitoring/server/lib/kibana/get_kibanas.ts @@ -9,7 +9,7 @@ import moment from 'moment'; import { ElasticsearchResponse, ElasticsearchResponseHit } from '../../../common/types/es'; import { Globals } from '../../static_globals'; import { LegacyRequest } from '../../types'; -import { getIndexPatterns, getKibanaDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getKibanaDataset } from '../../../common/get_index_patterns'; import { createQuery } from '../create_query'; import { KibanaMetric } from '../metrics'; import { buildKibanaInfo, KibanaInfo } from './build_kibana_info'; diff --git a/x-pack/plugins/monitoring/server/lib/kibana/get_kibanas_for_clusters.ts b/x-pack/plugins/monitoring/server/lib/kibana/get_kibanas_for_clusters.ts index f576fc4913f85..82da6c42c8f4f 100644 --- a/x-pack/plugins/monitoring/server/lib/kibana/get_kibanas_for_clusters.ts +++ b/x-pack/plugins/monitoring/server/lib/kibana/get_kibanas_for_clusters.ts @@ -8,7 +8,7 @@ import { chain, find } from 'lodash'; import { Globals } from '../../static_globals'; import { Bucket, Cluster, LegacyRequest } from '../../types'; -import { getIndexPatterns, getKibanaDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getKibanaDataset } from '../../../common/get_index_patterns'; import { createQuery } from '../create_query'; import { KibanaClusterMetric } from '../metrics'; import { isKibanaStatusStale } from './is_kibana_status_stale'; diff --git a/x-pack/plugins/monitoring/server/lib/kibana/rules/get_cluster_rule_data_for_clusters.ts b/x-pack/plugins/monitoring/server/lib/kibana/rules/get_cluster_rule_data_for_clusters.ts index 5151a44ad546d..7c4ee32cde9a8 100644 --- a/x-pack/plugins/monitoring/server/lib/kibana/rules/get_cluster_rule_data_for_clusters.ts +++ b/x-pack/plugins/monitoring/server/lib/kibana/rules/get_cluster_rule_data_for_clusters.ts @@ -5,7 +5,7 @@ * 2.0. */ import { Cluster, LegacyRequest } from '../../../types'; -import { getIndexPatterns, getKibanaDataset } from '../../cluster/get_index_patterns'; +import { getIndexPatterns, getKibanaDataset } from '../../../../common/get_index_patterns'; import { Globals } from '../../../static_globals'; import { createQuery } from '../../create_query'; import { KibanaClusterRuleMetric } from '../../metrics'; diff --git a/x-pack/plugins/monitoring/server/lib/kibana/rules/get_instance_rule_data_for_clusters.ts b/x-pack/plugins/monitoring/server/lib/kibana/rules/get_instance_rule_data_for_clusters.ts index 0e986f5f3d7fc..0de56533bf786 100644 --- a/x-pack/plugins/monitoring/server/lib/kibana/rules/get_instance_rule_data_for_clusters.ts +++ b/x-pack/plugins/monitoring/server/lib/kibana/rules/get_instance_rule_data_for_clusters.ts @@ -5,7 +5,7 @@ * 2.0. */ import { Cluster, LegacyRequest } from '../../../types'; -import { getIndexPatterns, getKibanaDataset } from '../../cluster/get_index_patterns'; +import { getIndexPatterns, getKibanaDataset } from '../../../../common/get_index_patterns'; import { Globals } from '../../../static_globals'; import { createQuery } from '../../create_query'; import { KibanaClusterRuleMetric } from '../../metrics'; diff --git a/x-pack/plugins/monitoring/server/lib/logs/init_log_view.ts b/x-pack/plugins/monitoring/server/lib/logs/init_log_view.ts deleted file mode 100644 index 52b0f43647386..0000000000000 --- a/x-pack/plugins/monitoring/server/lib/logs/init_log_view.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { LogsSharedPluginSetup } from '@kbn/logs-shared-plugin/server'; -import { CCS_REMOTE_PATTERN, INFRA_SOURCE_ID } from '../../../common/constants'; -import { MonitoringConfig } from '../../config'; -import { getIndexPatterns } from '../cluster/get_index_patterns'; - -export const initLogView = (config: MonitoringConfig, logsShared: LogsSharedPluginSetup) => { - if (logsShared) { - const logsIndexPattern = getIndexPatterns({ - config, - type: 'logs', - ccs: CCS_REMOTE_PATTERN, - }); - - logsShared.logViews.defineInternalLogView(INFRA_SOURCE_ID, { - name: 'Elastic Stack Logs', - logIndices: { - type: 'index_name', - indexName: logsIndexPattern, - }, - }); - } -}; diff --git a/x-pack/plugins/monitoring/server/lib/logstash/get_logstash_for_clusters.ts b/x-pack/plugins/monitoring/server/lib/logstash/get_logstash_for_clusters.ts index 7babdff3854b9..295f78803e678 100644 --- a/x-pack/plugins/monitoring/server/lib/logstash/get_logstash_for_clusters.ts +++ b/x-pack/plugins/monitoring/server/lib/logstash/get_logstash_for_clusters.ts @@ -10,7 +10,7 @@ import { LegacyRequest, Cluster, Bucket } from '../../types'; import { LOGSTASH } from '../../../common/constants'; import { createQuery } from '../create_query'; import { LogstashClusterMetric } from '../metrics'; -import { getIndexPatterns, getLogstashDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getLogstashDataset } from '../../../common/get_index_patterns'; import { Globals } from '../../static_globals'; const { MEMORY, PERSISTED } = LOGSTASH.QUEUE_TYPES; diff --git a/x-pack/plugins/monitoring/server/lib/logstash/get_node_info.ts b/x-pack/plugins/monitoring/server/lib/logstash/get_node_info.ts index ca54da09dce25..347085f162e7b 100644 --- a/x-pack/plugins/monitoring/server/lib/logstash/get_node_info.ts +++ b/x-pack/plugins/monitoring/server/lib/logstash/get_node_info.ts @@ -12,7 +12,7 @@ import { LegacyRequest } from '../../types'; import { ElasticsearchResponse } from '../../../common/types/es'; import { STANDALONE_CLUSTER_CLUSTER_UUID } from '../../../common/constants'; import { standaloneClusterFilter } from '../standalone_clusters/standalone_cluster_query_filter'; -import { getIndexPatterns } from '../cluster/get_index_patterns'; +import { getIndexPatterns } from '../../../common/get_index_patterns'; import { Globals } from '../../static_globals'; export function handleResponse(resp: ElasticsearchResponse) { diff --git a/x-pack/plugins/monitoring/server/lib/logstash/get_nodes.ts b/x-pack/plugins/monitoring/server/lib/logstash/get_nodes.ts index 0d10d87d961db..a153b43fb26c3 100644 --- a/x-pack/plugins/monitoring/server/lib/logstash/get_nodes.ts +++ b/x-pack/plugins/monitoring/server/lib/logstash/get_nodes.ts @@ -11,7 +11,7 @@ import { calculateAvailability } from '../calculate_availability'; import { LogstashMetric } from '../metrics'; import { LegacyRequest } from '../../types'; import { ElasticsearchResponse } from '../../../common/types/es'; -import { getIndexPatterns, getLogstashDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getLogstashDataset } from '../../../common/get_index_patterns'; import { Globals } from '../../static_globals'; interface Logstash { diff --git a/x-pack/plugins/monitoring/server/lib/logstash/get_paginated_pipelines.ts b/x-pack/plugins/monitoring/server/lib/logstash/get_paginated_pipelines.ts index 38f716cb35867..88950a207b9aa 100644 --- a/x-pack/plugins/monitoring/server/lib/logstash/get_paginated_pipelines.ts +++ b/x-pack/plugins/monitoring/server/lib/logstash/get_paginated_pipelines.ts @@ -11,7 +11,7 @@ import { getLogstashPipelineIds } from './get_pipeline_ids'; import { sortPipelines } from './sort_pipelines'; import { paginate } from '../pagination/paginate'; import { getMetrics } from '../details/get_metrics'; -import { getLogstashDataset } from '../cluster/get_index_patterns'; +import { getLogstashDataset } from '../../../common/get_index_patterns'; import { LegacyRequest, Pipeline, diff --git a/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_ids.ts b/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_ids.ts index 59473977dc947..348b1c1bb61cd 100644 --- a/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_ids.ts +++ b/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_ids.ts @@ -10,7 +10,7 @@ import { get } from 'lodash'; import { LegacyRequest, Bucket, Pipeline } from '../../types'; import { createQuery } from '../create_query'; import { LogstashMetric } from '../metrics'; -import { getIndexPatterns } from '../cluster/get_index_patterns'; +import { getIndexPatterns } from '../../../common/get_index_patterns'; import { Globals } from '../../static_globals'; interface GetLogstashPipelineIdsParams { diff --git a/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_state_document.ts b/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_state_document.ts index be1612cfb4af9..01aa42e79873a 100644 --- a/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_state_document.ts +++ b/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_state_document.ts @@ -9,7 +9,7 @@ import { createQuery } from '../create_query'; import { LogstashMetric } from '../metrics'; import { LegacyRequest, PipelineVersion } from '../../types'; import { ElasticsearchResponse } from '../../../common/types/es'; -import { getIndexPatterns, getLogstashDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getLogstashDataset } from '../../../common/get_index_patterns'; import { Globals } from '../../static_globals'; export async function getPipelineStateDocument({ diff --git a/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_stats_aggregation.ts b/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_stats_aggregation.ts index 56785a4eee211..a76eb3b870317 100644 --- a/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_stats_aggregation.ts +++ b/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_stats_aggregation.ts @@ -10,7 +10,7 @@ import { PostLogstashPipelineRequestPayload, } from '../../../common/http_api/logstash'; import { LegacyRequest, PipelineVersion } from '../../types'; -import { getIndexPatterns, getLogstashDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getLogstashDataset } from '../../../common/get_index_patterns'; import { createQuery } from '../create_query'; import { LogstashMetric } from '../metrics'; import { Globals } from '../../static_globals'; diff --git a/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_versions.ts b/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_versions.ts index 2f464c050694a..ceddc6ec46951 100644 --- a/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_versions.ts +++ b/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_versions.ts @@ -8,7 +8,7 @@ import { get, orderBy } from 'lodash'; import { createQuery } from '../create_query'; import { LogstashMetric } from '../metrics'; -import { getIndexPatterns, getLogstashDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getLogstashDataset } from '../../../common/get_index_patterns'; import { Globals } from '../../static_globals'; import { LegacyRequest, PipelineVersion } from '../../types'; import { mergePipelineVersions } from './merge_pipeline_versions'; diff --git a/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_vertex_stats_aggregation.ts b/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_vertex_stats_aggregation.ts index 52c738806c1ea..6b2758392ac69 100644 --- a/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_vertex_stats_aggregation.ts +++ b/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_vertex_stats_aggregation.ts @@ -10,7 +10,7 @@ import { PostLogstashPipelineRequestPayload, } from '../../../common/http_api/logstash'; import { LegacyRequest, PipelineVersion } from '../../types'; -import { getIndexPatterns, getLogstashDataset } from '../cluster/get_index_patterns'; +import { getIndexPatterns, getLogstashDataset } from '../../../common/get_index_patterns'; import { createQuery } from '../create_query'; import { LogstashMetric } from '../metrics'; import { Globals } from '../../static_globals'; diff --git a/x-pack/plugins/monitoring/server/lib/setup/collection/get_collection_status.test.ts b/x-pack/plugins/monitoring/server/lib/setup/collection/get_collection_status.test.ts index e7ffe701fbd1a..b743e0300aef6 100644 --- a/x-pack/plugins/monitoring/server/lib/setup/collection/get_collection_status.test.ts +++ b/x-pack/plugins/monitoring/server/lib/setup/collection/get_collection_status.test.ts @@ -7,7 +7,6 @@ import { featuresPluginMock } from '@kbn/features-plugin/server/mocks'; import { infraPluginMock } from '@kbn/infra-plugin/server/mocks'; -import { logsSharedPluginMock } from '@kbn/logs-shared-plugin/server/mocks'; import { loggerMock } from '@kbn/logging-mocks'; import { usageCollectionPluginMock } from '@kbn/usage-collection-plugin/server/mocks'; import { configSchema, createConfig } from '../../../config'; @@ -39,7 +38,6 @@ const mockReq = ( usageCollection: usageCollectionSetup, features: featuresPluginMock.createSetup(), infra: infraPluginMock.createSetupContract(), - logsShared: logsSharedPluginMock.createSetupContract(), }, }, }, diff --git a/x-pack/plugins/monitoring/server/lib/setup/collection/get_collection_status.ts b/x-pack/plugins/monitoring/server/lib/setup/collection/get_collection_status.ts index 6d800e83c2d7c..41313bfb347a2 100644 --- a/x-pack/plugins/monitoring/server/lib/setup/collection/get_collection_status.ts +++ b/x-pack/plugins/monitoring/server/lib/setup/collection/get_collection_status.ts @@ -14,7 +14,7 @@ import { } from '../../../../common/constants'; import { TimeRange } from '../../../../common/http_api/shared'; import { LegacyRequest } from '../../../types'; -import { getLegacyIndexPattern } from '../../cluster/get_index_patterns'; +import { getLegacyIndexPattern } from '../../../../common/get_index_patterns'; import { getLivesNodes } from '../../elasticsearch/nodes/get_nodes/get_live_nodes'; interface Bucket { diff --git a/x-pack/plugins/monitoring/server/lib/standalone_clusters/has_standalone_clusters.ts b/x-pack/plugins/monitoring/server/lib/standalone_clusters/has_standalone_clusters.ts index 042340eb0669c..d9ec794dd7606 100644 --- a/x-pack/plugins/monitoring/server/lib/standalone_clusters/has_standalone_clusters.ts +++ b/x-pack/plugins/monitoring/server/lib/standalone_clusters/has_standalone_clusters.ts @@ -14,7 +14,7 @@ import { getIndexPatterns, getLogstashDataset, getBeatDataset, -} from '../cluster/get_index_patterns'; +} from '../../../common/get_index_patterns'; export async function hasStandaloneClusters(req: LegacyRequest, ccs: string) { const lsIndexPatterns = getIndexPatterns({ diff --git a/x-pack/plugins/monitoring/server/plugin.ts b/x-pack/plugins/monitoring/server/plugin.ts index 72063805b3383..0a7460457854e 100644 --- a/x-pack/plugins/monitoring/server/plugin.ts +++ b/x-pack/plugins/monitoring/server/plugin.ts @@ -36,7 +36,6 @@ import { configSchema, createConfig, MonitoringConfig } from './config'; import { instantiateClient } from './es_client/instantiate_client'; import { initBulkUploader } from './kibana_monitoring'; import { registerCollectors } from './kibana_monitoring/collectors'; -import { initLogView } from './lib/logs/init_log_view'; import { LicenseService } from './license_service'; import { requireUIRoutes } from './routes'; import { EndpointTypes, Globals } from './static_globals'; @@ -203,7 +202,6 @@ export class MonitoringPlugin alerting: plugins.alerting, logger: this.log, }); - initLogView(config, plugins.logsShared); } } diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/_health/index.ts b/x-pack/plugins/monitoring/server/routes/api/v1/_health/index.ts index 5ed5b85168ee2..7b0c07fef8df3 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/_health/index.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/_health/index.ts @@ -8,7 +8,7 @@ import type { LegacyRequest, MonitoringCore } from '../../../../types'; import type { MonitoringConfig } from '../../../../config'; import { createValidationFunction } from '../../../../lib/create_route_validation_function'; -import { getIndexPatterns, getDsIndexPattern } from '../../../../lib/cluster/get_index_patterns'; +import { getIndexPatterns, getDsIndexPattern } from '../../../../../common/get_index_patterns'; import { getHealthRequestQueryRT } from '../../../../../common/http_api/_health'; import type { TimeRange } from '../../../../../common/http_api/shared'; diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/_health/monitored_clusters/monitored_clusters_query.ts b/x-pack/plugins/monitoring/server/routes/api/v1/_health/monitored_clusters/monitored_clusters_query.ts index dac9d6b59ca1a..0935b76e7fba9 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/_health/monitored_clusters/monitored_clusters_query.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/_health/monitored_clusters/monitored_clusters_query.ts @@ -12,7 +12,7 @@ import { getKibanaDataset, getLogstashDataset, getEntsearchDataset, -} from '../../../../../lib/cluster/get_index_patterns'; +} from '../../../../../../common/get_index_patterns'; const MAX_BUCKET_SIZE = 100; diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/apm/instance.ts b/x-pack/plugins/monitoring/server/routes/api/v1/apm/instance.ts index 8c8d7e0ad2c69..3e4d903ec8af2 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/apm/instance.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/apm/instance.ts @@ -14,7 +14,7 @@ import { getApmInfo } from '../../../../lib/apm'; import { createValidationFunction } from '../../../../lib/create_route_validation_function'; import { getMetrics } from '../../../../lib/details/get_metrics'; import { handleError } from '../../../../lib/errors'; -import { getIndexPatterns } from '../../../../lib/cluster/get_index_patterns'; +import { getIndexPatterns } from '../../../../../common/get_index_patterns'; import { MonitoringCore } from '../../../../types'; import { metricSet } from './metric_set_instance'; diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/apm/instances.ts b/x-pack/plugins/monitoring/server/routes/api/v1/apm/instances.ts index bb8086867ed05..1b19d49007794 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/apm/instances.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/apm/instances.ts @@ -13,7 +13,7 @@ import { import { getApms, getStats } from '../../../../lib/apm'; import { createValidationFunction } from '../../../../lib/create_route_validation_function'; import { handleError } from '../../../../lib/errors'; -import { getIndexPatterns } from '../../../../lib/cluster/get_index_patterns'; +import { getIndexPatterns } from '../../../../../common/get_index_patterns'; import { MonitoringCore } from '../../../../types'; export function apmInstancesRoute(server: MonitoringCore) { diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/beats/beat_detail.ts b/x-pack/plugins/monitoring/server/routes/api/v1/beats/beat_detail.ts index 30ef661feb0f4..a248df56f9e2a 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/beats/beat_detail.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/beats/beat_detail.ts @@ -14,7 +14,7 @@ import { getBeatSummary } from '../../../../lib/beats'; import { createValidationFunction } from '../../../../lib/create_route_validation_function'; import { getMetrics } from '../../../../lib/details/get_metrics'; import { handleError } from '../../../../lib/errors'; -import { getIndexPatterns } from '../../../../lib/cluster/get_index_patterns'; +import { getIndexPatterns } from '../../../../../common/get_index_patterns'; import { MonitoringCore } from '../../../../types'; import { metricSet } from './metric_set_detail'; diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/beats/beats.ts b/x-pack/plugins/monitoring/server/routes/api/v1/beats/beats.ts index b59cec2898617..96433d756e8ae 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/beats/beats.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/beats/beats.ts @@ -13,7 +13,7 @@ import { import { getBeats, getStats } from '../../../../lib/beats'; import { createValidationFunction } from '../../../../lib/create_route_validation_function'; import { handleError } from '../../../../lib/errors'; -import { getIndexPatterns } from '../../../../lib/cluster/get_index_patterns'; +import { getIndexPatterns } from '../../../../../common/get_index_patterns'; import { MonitoringCore } from '../../../../types'; export function beatsListingRoute(server: MonitoringCore) { diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/beats/overview.ts b/x-pack/plugins/monitoring/server/routes/api/v1/beats/overview.ts index cbdc28ebf4f9b..6c79a56a57412 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/beats/overview.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/beats/overview.ts @@ -14,7 +14,7 @@ import { getLatestStats, getStats } from '../../../../lib/beats'; import { createValidationFunction } from '../../../../lib/create_route_validation_function'; import { getMetrics } from '../../../../lib/details/get_metrics'; import { handleError } from '../../../../lib/errors'; -import { getIndexPatterns } from '../../../../lib/cluster/get_index_patterns'; +import { getIndexPatterns } from '../../../../../common/get_index_patterns'; import { MonitoringCore } from '../../../../types'; import { metricSet } from './metric_set_overview'; diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr.ts b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr.ts index 7c939407ef156..03f9fff6bc943 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr.ts @@ -9,7 +9,7 @@ import { get, groupBy } from 'lodash'; import { getIndexPatterns, getElasticsearchDataset, -} from '../../../../lib/cluster/get_index_patterns'; +} from '../../../../../common/get_index_patterns'; import { postElasticsearchCcrRequestParamsRT, postElasticsearchCcrRequestPayloadRT, diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr_shard.ts b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr_shard.ts index 3e215aaf67e35..b02ba1e455bce 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr_shard.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr_shard.ts @@ -15,7 +15,7 @@ import { ElasticsearchResponse } from '../../../../../common/types/es'; import { getIndexPatterns, getElasticsearchDataset, -} from '../../../../lib/cluster/get_index_patterns'; +} from '../../../../../common/get_index_patterns'; import { createValidationFunction } from '../../../../lib/create_route_validation_function'; import { getMetrics } from '../../../../lib/details/get_metrics'; import { handleError } from '../../../../lib/errors/handle_error'; diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/index_detail.ts b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/index_detail.ts index 9aed104920e83..e96fb9dbad629 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/index_detail.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/index_detail.ts @@ -13,7 +13,7 @@ import { postElasticsearchIndexDetailResponsePayloadRT, } from '../../../../../common/http_api/elasticsearch'; import { getClusterStats } from '../../../../lib/cluster/get_cluster_stats'; -import { getIndexPatterns } from '../../../../lib/cluster/get_index_patterns'; +import { getIndexPatterns } from '../../../../../common/get_index_patterns'; import { createValidationFunction } from '../../../../lib/create_route_validation_function'; import { getMetrics } from '../../../../lib/details/get_metrics'; import { getIndexSummary } from '../../../../lib/elasticsearch/indices'; diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/node_detail.ts b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/node_detail.ts index 763f8005abc93..05406a2d001e6 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/node_detail.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/node_detail.ts @@ -14,7 +14,7 @@ import { postElasticsearchNodeDetailResponsePayloadRT, } from '../../../../../common/http_api/elasticsearch'; import { getClusterStats } from '../../../../lib/cluster/get_cluster_stats'; -import { getIndexPatterns } from '../../../../lib/cluster/get_index_patterns'; +import { getIndexPatterns } from '../../../../../common/get_index_patterns'; import { createValidationFunction } from '../../../../lib/create_route_validation_function'; import { getMetrics, diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/overview.ts b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/overview.ts index 0b97f9ea63363..269a924648a61 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/overview.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/overview.ts @@ -13,7 +13,7 @@ import { } from '../../../../../common/http_api/elasticsearch'; import { getClusterStats } from '../../../../lib/cluster/get_cluster_stats'; import { getClusterStatus } from '../../../../lib/cluster/get_cluster_status'; -import { getIndexPatterns } from '../../../../lib/cluster/get_index_patterns'; +import { getIndexPatterns } from '../../../../../common/get_index_patterns'; import { createValidationFunction } from '../../../../lib/create_route_validation_function'; import { getMetrics } from '../../../../lib/details/get_metrics'; import { getLastRecovery } from '../../../../lib/elasticsearch/get_last_recovery'; diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/kibana/overview.ts b/x-pack/plugins/monitoring/server/routes/api/v1/kibana/overview.ts index f398a1bda59d7..135fa58e3d28b 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/kibana/overview.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/kibana/overview.ts @@ -16,7 +16,7 @@ import { } from '../../../../../common/http_api/kibana'; import { createValidationFunction } from '../../../../lib/create_route_validation_function'; import { MonitoringCore } from '../../../../types'; -import { getKibanaDataset } from '../../../../lib/cluster/get_index_patterns'; +import { getKibanaDataset } from '../../../../../common/get_index_patterns'; export function kibanaOverviewRoute(server: MonitoringCore) { const validateParams = createValidationFunction(postKibanaOverviewRequestParamsRT); diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/logstash/node.ts b/x-pack/plugins/monitoring/server/routes/api/v1/logstash/node.ts index 5c7bbc36b168c..e6b2034ca22cd 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/logstash/node.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/logstash/node.ts @@ -19,7 +19,7 @@ import { import { metricSets } from './metric_set_node'; import { MonitoringCore } from '../../../../types'; import { createValidationFunction } from '../../../../lib/create_route_validation_function'; -import { getLogstashDataset } from '../../../../lib/cluster/get_index_patterns'; +import { getLogstashDataset } from '../../../../../common/get_index_patterns'; const { advanced: metricSetAdvanced, overview: metricSetOverview } = metricSets; diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/logstash/overview.ts b/x-pack/plugins/monitoring/server/routes/api/v1/logstash/overview.ts index 26d63693fd6dd..15661a130055d 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/logstash/overview.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/logstash/overview.ts @@ -15,7 +15,7 @@ import { handleError } from '../../../../lib/errors'; import { metricSet } from './metric_set_overview'; import { MonitoringCore } from '../../../../types'; import { createValidationFunction } from '../../../../lib/create_route_validation_function'; -import { getLogstashDataset } from '../../../../lib/cluster/get_index_patterns'; +import { getLogstashDataset } from '../../../../../common/get_index_patterns'; export function logstashOverviewRoute(server: MonitoringCore) { const validateParams = createValidationFunction(postLogstashOverviewRequestParamsRT); diff --git a/x-pack/plugins/monitoring/server/types.ts b/x-pack/plugins/monitoring/server/types.ts index 06c796764b5f7..95707caf50199 100644 --- a/x-pack/plugins/monitoring/server/types.ts +++ b/x-pack/plugins/monitoring/server/types.ts @@ -35,7 +35,6 @@ import { FeaturesPluginSetup } from '@kbn/features-plugin/server'; import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; import { CloudSetup } from '@kbn/cloud-plugin/server'; import { RouteConfig, RouteMethod, Headers } from '@kbn/core/server'; -import { LogsSharedPluginSetup } from '@kbn/logs-shared-plugin/server'; import { ElasticsearchModifiedSource } from '../common/types/es'; import { RulesByType } from '../common/types/alerts'; import { configSchema, MonitoringConfig } from './config'; @@ -57,7 +56,6 @@ export interface PluginsSetup { alerting?: AlertingPluginSetupContract; infra: InfraPluginSetup; cloud?: CloudSetup; - logsShared: LogsSharedPluginSetup; } export type RequestHandlerContextMonitoringPlugin = CustomRequestHandlerContext<{ diff --git a/x-pack/plugins/monitoring/tsconfig.json b/x-pack/plugins/monitoring/tsconfig.json index 29467783ffb89..2a8c567cf969e 100644 --- a/x-pack/plugins/monitoring/tsconfig.json +++ b/x-pack/plugins/monitoring/tsconfig.json @@ -41,7 +41,6 @@ "@kbn/shared-ux-router", "@kbn/observability-shared-plugin", "@kbn/shared-ux-link-redirect-app", - "@kbn/logs-shared-plugin", "@kbn/alerts-as-data-utils", "@kbn/rule-data-utils", "@kbn/react-kibana-mount",