Skip to content

Commit

Permalink
[APM] Pulls legacy ML code from service maps and integrations (#69779)
Browse files Browse the repository at this point in the history
* Pulls out existing ML integration from the service maps

* - removes ML job creation flyout in integrations menu on the service details UI
- removes ML searches and transforms in the transaction charts API
- removes unused shared functions and types related to the legacy ML integration

* removes unused translations for APM anomaly detection

* Adds tags to TODOs for easy searching later
  • Loading branch information
ogupte committed Jun 24, 2020
1 parent 14f975c commit e3598cb
Show file tree
Hide file tree
Showing 35 changed files with 57 additions and 2,473 deletions.
38 changes: 1 addition & 37 deletions x-pack/plugins/apm/common/ml_job_constants.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/

import {
getMlJobId,
getMlPrefix,
getMlJobServiceName,
getSeverity,
severity,
} from './ml_job_constants';
import { getSeverity, severity } from './ml_job_constants';

describe('ml_job_constants', () => {
it('getMlPrefix', () => {
expect(getMlPrefix('myServiceName')).toBe('myservicename-');
expect(getMlPrefix('myServiceName', 'myTransactionType')).toBe(
'myservicename-mytransactiontype-'
);
});

it('getMlJobId', () => {
expect(getMlJobId('myServiceName')).toBe(
'myservicename-high_mean_response_time'
);
expect(getMlJobId('myServiceName', 'myTransactionType')).toBe(
'myservicename-mytransactiontype-high_mean_response_time'
);
expect(getMlJobId('my service name')).toBe(
'my_service_name-high_mean_response_time'
);
expect(getMlJobId('my service name', 'my transaction type')).toBe(
'my_service_name-my_transaction_type-high_mean_response_time'
);
});

describe('getMlJobServiceName', () => {
it('extracts the service name from a job id', () => {
expect(
getMlJobServiceName('opbeans-node-request-high_mean_response_time')
).toEqual('opbeans-node');
});
});

describe('getSeverity', () => {
describe('when score is undefined', () => {
it('returns undefined', () => {
Expand Down
19 changes: 0 additions & 19 deletions x-pack/plugins/apm/common/ml_job_constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,6 @@ export enum severity {
warning = 'warning',
}

export const APM_ML_JOB_GROUP_NAME = 'apm';

export function getMlPrefix(serviceName: string, transactionType?: string) {
const maybeTransactionType = transactionType ? `${transactionType}-` : '';
return encodeForMlApi(`${serviceName}-${maybeTransactionType}`);
}

export function getMlJobId(serviceName: string, transactionType?: string) {
return `${getMlPrefix(serviceName, transactionType)}high_mean_response_time`;
}

export function getMlJobServiceName(jobId: string) {
return jobId.split('-').slice(0, -2).join('-');
}

export function encodeForMlApi(value: string) {
return value.replace(/\s+/g, '_').toLowerCase();
}

export function getSeverity(score?: number) {
if (typeof score !== 'number') {
return undefined;
Expand Down
10 changes: 0 additions & 10 deletions x-pack/plugins/apm/common/service_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ export interface Connection {
destination: ConnectionNode;
}

export interface ServiceAnomaly {
anomaly_score: number;
anomaly_severity: string;
actual_value: number;
typical_value: number;
ml_job_id: string;
}

export type ServiceNode = ConnectionNode & Partial<ServiceAnomaly>;

export interface ServiceNodeMetrics {
avgMemoryUsage: number | null;
avgCpuUsage: number | null;
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit e3598cb

Please sign in to comment.