Skip to content

Commit 485ac74

Browse files
[9.2] Fix APM trace.id emission test (#244875) (#245435)
# Backport This will backport the following commits from `main` to `9.2`: - [Fix APM `trace.id` emission test (#244875)](#244875) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Jean-Louis Leysens","email":"jeanlouis.leysens@elastic.co"},"sourceCommit":{"committedDate":"2025-12-05T18:25:30Z","message":"Fix APM `trace.id` emission test (#244875)\n\n## Summary\n\nClose https://github.com/elastic/kibana/issues/244713\n\nUpdate `Log Correlation Emits \"trace.id\" into the logs` to no longer\ncheck for unique `trace.id` values in subsequent requests as this is not\nthe primary focus of this test.\n\n### More details\n\nAfter merging [APM for functional\ntest](https://github.com/elastic/kibana/pull/228692/files#diff-deac86b8f74f0b46cc5bb277f8d20a5a3de5ffd6c14bdf9de555734bc58fce57R11)\nruns the `Log Correlation Emits \"trace.id\" into the logs` test started\nfailing because it was no longer possible to test that unique `trace.id`\nvalues were being generated for subsequent requests:\n\n```\n └- ✖ fail: Execution context Log Correlation Emits \"trace.id\" into the logs\n │ Error: expected '53f48249e3207b30ed63f76b4d4913ea' to not equal '53f48249e3207b30ed63f76b4d4913ea'\n```","sha":"00d38597d6ed66e56b25d29523f824a8fb901847","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","backport:all-open","v9.3.0"],"title":"Fix APM `trace.id` emission test","number":244875,"url":"https://github.com/elastic/kibana/pull/244875","mergeCommit":{"message":"Fix APM `trace.id` emission test (#244875)\n\n## Summary\n\nClose https://github.com/elastic/kibana/issues/244713\n\nUpdate `Log Correlation Emits \"trace.id\" into the logs` to no longer\ncheck for unique `trace.id` values in subsequent requests as this is not\nthe primary focus of this test.\n\n### More details\n\nAfter merging [APM for functional\ntest](https://github.com/elastic/kibana/pull/228692/files#diff-deac86b8f74f0b46cc5bb277f8d20a5a3de5ffd6c14bdf9de555734bc58fce57R11)\nruns the `Log Correlation Emits \"trace.id\" into the logs` test started\nfailing because it was no longer possible to test that unique `trace.id`\nvalues were being generated for subsequent requests:\n\n```\n └- ✖ fail: Execution context Log Correlation Emits \"trace.id\" into the logs\n │ Error: expected '53f48249e3207b30ed63f76b4d4913ea' to not equal '53f48249e3207b30ed63f76b4d4913ea'\n```","sha":"00d38597d6ed66e56b25d29523f824a8fb901847"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/244875","number":244875,"mergeCommit":{"message":"Fix APM `trace.id` emission test (#244875)\n\n## Summary\n\nClose https://github.com/elastic/kibana/issues/244713\n\nUpdate `Log Correlation Emits \"trace.id\" into the logs` to no longer\ncheck for unique `trace.id` values in subsequent requests as this is not\nthe primary focus of this test.\n\n### More details\n\nAfter merging [APM for functional\ntest](https://github.com/elastic/kibana/pull/228692/files#diff-deac86b8f74f0b46cc5bb277f8d20a5a3de5ffd6c14bdf9de555734bc58fce57R11)\nruns the `Log Correlation Emits \"trace.id\" into the logs` test started\nfailing because it was no longer possible to test that unique `trace.id`\nvalues were being generated for subsequent requests:\n\n```\n └- ✖ fail: Execution context Log Correlation Emits \"trace.id\" into the logs\n │ Error: expected '53f48249e3207b30ed63f76b4d4913ea' to not equal '53f48249e3207b30ed63f76b4d4913ea'\n```","sha":"00d38597d6ed66e56b25d29523f824a8fb901847"}}]}] BACKPORT--> Co-authored-by: Jean-Louis Leysens <jeanlouis.leysens@elastic.co>
1 parent 2226a78 commit 485ac74

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

x-pack/platform/test/functional_execution_context/tests/log_correlation.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,23 @@ export default function ({ getService }: FtrProviderContext) {
2929
const log = getService('log');
3030

3131
describe('Log Correlation', () => {
32-
// TODO: see https://github.com/elastic/kibana/pull/243499
33-
it.skip('Emits "trace.id" into the logs', async () => {
32+
it('Emits "trace.id" into the logs', async () => {
3433
if (isPrWithLabel('"ci:collect-apm"')) {
3534
log.warning(`Skipping test as APM is enabled in FTR, which breaks this test`);
3635
return;
3736
}
3837

39-
const response1 = await supertest.get('/emit_log_with_trace_id');
40-
expect(response1.status).to.be(200);
41-
38+
// Explicitly unset traceparent so that APM agent provides a new trace.id for the request
39+
const response1 = await supertest.get('/emit_log_with_trace_id').set('traceparent', '');
4240
expect(response1.body.traceId).to.be.a('string');
41+
expect(response1.status).to.be(200);
4342

44-
const response2 = await supertest.get('/emit_log_with_trace_id');
45-
43+
// Explicitly unset traceparent so that APM agent provides a new trace.id for the request
44+
const response2 = await supertest.get('/emit_log_with_trace_id').set('traceparent', '');
45+
expect(response2.body.traceId).to.be.a('string');
4646
expect(response2.status).to.be(200);
47-
expect(response1.body.traceId).to.be.a('string');
4847

49-
expect(response2.body.traceId).not.to.be(response1.body.traceId);
48+
expect(response1.body.traceId).not.to.be(response2.body.traceId);
5049

5150
const logs = await readLogFile();
5251

@@ -79,7 +78,6 @@ export default function ({ getService }: FtrProviderContext) {
7978
// esClient.ping() request
8079
record.message?.includes('HEAD /')
8180
),
82-
8381
logs,
8482
});
8583
});

0 commit comments

Comments
 (0)