mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[8.10] [APM] Move instance test from flaky archives based to definite synthtrace b… (#164070) (#164137)
# Backport This will backport the following commits from `main` to `8.10`: - [[APM] Move instance test from flaky archives based to definite synthtrace b… (#164070)](https://github.com/elastic/kibana/pull/164070) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Achyut Jhunjhunwala","email":"achyut.jhunjhunwala@elastic.co"},"sourceCommit":{"committedDate":"2023-08-17T07:59:47Z","message":"[APM] Move instance test from flaky archives based to definite synthtrace b… (#164070)\n\n## Summary\r\n\r\nCloses - https://github.com/elastic/kibana/issues/160709","sha":"9d55308844dacdea1feb040ef98004f28f8746de","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:APM","release_note:skip","v8.9.0","v8.10.0","v8.11.0"],"number":164070,"url":"https://github.com/elastic/kibana/pull/164070","mergeCommit":{"message":"[APM] Move instance test from flaky archives based to definite synthtrace b… (#164070)\n\n## Summary\r\n\r\nCloses - https://github.com/elastic/kibana/issues/160709","sha":"9d55308844dacdea1feb040ef98004f28f8746de"}},"sourceBranch":"main","suggestedTargetBranches":["8.9","8.11"],"targetPullRequestStates":[{"branch":"8.9","label":"v8.9.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/164070","number":164070,"mergeCommit":{"message":"[APM] Move instance test from flaky archives based to definite synthtrace b… (#164070)\n\n## Summary\r\n\r\nCloses - https://github.com/elastic/kibana/issues/160709","sha":"9d55308844dacdea1feb040ef98004f28f8746de"}},{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Achyut Jhunjhunwala <achyut.jhunjhunwala@elastic.co>
This commit is contained in:
parent
deab0c8752
commit
80e0d9aa86
2 changed files with 88 additions and 83 deletions
|
@ -1,66 +1,30 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`APM API tests service_overview/instance_details.spec.ts basic apm_8.0.0 Instance details when data is loaded fetch instance details return the correct data 1`] = `
|
||||
exports[`APM API tests service_overview/instance_details.spec.ts basic no archive Instance details when data is loaded fetch instance details return the correct data 1`] = `
|
||||
Object {
|
||||
"agent": Object {
|
||||
"ephemeral_id": "2745d454-f57f-4473-a09b-fe6bef295860",
|
||||
"name": "java",
|
||||
"version": "1.25.1-SNAPSHOT.UNKNOWN",
|
||||
},
|
||||
"cloud": Object {
|
||||
"availability_zone": "europe-west1-c",
|
||||
"instance": Object {
|
||||
"id": "2549868447004523210",
|
||||
"name": "gke-release-oblt-release-oblt-pool-d839a4cc-7sjc",
|
||||
},
|
||||
"machine": Object {
|
||||
"type": "n1-standard-4",
|
||||
},
|
||||
"project": Object {
|
||||
"id": "8560181848",
|
||||
"name": "elastic-observability",
|
||||
},
|
||||
"provider": "gcp",
|
||||
"region": "europe-west1",
|
||||
},
|
||||
"container": Object {
|
||||
"id": "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad",
|
||||
"id": "123",
|
||||
},
|
||||
"host": Object {
|
||||
"architecture": "amd64",
|
||||
"ip": "35.233.127.253",
|
||||
"os": Object {
|
||||
"platform": "Linux",
|
||||
},
|
||||
"name": "metric-only-production",
|
||||
},
|
||||
"kubernetes": Object {
|
||||
"container": Object {},
|
||||
"deployment": Object {},
|
||||
"pod": Object {
|
||||
"name": "opbeans-java-b8fcdf794-czvtr",
|
||||
"uid": "e0bf3100-4a0d-4d96-88ef-4e3aa3c78a5d",
|
||||
"uid": "234",
|
||||
},
|
||||
"replicaset": Object {},
|
||||
},
|
||||
"service": Object {
|
||||
"environment": "production",
|
||||
"framework": Object {
|
||||
"name": "Spring Web MVC",
|
||||
"version": "5.0.6.RELEASE",
|
||||
},
|
||||
"language": Object {
|
||||
"name": "Java",
|
||||
"version": "11.0.11",
|
||||
},
|
||||
"name": "opbeans-java",
|
||||
"name": "service1",
|
||||
"node": Object {
|
||||
"name": "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad",
|
||||
"name": "metric-only-production",
|
||||
},
|
||||
"runtime": Object {
|
||||
"name": "Java",
|
||||
"version": "11.0.11",
|
||||
},
|
||||
"version": "2021-08-03 04:26:27",
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
import expect from '@kbn/expect';
|
||||
import { omit } from 'lodash';
|
||||
import { APIReturnType } from '@kbn/apm-plugin/public/services/rest/create_call_apm_api';
|
||||
import { apm, timerange } from '@kbn/apm-synthtrace-client';
|
||||
import { FtrProviderContext } from '../../common/ftr_provider_context';
|
||||
import archives from '../../common/fixtures/es_archiver/archives_metadata';
|
||||
import { getServiceNodeIds } from './get_service_node_ids';
|
||||
|
||||
type ServiceOverviewInstanceDetails =
|
||||
|
@ -17,9 +17,10 @@ type ServiceOverviewInstanceDetails =
|
|||
export default function ApiTest({ getService }: FtrProviderContext) {
|
||||
const registry = getService('registry');
|
||||
const apmApiClient = getService('apmApiClient');
|
||||
const synthtrace = getService('synthtraceEsClient');
|
||||
|
||||
const archiveName = 'apm_8.0.0';
|
||||
const { start, end } = archives[archiveName];
|
||||
const start = '2023-08-22T00:00:00.000Z';
|
||||
const end = '2023-08-22T01:00:00.000Z';
|
||||
|
||||
registry.when(
|
||||
'Instance details when data is not loaded',
|
||||
|
@ -46,53 +47,93 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
}
|
||||
);
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/160709
|
||||
registry.when.skip(
|
||||
'Instance details when data is loaded',
|
||||
{ config: 'basic', archives: [archiveName] },
|
||||
() => {
|
||||
describe('fetch instance details', () => {
|
||||
let response: {
|
||||
status: number;
|
||||
body: ServiceOverviewInstanceDetails;
|
||||
};
|
||||
registry.when('Instance details when data is loaded', { config: 'basic', archives: [] }, () => {
|
||||
const range = timerange(new Date(start).getTime(), new Date(end).getTime());
|
||||
|
||||
let serviceNodeIds: string[];
|
||||
const serviceInstance = apm
|
||||
.service({ name: 'service1', environment: 'production', agentName: 'go' })
|
||||
.instance('multiple-env-service-production');
|
||||
|
||||
before(async () => {
|
||||
serviceNodeIds = await getServiceNodeIds({
|
||||
apmApiClient,
|
||||
start,
|
||||
end,
|
||||
});
|
||||
const metricOnlyInstance = apm
|
||||
.service({ name: 'service1', environment: 'production', agentName: 'java' })
|
||||
.instance('metric-only-production');
|
||||
|
||||
response = await apmApiClient.readUser({
|
||||
endpoint:
|
||||
'GET /internal/apm/services/{serviceName}/service_overview_instances/details/{serviceNodeName}',
|
||||
params: {
|
||||
path: { serviceName: 'opbeans-java', serviceNodeName: serviceNodeIds[0] },
|
||||
query: {
|
||||
start,
|
||||
end,
|
||||
},
|
||||
before(async () => {
|
||||
return synthtrace.index([
|
||||
range
|
||||
.interval('1s')
|
||||
.rate(4)
|
||||
.generator((timestamp) =>
|
||||
serviceInstance
|
||||
.transaction({ transactionName: 'GET /api' })
|
||||
.timestamp(timestamp)
|
||||
.duration(1000)
|
||||
.success()
|
||||
),
|
||||
range
|
||||
.interval('30s')
|
||||
.rate(1)
|
||||
.generator((timestamp) =>
|
||||
metricOnlyInstance
|
||||
.containerId('123')
|
||||
.podId('234')
|
||||
.appMetrics({
|
||||
'system.memory.actual.free': 1,
|
||||
'system.cpu.total.norm.pct': 1,
|
||||
'system.memory.total': 1,
|
||||
'system.process.cpu.total.norm.pct': 1,
|
||||
})
|
||||
.timestamp(timestamp)
|
||||
),
|
||||
]);
|
||||
});
|
||||
|
||||
after(() => {
|
||||
return synthtrace.clean();
|
||||
});
|
||||
|
||||
describe('fetch instance details', () => {
|
||||
let response: {
|
||||
status: number;
|
||||
body: ServiceOverviewInstanceDetails;
|
||||
};
|
||||
|
||||
let serviceNodeIds: string[];
|
||||
|
||||
before(async () => {
|
||||
serviceNodeIds = await getServiceNodeIds({
|
||||
apmApiClient,
|
||||
start,
|
||||
end,
|
||||
serviceName: 'service1',
|
||||
});
|
||||
|
||||
response = await apmApiClient.readUser({
|
||||
endpoint:
|
||||
'GET /internal/apm/services/{serviceName}/service_overview_instances/details/{serviceNodeName}',
|
||||
params: {
|
||||
path: { serviceName: 'service1', serviceNodeName: serviceNodeIds[0] },
|
||||
query: {
|
||||
start,
|
||||
end,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('returns the instance details', () => {
|
||||
expect(response.body).to.not.eql({});
|
||||
});
|
||||
|
||||
it('return the correct data', () => {
|
||||
expectSnapshot(omit(response.body, '@timestamp')).toMatch();
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
it('returns the instance details', () => {
|
||||
expect(response.body).to.not.eql({});
|
||||
});
|
||||
|
||||
it('return the correct data', () => {
|
||||
expectSnapshot(omit(response.body, '@timestamp')).toMatch();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
registry.when(
|
||||
'Instance details when data is loaded but details not found',
|
||||
{ config: 'basic', archives: [archiveName] },
|
||||
{ config: 'basic', archives: [] },
|
||||
() => {
|
||||
it('handles empty state when instance id not found', async () => {
|
||||
const response = await apmApiClient.readUser({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue