-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #68978 by encoding service names before comparing them to ML j…
…ob group names.
- Loading branch information
Showing
2 changed files
with
57 additions
and
4 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
x-pack/plugins/apm/server/lib/service_map/get_service_anomalies.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { getApmMlJobCategory } from './get_service_anomalies'; | ||
import { Job as AnomalyDetectionJob } from '../../../../ml/server'; | ||
|
||
describe('getApmMlJobCategory', () => { | ||
it('should match service names with different casings', () => { | ||
const mlJob = { | ||
job_id: 'testservice-request-high_mean_response_time', | ||
groups: ['apm', 'testservice', 'request'], | ||
} as AnomalyDetectionJob; | ||
const serviceNames = ['testService']; | ||
const apmMlJobCategory = getApmMlJobCategory(mlJob, serviceNames); | ||
|
||
expect(apmMlJobCategory).toEqual({ | ||
jobId: 'testservice-request-high_mean_response_time', | ||
serviceName: 'testService', | ||
transactionType: 'request', | ||
}); | ||
}); | ||
|
||
it('should match service names with spaces', () => { | ||
const mlJob = { | ||
job_id: 'test_service-request-high_mean_response_time', | ||
groups: ['apm', 'test_service', 'request'], | ||
} as AnomalyDetectionJob; | ||
const serviceNames = ['Test Service']; | ||
const apmMlJobCategory = getApmMlJobCategory(mlJob, serviceNames); | ||
|
||
expect(apmMlJobCategory).toEqual({ | ||
jobId: 'test_service-request-high_mean_response_time', | ||
serviceName: 'Test Service', | ||
transactionType: 'request', | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters