mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[APM] Update ML job ID in data telemetry tasks (#71044)
* [APM] Update ML job ID in data telemetry tasks Use "apm-*" to match the new job IDs added in #70560. * additional fix * Remove unused import
This commit is contained in:
parent
a0b47cae85
commit
1f5a1fe66c
2 changed files with 49 additions and 13 deletions
|
@ -65,4 +65,40 @@ describe('data telemetry collection tasks', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('integrations', () => {
|
||||
const integrationsTask = tasks.find((task) => task.name === 'integrations');
|
||||
|
||||
it('returns the count of ML jobs', async () => {
|
||||
const transportRequest = jest
|
||||
.fn()
|
||||
.mockResolvedValueOnce({ body: { count: 1 } });
|
||||
|
||||
expect(
|
||||
await integrationsTask?.executor({ indices, transportRequest } as any)
|
||||
).toEqual({
|
||||
integrations: {
|
||||
ml: {
|
||||
all_jobs_count: 1,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
describe('with no data', () => {
|
||||
it('returns a count of 0', async () => {
|
||||
const transportRequest = jest.fn().mockResolvedValueOnce({});
|
||||
|
||||
expect(
|
||||
await integrationsTask?.executor({ indices, transportRequest } as any)
|
||||
).toEqual({
|
||||
integrations: {
|
||||
ml: {
|
||||
all_jobs_count: 0,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,31 +4,31 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
import { flatten, merge, sortBy, sum } from 'lodash';
|
||||
import { AgentName } from '../../../../typings/es_schemas/ui/fields/agent';
|
||||
import { TelemetryTask } from '.';
|
||||
import { AGENT_NAMES } from '../../../../common/agent_name';
|
||||
import { Transaction } from '../../../../typings/es_schemas/ui/transaction';
|
||||
import {
|
||||
PROCESSOR_EVENT,
|
||||
SERVICE_NAME,
|
||||
AGENT_NAME,
|
||||
AGENT_VERSION,
|
||||
CLOUD_AVAILABILITY_ZONE,
|
||||
CLOUD_PROVIDER,
|
||||
CLOUD_REGION,
|
||||
ERROR_GROUP_ID,
|
||||
TRANSACTION_NAME,
|
||||
PARENT_ID,
|
||||
PROCESSOR_EVENT,
|
||||
SERVICE_FRAMEWORK_NAME,
|
||||
SERVICE_FRAMEWORK_VERSION,
|
||||
SERVICE_LANGUAGE_NAME,
|
||||
SERVICE_LANGUAGE_VERSION,
|
||||
SERVICE_NAME,
|
||||
SERVICE_RUNTIME_NAME,
|
||||
SERVICE_RUNTIME_VERSION,
|
||||
TRANSACTION_NAME,
|
||||
USER_AGENT_ORIGINAL,
|
||||
CLOUD_AVAILABILITY_ZONE,
|
||||
CLOUD_PROVIDER,
|
||||
CLOUD_REGION,
|
||||
} from '../../../../common/elasticsearch_fieldnames';
|
||||
import { Span } from '../../../../typings/es_schemas/ui/span';
|
||||
import { APMError } from '../../../../typings/es_schemas/ui/apm_error';
|
||||
import { TelemetryTask } from '.';
|
||||
import { AgentName } from '../../../../typings/es_schemas/ui/fields/agent';
|
||||
import { Span } from '../../../../typings/es_schemas/ui/span';
|
||||
import { Transaction } from '../../../../typings/es_schemas/ui/transaction';
|
||||
import { APMTelemetry } from '../types';
|
||||
|
||||
const TIME_RANGES = ['1d', 'all'] as const;
|
||||
|
@ -465,17 +465,17 @@ export const tasks: TelemetryTask[] = [
|
|||
{
|
||||
name: 'integrations',
|
||||
executor: async ({ transportRequest }) => {
|
||||
const apmJobs = ['*-high_mean_response_time'];
|
||||
const apmJobs = ['apm-*', '*-high_mean_response_time'];
|
||||
|
||||
const response = (await transportRequest({
|
||||
method: 'get',
|
||||
path: `/_ml/anomaly_detectors/${apmJobs.join(',')}`,
|
||||
})) as { data?: { count: number } };
|
||||
})) as { body?: { count: number } };
|
||||
|
||||
return {
|
||||
integrations: {
|
||||
ml: {
|
||||
all_jobs_count: response.data?.count ?? 0,
|
||||
all_jobs_count: response.body?.count ?? 0,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue