Skip to content

Commit

Permalink
[Alerting] migrates acceptance and functional test fixtures to KP (el…
Browse files Browse the repository at this point in the history
…astic#64888)

This PR migrates the vast majority of Alerting legacy code to the Kibana Platform.

This includes:

1. Removed legacy Task Manager
2. Migrates Fixture plugins in Alerting, Triggers UI and Task Manager Perf

This does not includes:

1. The PagerDuty simulator due to a lack of support for custom responses in the platform. issue opened. elastic#65045
2. The Webhooks simulator due to a lack of support for custom authorisation. Requires investigation.
# Conflicts:
#	renovate.json5
#	x-pack/index.js
  • Loading branch information
gmmorris committed May 6, 2020
1 parent a2a9426 commit e9026ec
Show file tree
Hide file tree
Showing 66 changed files with 1,948 additions and 1,760 deletions.
2 changes: 2 additions & 0 deletions test/scripts/jenkins_xpack_build_kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ echo " -> building kibana platform plugins"
node scripts/build_kibana_platform_plugins \
--scan-dir "$XPACK_DIR/test/plugin_functional/plugins" \
--scan-dir "$XPACK_DIR/test/functional_with_es_ssl/fixtures/plugins" \
--scan-dir "$XPACK_DIR/test/alerting_api_integration/plugins" \
--scan-dir "$XPACK_DIR/test/plugin_api_integration/plugins" \
--scan-dir "$XPACK_DIR/test/plugin_api_perf/plugins" \
--verbose;

# doesn't persist, also set in kibanaPipeline.groovy
Expand Down
2 changes: 0 additions & 2 deletions x-pack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { beats } from './legacy/plugins/beats_management';
import { maps } from './legacy/plugins/maps';
import { spaces } from './legacy/plugins/spaces';
import { infra } from './legacy/plugins/infra';
import { taskManager } from './legacy/plugins/task_manager';
import { encryptedSavedObjects } from './legacy/plugins/encrypted_saved_objects';
import { ingestManager } from './legacy/plugins/ingest_manager';

Expand All @@ -28,7 +27,6 @@ module.exports = function(kibana) {
beats(kibana),
maps(kibana),
infra(kibana),
taskManager(kibana),
encryptedSavedObjects(kibana),
ingestManager(kibana),
];
Expand Down
66 changes: 0 additions & 66 deletions x-pack/legacy/plugins/task_manager/server/index.ts

This file was deleted.

58 changes: 0 additions & 58 deletions x-pack/legacy/plugins/task_manager/server/legacy.ts

This file was deleted.

2 changes: 2 additions & 0 deletions x-pack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@
"@types/uuid": "^3.4.4",
"@types/xml-crypto": "^1.4.0",
"@types/xml2js": "^0.4.5",
"@types/stats-lite": "^2.2.0",
"@types/pretty-ms": "^5.0.0",
"@welldone-software/why-did-you-render": "^4.0.0",
"abab": "^1.0.4",
"axios": "^0.19.0",
Expand Down
14 changes: 7 additions & 7 deletions x-pack/plugins/actions/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ export class ActionsPlugin implements Plugin<Promise<PluginSetupContract>, Plugi

const usageCollection = plugins.usageCollection;
if (usageCollection) {
initializeActionsTelemetry(
this.telemetryLogger,
plugins.taskManager,
core,
await this.kibanaIndex
);

core.getStartServices().then(async ([, startPlugins]) => {
registerActionsUsageCollector(usageCollection, startPlugins.taskManager);

initializeActionsTelemetry(
this.telemetryLogger,
plugins.taskManager,
core,
await this.kibanaIndex
);
});
}

Expand Down
14 changes: 7 additions & 7 deletions x-pack/plugins/alerting/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,15 @@ export class AlertingPlugin {

const usageCollection = plugins.usageCollection;
if (usageCollection) {
initializeAlertingTelemetry(
this.telemetryLogger,
core,
plugins.taskManager,
await this.kibanaIndex
);

core.getStartServices().then(async ([, startPlugins]) => {
registerAlertsUsageCollector(usageCollection, startPlugins.taskManager);

initializeAlertingTelemetry(
this.telemetryLogger,
core,
plugins.taskManager,
await this.kibanaIndex
);
});
}

Expand Down
30 changes: 15 additions & 15 deletions x-pack/plugins/apm/server/lib/apm_telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ export async function createApmTelemetry({
taskManager: TaskManagerSetupContract;
logger: Logger;
}) {
taskManager.registerTaskDefinitions({
[APM_TELEMETRY_TASK_NAME]: {
title: 'Collect APM telemetry',
type: APM_TELEMETRY_TASK_NAME,
createTaskRunner: () => {
return {
run: async () => {
await collectAndStore();
},
cancel: async () => {}
};
}
}
});

const savedObjectsClient = await getInternalSavedObjectsClient(core);

const collectAndStore = async () => {
Expand Down Expand Up @@ -79,21 +94,6 @@ export async function createApmTelemetry({
);
};

taskManager.registerTaskDefinitions({
[APM_TELEMETRY_TASK_NAME]: {
title: 'Collect APM telemetry',
type: APM_TELEMETRY_TASK_NAME,
createTaskRunner: () => {
return {
run: async () => {
await collectAndStore();
},
cancel: async () => {}
};
}
}
});

const collector = usageCollector.makeUsageCollector({
type: 'apm',
fetch: async () => {
Expand Down
62 changes: 0 additions & 62 deletions x-pack/plugins/task_manager/server/create_task_manager.test.ts

This file was deleted.

43 changes: 0 additions & 43 deletions x-pack/plugins/task_manager/server/create_task_manager.ts

This file was deleted.

1 change: 0 additions & 1 deletion x-pack/plugins/task_manager/server/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { TaskManagerSetupContract, TaskManagerStartContract } from './plugin';

const createSetupMock = () => {
const mock: jest.Mocked<TaskManagerSetupContract> = {
registerLegacyAPI: jest.fn(),
addMiddleware: jest.fn(),
registerTaskDefinitions: jest.fn(),
};
Expand Down
Loading

0 comments on commit e9026ec

Please sign in to comment.