Skip to content

Commit

Permalink
Skip intermediate stream ListRecordStream
Browse files Browse the repository at this point in the history
  • Loading branch information
BourgoisMickael committed Dec 30, 2024
1 parent df54ae7 commit a1eeff9
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/storage/metadata/bucketclient/LogConsumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,12 @@ class LogConsumer {
* @return {undefined}
*/
readRecords(params, cb) {
const recordStream = new ListRecordStream(this.logger, this.metrics);
let recordStream;
if (process.env.LOG_CONSUMER_SKIP_RECORD_STREAM) {
recordStream = new stream.PassThrough();
} else {
recordStream = new ListRecordStream(this.logger, this.metrics);
}
const _params = params || {};
const cbOnce = jsutil.once(cb);

Expand Down Expand Up @@ -267,6 +272,14 @@ class LogConsumer {
this.metrics.json.readOn.data.inc();
this.metrics.json.writeBufferLength.observe(jsonResponse.buffer.length);
this.metrics.json.readFlowing[+!jsonResponse.paused].inc();

if (process.env.LOG_CONSUMER_SKIP_RECORD_STREAM) {
this.metrics.record.readBufferLength.observe(recordStream.readableLength);
this.metrics.record.readFlowing[+recordStream.readableFlowing || 0].inc();
this.metrics.record.writeBufferLength.observe(recordStream.writableLength);
this.metrics.record.writeDrain[+recordStream.writableNeedDrain || 0].inc();
this.metrics.record.writeCorked.observe(recordStream.writableCorked);
}
});
jsonResponse.on('resume', () => {
this.metrics.json.readOn.resume.inc();
Expand Down

0 comments on commit a1eeff9

Please sign in to comment.