Skip to content

Commit ab77347

Browse files
authored
Sample logs scenario - send to wired streams and classic streams at the same time (#220737)
To be able to better test classic vs. wired streams, this PR expands the `sample_logs` scenario to send to both of these places. <img width="1130" alt="Screenshot 2025-05-11 at 10 55 36" src="https://github.com/user-attachments/assets/0e75c82e-e96c-4f81-abcc-32347cd82d6b" /> ``` node scripts/synthtrace.js sample_logs --live --kibana=http://elastic:changeme@localhost:5601 --target=http://elastic:changeme@localhost:9200 --liveBucketSize=1000 ```
1 parent 6fa3152 commit ab77347

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)