Skip to content

Commit c633030

Browse files
[8.19] Sample logs scenario - send to wired streams and classic streams at the same time (elastic#220737) (elastic#221151)
# Backport This will backport the following commits from `main` to `8.19`: - [Sample logs scenario - send to wired streams and classic streams at the same time (elastic#220737)](elastic#220737) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Joe Reuter","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-05-21T16:19:33Z","message":"Sample logs scenario - send to wired streams and classic streams at the same time (elastic#220737)\n\nTo be able to better test classic vs. wired streams, this PR expands the\n`sample_logs` scenario to send to both of these places.\n\n<img width=\"1130\" alt=\"Screenshot 2025-05-11 at 10 55 36\"\nsrc=\"https://github.com/user-attachments/assets/0e75c82e-e96c-4f81-abcc-32347cd82d6b\"\n/>\n\n```\nnode scripts/synthtrace.js sample_logs --live --kibana=http://elastic:changeme@localhost:5601 --target=http://elastic:changeme@localhost:9200 --liveBucketSize=1000\n```","sha":"ab7734797388d79077184818dc720c76d9d58f1e","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:obs-ux-logs","Team:obs-ux-infra_services","backport:version","Feature:Streams","v9.1.0","v8.19.0"],"title":"Sample logs scenario - send to wired streams and classic streams at the same time","number":220737,"url":"https://github.com/elastic/kibana/pull/220737","mergeCommit":{"message":"Sample logs scenario - send to wired streams and classic streams at the same time (elastic#220737)\n\nTo be able to better test classic vs. wired streams, this PR expands the\n`sample_logs` scenario to send to both of these places.\n\n<img width=\"1130\" alt=\"Screenshot 2025-05-11 at 10 55 36\"\nsrc=\"https://github.com/user-attachments/assets/0e75c82e-e96c-4f81-abcc-32347cd82d6b\"\n/>\n\n```\nnode scripts/synthtrace.js sample_logs --live --kibana=http://elastic:changeme@localhost:5601 --target=http://elastic:changeme@localhost:9200 --liveBucketSize=1000\n```","sha":"ab7734797388d79077184818dc720c76d9d58f1e"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/220737","number":220737,"mergeCommit":{"message":"Sample logs scenario - send to wired streams and classic streams at the same time (elastic#220737)\n\nTo be able to better test classic vs. wired streams, this PR expands the\n`sample_logs` scenario to send to both of these places.\n\n<img width=\"1130\" alt=\"Screenshot 2025-05-11 at 10 55 36\"\nsrc=\"https://github.com/user-attachments/assets/0e75c82e-e96c-4f81-abcc-32347cd82d6b\"\n/>\n\n```\nnode scripts/synthtrace.js sample_logs --live --kibana=http://elastic:changeme@localhost:5601 --target=http://elastic:changeme@localhost:9200 --liveBucketSize=1000\n```","sha":"ab7734797388d79077184818dc720c76d9d58f1e"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Joe Reuter <[email protected]>
1 parent 52b928d commit c633030

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/platform/packages/shared/kbn-apm-synthtrace/src/lib/streams/streams_synthtrace_client.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class StreamsSynthtraceClient extends SynthtraceEsClient<StreamsDocument>
2424
...options,
2525
pipeline: streamsPipeline(),
2626
});
27-
this.dataStreams = ['logs', 'logs.*'];
27+
this.dataStreams = ['logs', 'logs.*', 'logs-generic-default'];
2828
}
2929

3030
async forkStream(
@@ -86,7 +86,12 @@ function streamsRoutingTransform() {
8686
return new Transform({
8787
objectMode: true,
8888
transform(document: ESDocumentWithOperation<StreamsDocument>, encoding, callback) {
89-
document._index = 'logs';
89+
// 50-50 send to logs or to logs-generic-default
90+
if (Math.random() > 0.5) {
91+
document._index = 'logs-generic-default';
92+
} else {
93+
document._index = 'logs';
94+
}
9095
callback(null, document);
9196
},
9297
});

0 commit comments

Comments
 (0)