Skip to content

Commit

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

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. #65045
2. The Webhooks simulator due to a lack of support for custom authorisation. Requires investigation.
  • Loading branch information
gmmorris committed May 6, 2020
1 parent 8483574 commit 94127d8
Show file tree
Hide file tree
Showing 67 changed files with 1,964 additions and 1,760 deletions.
16 changes: 16 additions & 0 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,14 @@
'@types/podium',
],
},
{
groupSlug: 'pretty-ms',
groupName: 'pretty-ms related packages',
packageNames: [
'pretty-ms',
'@types/pretty-ms',
],
},
{
groupSlug: 'proper-lockfile',
groupName: 'proper-lockfile related packages',
Expand Down Expand Up @@ -864,6 +872,14 @@
'@types/sinon',
],
},
{
groupSlug: 'stats-lite',
groupName: 'stats-lite related packages',
packageNames: [
'stats-lite',
'@types/stats-lite',
],
},
{
groupSlug: 'storybook',
groupName: 'storybook related packages',
Expand Down
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 @@ -12,7 +12,6 @@ import { dashboardMode } from './legacy/plugins/dashboard_mode';
import { beats } from './legacy/plugins/beats_management';
import { maps } from './legacy/plugins/maps';
import { spaces } from './legacy/plugins/spaces';
import { taskManager } from './legacy/plugins/task_manager';
import { encryptedSavedObjects } from './legacy/plugins/encrypted_saved_objects';
import { ingestManager } from './legacy/plugins/ingest_manager';

Expand All @@ -26,7 +25,6 @@ module.exports = function(kibana) {
dashboardMode(kibana),
beats(kibana),
maps(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 94127d8

Please sign in to comment.