Skip to content

Commit

Permalink
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
Browse files Browse the repository at this point in the history
…fix'
  • Loading branch information
kibanamachine authored and crespocarlos committed Nov 14, 2024
1 parent c7fa02a commit 7454b48
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export type {
APMEventESSearchRequest,
APMLogEventESSearchRequest,
DocumentSourcesRequest,
ApmDataAccessPrivilegesCheck,
HostNamesRequest,
GetDocumentTypeParams,
} from './types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -29,7 +18,6 @@ import { getServices } from './services/get_services';
export class ApmDataAccessPlugin
implements Plugin<ApmDataAccessPluginSetup, ApmDataAccessPluginStart>
{
public server?: ApmDataAccessServerDependencies;
public config: APMDataAccessConfig;
public logger: Logger;

Expand All @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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<typeof getServices>;
export type { ApmDataAccessServicesParams } from './services/get_services';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 7454b48

Please sign in to comment.