-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] Migrate /diagnostics and /service_nodes to be deployment agnost…
…ic (#199645) (#200563) # Backport This will backport the following commits from `main` to `8.x`: - [Migrate /diagnostics and /service_nodes to be deployment agnostic (#199645)](#199645) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Milosz Marcinkowski","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-14T15:39:11Z","message":"Migrate /diagnostics and /service_nodes to be deployment agnostic (#199645)\n\ncloses #198967\r\ncloses #198985\r\npart of https://github.com/elastic/kibana/issues/193245\r\n\r\n### How to test\r\n\r\n- Serverless\r\n\r\n```\r\nnode scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts\r\nnode scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts --grep=\"APM\"\r\n```\r\n\r\n- Stateful\r\n```\r\nnode scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts\r\nnode scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts --grep=\"APM\"\r\n```\r\n\r\n-\r\n[MKI](https://github.com/crespocarlos/kibana/blob/main/x-pack/test_serverless/README.md#run-tests-on-mki)\r\n\r\n### Checklist\r\n- [x] (OPTIONAL, only if a test has been unskipped) Run flaky test suite\r\n- [x] serverless\r\n- [x] stateful\r\n- [x] MKI\r\n\r\n---------\r\n\r\nCo-authored-by: Sergi Romeu <[email protected]>","sha":"04b2d62fee8731e1a0a6ff230b512d7e94843ce5","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport missing","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services"],"number":199645,"url":"https://github.com/elastic/kibana/pull/199645","mergeCommit":{"message":"Migrate /diagnostics and /service_nodes to be deployment agnostic (#199645)\n\ncloses #198967\r\ncloses #198985\r\npart of https://github.com/elastic/kibana/issues/193245\r\n\r\n### How to test\r\n\r\n- Serverless\r\n\r\n```\r\nnode scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts\r\nnode scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts --grep=\"APM\"\r\n```\r\n\r\n- Stateful\r\n```\r\nnode scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts\r\nnode scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts --grep=\"APM\"\r\n```\r\n\r\n-\r\n[MKI](https://github.com/crespocarlos/kibana/blob/main/x-pack/test_serverless/README.md#run-tests-on-mki)\r\n\r\n### Checklist\r\n- [x] (OPTIONAL, only if a test has been unskipped) Run flaky test suite\r\n- [x] serverless\r\n- [x] stateful\r\n- [x] MKI\r\n\r\n---------\r\n\r\nCo-authored-by: Sergi Romeu <[email protected]>","sha":"04b2d62fee8731e1a0a6ff230b512d7e94843ce5"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/199645","number":199645,"mergeCommit":{"message":"Migrate /diagnostics and /service_nodes to be deployment agnostic (#199645)\n\ncloses #198967\r\ncloses #198985\r\npart of https://github.com/elastic/kibana/issues/193245\r\n\r\n### How to test\r\n\r\n- Serverless\r\n\r\n```\r\nnode scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts\r\nnode scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts --grep=\"APM\"\r\n```\r\n\r\n- Stateful\r\n```\r\nnode scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts\r\nnode scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts --grep=\"APM\"\r\n```\r\n\r\n-\r\n[MKI](https://github.com/crespocarlos/kibana/blob/main/x-pack/test_serverless/README.md#run-tests-on-mki)\r\n\r\n### Checklist\r\n- [x] (OPTIONAL, only if a test has been unskipped) Run flaky test suite\r\n- [x] serverless\r\n- [x] stateful\r\n- [x] MKI\r\n\r\n---------\r\n\r\nCo-authored-by: Sergi Romeu <[email protected]>","sha":"04b2d62fee8731e1a0a6ff230b512d7e94843ce5"}}]}] BACKPORT-->
- Loading branch information
1 parent
725d0cc
commit 815594d
Showing
43 changed files
with
321 additions
and
305 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
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
19 changes: 19 additions & 0 deletions
19
x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/diagnostics/index.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,19 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import type { DeploymentAgnosticFtrProviderContext } from '../../../../ftr_provider_context'; | ||
|
||
export default function ({ loadTestFile }: DeploymentAgnosticFtrProviderContext) { | ||
describe('diagnostics', () => { | ||
loadTestFile(require.resolve('./apm_events.spec.ts')); | ||
loadTestFile(require.resolve('./data_streams.spec.ts')); | ||
loadTestFile(require.resolve('./index_pattern_settings.spec.ts')); | ||
loadTestFile(require.resolve('./index_templates.spec.ts')); | ||
loadTestFile(require.resolve('./indices.spec.ts')); | ||
loadTestFile(require.resolve('./privileges.spec.ts')); | ||
}); | ||
} |
108 changes: 108 additions & 0 deletions
108
...ion/deployment_agnostic/apis/observability/apm/diagnostics/index_pattern_settings.spec.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,108 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import expect from '@kbn/expect'; | ||
import { apm, timerange } from '@kbn/apm-synthtrace-client'; | ||
import type { ApmSynthtraceEsClient } from '@kbn/apm-synthtrace'; | ||
import { uniq } from 'lodash'; | ||
import type { DeploymentAgnosticFtrProviderContext } from '../../../../ftr_provider_context'; | ||
|
||
export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderContext) { | ||
const apmApiClient = getService('apmApi'); | ||
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('Diagnostics: Index pattern settings', () => { | ||
describe('When data is ingested', () => { | ||
let apmSynthtraceEsClient: ApmSynthtraceEsClient; | ||
|
||
before(async () => { | ||
apmSynthtraceEsClient = await synthtrace.createApmSynthtraceEsClient(); | ||
|
||
const instance = apm | ||
.service({ name: 'synth-go', environment: 'production', agentName: 'go' }) | ||
.instance('instance-a'); | ||
await apmSynthtraceEsClient.index( | ||
timerange(start, end) | ||
.interval('1m') | ||
.rate(30) | ||
.generator((timestamp) => | ||
instance | ||
.transaction({ transactionName: 'GET /users' }) | ||
.timestamp(timestamp) | ||
.duration(100) | ||
.success() | ||
) | ||
); | ||
}); | ||
|
||
after(() => apmSynthtraceEsClient.clean()); | ||
|
||
it('returns APM index templates', async () => { | ||
const apmIndexTemplatesPatterns = ['apm', 'otel']; | ||
|
||
const { status, body } = await apmApiClient.adminUser({ | ||
endpoint: 'GET /internal/apm/diagnostics', | ||
}); | ||
expect(status).to.be(200); | ||
|
||
// filtering the array for unique index templates because they get duplicated across different index patterns | ||
const uniqueTemplateNames = uniq( | ||
body.indexTemplatesByIndexPattern.flatMap(({ indexTemplates }) => { | ||
return indexTemplates?.map(({ templateName }) => templateName); | ||
}) | ||
); | ||
|
||
// filter only APM releated indices | ||
const apmTemplateNames = uniqueTemplateNames.filter( | ||
(templateName) => | ||
templateName.endsWith('@template') && | ||
apmIndexTemplatesPatterns.some((pattern) => templateName.includes(pattern)) | ||
); | ||
|
||
// sort alphabeticaly before comparing because an order is different between testing environments | ||
const sortedApmTemplates = apmTemplateNames.sort(); | ||
|
||
expect(sortedApmTemplates).to.eql([ | ||
'logs-apm.app@template', | ||
'logs-apm.error@template', | ||
'logs-otel@template', | ||
'metrics-apm.app@template', | ||
'metrics-apm.internal@template', | ||
'metrics-apm.service_destination.10m@template', | ||
'metrics-apm.service_destination.1m@template', | ||
'metrics-apm.service_destination.60m@template', | ||
'metrics-apm.service_summary.10m@template', | ||
'metrics-apm.service_summary.1m@template', | ||
'metrics-apm.service_summary.60m@template', | ||
'metrics-apm.service_transaction.10m@template', | ||
'metrics-apm.service_transaction.1m@template', | ||
'metrics-apm.service_transaction.60m@template', | ||
'metrics-apm.transaction.10m@template', | ||
'metrics-apm.transaction.1m@template', | ||
'metrics-apm.transaction.60m@template', | ||
'metrics-otel@template', | ||
'metrics-service_summary.10m.otel@template', | ||
'metrics-service_summary.1m.otel@template', | ||
'metrics-service_summary.60m.otel@template', | ||
'metrics-service_transaction.10m.otel@template', | ||
'metrics-service_transaction.1m.otel@template', | ||
'metrics-service_transaction.60m.otel@template', | ||
'metrics-transaction.10m.otel@template', | ||
'metrics-transaction.1m.otel@template', | ||
'metrics-transaction.60m.otel@template', | ||
'traces-apm.rum@template', | ||
'traces-apm.sampled@template', | ||
'traces-apm@template', | ||
'traces-otel@template', | ||
]); | ||
}); | ||
}); | ||
}); | ||
} |
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
Oops, something went wrong.