Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate /diagnostics and /service_nodes to be deployment agnostic #199645

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
30d377a
Migrate /test/apm_api_integration/tests/diagnostics to be deployment-…
miloszmarcinkowski Nov 11, 2024
11c847e
Merge remote-tracking branch 'upstream/main' into 198967-apm-migrate-…
miloszmarcinkowski Nov 11, 2024
fefc157
Merge remote-tracking branch 'upstream/main' into 198967-apm-migrate-…
miloszmarcinkowski Nov 11, 2024
3f29f99
unskip tests
miloszmarcinkowski Nov 12, 2024
b2d307a
filter out apm index templates
miloszmarcinkowski Nov 12, 2024
dd0a870
type check fix
miloszmarcinkowski Nov 12, 2024
9e7b6fe
Merge remote-tracking branch 'upstream/main' into 198967-apm-migrate-…
miloszmarcinkowski Nov 13, 2024
11ce02a
Migrate /test/apm_api_integration/tests/service_nodes to be deploymen…
miloszmarcinkowski Nov 13, 2024
8f8ef6c
Merge branch '198985-apm-migrate-testapm_api_integrationtestsservice_…
miloszmarcinkowski Nov 13, 2024
ec4c5cc
Correct describe block title
miloszmarcinkowski Nov 13, 2024
b9a4a03
Merge branch 'main' into 198967-apm-migrate-testapm_api_integrationte…
miloszmarcinkowski Nov 14, 2024
2bd7dae
remove duplicated apm package instalation
miloszmarcinkowski Nov 14, 2024
28c1ba6
convert to Type-Only imports in `apm/*` tests
miloszmarcinkowski Nov 14, 2024
7a56f8c
adjust index_pattern_settings.spec.ts to work in all testing environm…
miloszmarcinkowski Nov 14, 2024
50d8fba
Merge remote-tracking branch 'upstream/main' into 198967-apm-migrate-…
miloszmarcinkowski Nov 14, 2024
2e2d110
[CI] Auto-commit changed files from 'make api-docs'
kibanamachine Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,17 @@
import expect from '@kbn/expect';
import { apm, timerange } from '@kbn/apm-synthtrace-client';
import type { ApmSynthtraceEsClient } from '@kbn/apm-synthtrace';
import { getApmIndexTemplateNames } from '@kbn/apm-plugin/server/routes/diagnostics/helpers/get_apm_index_template_names';
import { uniq } from 'lodash';
import type { DeploymentAgnosticFtrProviderContext } from '../../../../ftr_provider_context';

