diff --git a/x-pack/plugins/observability_solution/apm_data_access/server/index.ts b/x-pack/plugins/observability_solution/apm_data_access/server/index.ts index 6b6385ded4ce4..7afaa656591c4 100644 --- a/x-pack/plugins/observability_solution/apm_data_access/server/index.ts +++ b/x-pack/plugins/observability_solution/apm_data_access/server/index.ts @@ -91,7 +91,6 @@ export type { APMEventESSearchRequest, APMLogEventESSearchRequest, DocumentSourcesRequest, - ApmDataAccessPrivilegesCheck, HostNamesRequest, GetDocumentTypeParams, } from './types'; diff --git a/x-pack/plugins/observability_solution/apm_data_access/server/plugin.ts b/x-pack/plugins/observability_solution/apm_data_access/server/plugin.ts index 53fb9d51927e1..6bf684985583a 100644 --- a/x-pack/plugins/observability_solution/apm_data_access/server/plugin.ts +++ b/x-pack/plugins/observability_solution/apm_data_access/server/plugin.ts @@ -5,20 +5,9 @@ * 2.0. */ -import { - PluginInitializerContext, - CoreSetup, - CoreStart, - Plugin, - SavedObjectsClientContract, - Logger, -} from '@kbn/core/server'; +import { PluginInitializerContext, CoreSetup, CoreStart, Plugin, Logger } from '@kbn/core/server'; import { APMDataAccessConfig } from '.'; -import { - ApmDataAccessPluginSetup, - ApmDataAccessPluginStart, - ApmDataAccessServerDependencies, -} from './types'; +import { ApmDataAccessPluginSetup, ApmDataAccessPluginStart } from './types'; import { migrateLegacyAPMIndicesToSpaceAware } from './saved_objects/migrations/migrate_legacy_apm_indices_to_space_aware'; import { apmIndicesSavedObjectDefinition, @@ -29,7 +18,6 @@ import { getServices } from './services/get_services'; export class ApmDataAccessPlugin implements Plugin { - public server?: ApmDataAccessServerDependencies; public config: APMDataAccessConfig; public logger: Logger; @@ -38,31 +26,27 @@ export class ApmDataAccessPlugin this.logger = initContext.logger.get(); } - getApmIndices = async (savedObjectsClient: SavedObjectsClientContract) => { - const apmIndicesFromSavedObject = await getApmIndicesSavedObject(savedObjectsClient); - return { ...this.config.indices, ...apmIndicesFromSavedObject }; - }; - public setup(core: CoreSetup): ApmDataAccessPluginSetup { // register saved object core.savedObjects.registerType(apmIndicesSavedObjectDefinition); - const getApmIndicesWithInternalUserFn = async () => { + const getApmIndices = async () => { const [coreStart] = await core.getStartServices(); const soClient = await coreStart.savedObjects.createInternalRepository(); - return this.getApmIndices(soClient); + const apmIndicesFromSavedObject = await getApmIndicesSavedObject(soClient); + return { ...this.config.indices, ...apmIndicesFromSavedObject }; }; // expose return { apmIndicesFromConfigFile: this.config.indices, - getApmIndices: getApmIndicesWithInternalUserFn, + getApmIndices, getServices, }; } - public start(core: CoreStart, plugins: ApmDataAccessServerDependencies) { + public start(core: CoreStart) { // TODO: remove in 9.0 migrateLegacyAPMIndicesToSpaceAware({ coreStart: core, logger: this.logger }).catch((e) => { this.logger.error('Failed to run migration making APM indices space aware'); diff --git a/x-pack/plugins/observability_solution/apm_data_access/server/types.ts b/x-pack/plugins/observability_solution/apm_data_access/server/types.ts index d96468e70d976..968590e780ee8 100644 --- a/x-pack/plugins/observability_solution/apm_data_access/server/types.ts +++ b/x-pack/plugins/observability_solution/apm_data_access/server/types.ts @@ -5,7 +5,6 @@ * 2.0. */ -import type { SecurityPluginStart } from '@kbn/security-plugin-types-server'; import type { APMIndices } from '.'; import { getServices } from './services/get_services'; @@ -15,15 +14,8 @@ export interface ApmDataAccessPluginSetup { getServices: typeof getServices; } -export interface ApmDataAccessServerDependencies { - security?: SecurityPluginStart; -} - // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface ApmDataAccessPluginStart {} -export interface ApmDataAccessServerDependencies { - security?: SecurityPluginStart; -} export type ApmDataAccessServices = ReturnType; export type { ApmDataAccessServicesParams } from './services/get_services'; diff --git a/x-pack/plugins/observability_solution/apm_data_access/tsconfig.json b/x-pack/plugins/observability_solution/apm_data_access/tsconfig.json index f6d42de544775..60ea9e7010abd 100644 --- a/x-pack/plugins/observability_solution/apm_data_access/tsconfig.json +++ b/x-pack/plugins/observability_solution/apm_data_access/tsconfig.json @@ -9,7 +9,6 @@ "@kbn/config-schema", "@kbn/core", "@kbn/i18n", - "@kbn/core-saved-objects-api-server", "@kbn/data-plugin", "@kbn/inspector-plugin", "@kbn/observability-plugin", diff --git a/x-pack/plugins/observability_solution/infra/server/routes/infra/lib/host/get_hosts_count.ts b/x-pack/plugins/observability_solution/infra/server/routes/infra/lib/host/get_hosts_count.ts index a7e91955d5290..e36811ea5b87a 100644 --- a/x-pack/plugins/observability_solution/infra/server/routes/infra/lib/host/get_hosts_count.ts +++ b/x-pack/plugins/observability_solution/infra/server/routes/infra/lib/host/get_hosts_count.ts @@ -44,7 +44,8 @@ export async function getHostsCount({ track_total_hits: false, query: { bool: { - filter: [query, ...rangeQuery(from, to), ...documentsFilter], + filter: [query, ...rangeQuery(from, to)], + must: [...documentsFilter], }, }, aggs: {