Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
bitBucketSize: 64,
autoResize: true,
lowestDiscernibleValue: 1,
highestTrackableValue: 10000,
numberOfSignificantValueDigits: 5
})
const requests = hdr.build({
bitBucketSize: 64,
autoResize: true,
lowestDiscernibleValue: 1,
highestTrackableValue: 1000000,
numberOfSignificantValueDigits: 3
})
const throughput = hdr.build({
bitBucketSize: 64,
autoResize: true,
lowestDiscernibleValue: 1,
highestTrackableValue: 100000000000,
numberOfSignificantValueDigits: 3
})
const statusCodes = [
0, // 1xx
0, // 2xx
0, // 3xx
0, // 4xx
0 // 5xx
]
if (opts && opts.form) {
const clientConfig = {
serviceUrl: commander.url,
};
const client = new Pulsar.Client(clientConfig);
// Create a producer
const producerConfig = {
topic: commander.topic,
};
const producer = await client.createProducer(producerConfig);
const sizeOfMessage = commander.size;
const message = Buffer.alloc(sizeOfMessage, 1);
const numOfMessages = commander.messages;
for (let i = 0; i < commander.iteration; i += 1) {
const histogram = hdr.build({
bitBucketSize: 0,
highestTrackableValue: 120000 * 1000,
numberOfSignificantValueDigits: 5,
});
// measure
await delay(1000);
const startMeasureTimeMilliSeconds = performance.now();
for (let mi = 0; mi < numOfMessages; mi += 1) {
const startSendTimeMilliSeconds = performance.now();
producer.send({
data: message,
}).then(() => {
// add latency
histogram.recordValue((performance.now() - startSendTimeMilliSeconds));
});
tracker = tracker || new EE()
if (!cbPassedIn && !opts.forever) {
const promise = new Promise((resolve, reject) => {
_run(opts, function (err, results) {
if (err) return reject(err)
resolve(results)
}, tracker)
})
tracker.then = promise.then.bind(promise)
tracker.catch = promise.catch.bind(promise)
return tracker
}
const latencies = hdr.build({
bitBucketSize: 64,
autoResize: true,
lowestDiscernibleValue: 1,
highestTrackableValue: 10000,
numberOfSignificantValueDigits: 5
})
const requests = hdr.build({
bitBucketSize: 64,
autoResize: true,
lowestDiscernibleValue: 1,
highestTrackableValue: 1000000,
numberOfSignificantValueDigits: 3
})
const throughput = hdr.build({
}, tracker)
})
tracker.then = promise.then.bind(promise)
tracker.catch = promise.catch.bind(promise)
return tracker
}
const latencies = hdr.build({
bitBucketSize: 64,
autoResize: true,
lowestDiscernibleValue: 1,
highestTrackableValue: 10000,
numberOfSignificantValueDigits: 5
})
const requests = hdr.build({
bitBucketSize: 64,
autoResize: true,
lowestDiscernibleValue: 1,
highestTrackableValue: 1000000,
numberOfSignificantValueDigits: 3
})
const throughput = hdr.build({
bitBucketSize: 64,
autoResize: true,
lowestDiscernibleValue: 1,
highestTrackableValue: 100000000000,
numberOfSignificantValueDigits: 3
})
const statusCodes = [
constructor(boundaries: HistogramBoundaries, alogger?: Logger) {
this.logger = alogger || logger.logger();
this.boundaries = boundaries;
this.localHistogram = BuildHistogram({
bitBucketSize: 64,
autoResize: true,
lowestDiscernibleValue: 1,
highestTrackableValue: boundaries ? boundaries.range.max : 10000,
numberOfSignificantValueDigits: 3
});
this.localHistogram.startTimeStampMsec = Date.now();
}