export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderContext) {
const apmApiClient = getService('apmApi');
const es = getService('es');
const synthtrace = getService('synthtrace');

const start = new Date('2021-01-01T00:00:00.000Z').getTime();
const end = new Date('2021-01-01T00:15:00.000Z').getTime() - 1;

describe.skip('Diagnostics: Index pattern settings', () => {
describe('When there is no data', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When default index templates are deleted, they get recreated automatically. It was introduced here: elastic/elasticsearch#97546

This means we can't perform check against empty response anymore.

before(async () => {
// delete all APM index templates
await es.indices.deleteIndexTemplate({
name: Object.values(getApmIndexTemplateNames()).flat(),
});
});

it('returns the built-in (non-APM) index templates`', async () => {
const { status, body } = await apmApiClient.adminUser({
endpoint: 'GET /internal/apm/diagnostics',
});
expect(status).to.be(200);

const templateNames = body.indexTemplatesByIndexPattern.flatMap(({ indexTemplates }) => {
return indexTemplates?.map(({ templateName }) => templateName);
});

expect(templateNames).to.eql(['logs', 'metrics']);
});
});

describe('Diagnostics: Index pattern settings', () => {
describe('When data is ingested', () => {
let apmSynthtraceEsClient: ApmSynthtraceEsClient;

Expand Down Expand Up @@ -76,32 +53,49 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon
});
expect(status).to.be(200);

const templateNames = body.indexTemplatesByIndexPattern.flatMap(({ indexTemplates }) => {
return indexTemplates?.map(({ templateName }) => templateName);
});
const templateNames = uniq(
body.indexTemplatesByIndexPattern.flatMap(({ indexTemplates }) => {
return indexTemplates?.map(({ templateName }) => templateName);
})
);

expect(templateNames).to.eql([
'logs-apm.error',
'logs-apm.app',
'logs-apm.error@template',
'logs-apm.app@template',
'logs-otel@template',
'logs',
'metrics-apm.service_transaction.60m',
'metrics-apm.service_destination.10m',
'metrics-apm.transaction.1m',
'metrics-apm.service_destination.1m',
'metrics-apm.service_transaction.10m',
'metrics-apm.service_transaction.1m',
'metrics-apm.transaction.60m',
'metrics-apm.service_destination.60m',
'metrics-apm.service_summary.1m',
'metrics-apm.transaction.10m',
'metrics-apm.internal',
'metrics-apm.service_summary.10m',
'metrics-apm.service_summary.60m',
'metrics-apm.app',
'metrics-apm.service_transaction.1m@template',
'metrics-apm.transaction.10m@template',
'metrics-apm.service_summary.10m@template',
'metrics-apm.internal@template',
'metrics-apm.service_destination.1m@template',
'metrics-apm.service_summary.60m@template',
'metrics-apm.service_summary.1m@template',
'metrics-apm.transaction.1m@template',
'metrics-apm.service_destination.60m@template',
'metrics-apm.service_transaction.60m@template',
'metrics-apm.service_destination.10m@template',
'metrics-apm.service_transaction.10m@template',
'metrics-apm.transaction.60m@template',
'metrics-apm.app@template',
'metrics-otel@template',
'metrics',
'traces-apm',
'traces-apm.rum',
'traces-apm.sampled',
'metrics-service_transaction.10m.otel@template',
'metrics-transaction.10m.otel@template',
'metrics-service_summary.1m.otel@template',
'metrics-service_transaction.60m.otel@template',
'metrics-service_summary.60m.otel@template',
'metrics-service_destination.1m@template',
'metrics-service_destination.10m@template',
'metrics-service_summary.10m.otel@template',
'metrics-transaction.1m.otel@template',
'metrics-transaction.60m.otel@template',
'metrics-service_transaction.1m.otel@template',
'metrics-service_destination.60m@template',
'traces-apm.rum@template',
'traces-apm@template',
'traces-apm.sampled@template',
'traces-otel@template',
]);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import expect from '@kbn/expect';
import { apm, timerange } from '@kbn/apm-synthtrace-client';
import { getApmIndexTemplateNames } from '@kbn/apm-plugin/server/routes/diagnostics/helpers/get_apm_index_template_names';
import type { ApmSynthtraceEsClient } from '@kbn/apm-synthtrace';
import type { DeploymentAgnosticFtrProviderContext } from '../../../../ftr_provider_context';

Expand All @@ -19,27 +18,7 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon
const start = new Date('2021-01-01T00:00:00.000Z').getTime();
const end = new Date('2021-01-01T00:15:00.000Z').getTime() - 1;

describe.skip('Diagnostics: Index Templates', () => {
describe('When there is no data', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When default index templates are deleted, they get recreated automatically. Introduced here: elastic/elasticsearch#97546

This means we can't perform check against empty response anymore.

before(async () => {
// delete APM index templates
await es.indices.deleteIndexTemplate({
name: Object.values(getApmIndexTemplateNames()).flat(),
});
});

it('verifies that none of the default APM index templates exists`', async () => {
const { status, body } = await apmApiClient.adminUser({
endpoint: 'GET /internal/apm/diagnostics',
});
expect(status).to.be(200);
const noApmIndexTemplateExists = body.apmIndexTemplates.every(
({ exists }) => exists === false
);
expect(noApmIndexTemplateExists).to.eql(true);
});
});

describe('Diagnostics: Index Templates', () => {
describe('When data is ingested', () => {
let apmSynthtraceEsClient: ApmSynthtraceEsClient;

Expand Down