node-clinic-doctor icon indicating copy to clipboard operation
node-clinic-doctor copied to clipboard

Introducing a delay on sample collection for the cli triggered doctor runs

Open fikret-buyukisik-bam opened this issue 3 years ago • 1 comments

Introduction

We can set a delay to start of sampling when we use node-clinic-doctor as a library. But there is no way to set that delay when it is called from clinic cli.

Why it is important?

The operations happening at the application start are creating noise in the collected data. If we could set a delay to sampling, we can easily bypass that and start sampling from relatively stable state of the application.

Expected Behavior

When we pass "NODE_CLINIC_DOCTOR_TIMEOUT_DELAY" env variable, sampling should start with a delay relative to application start.

Current Behavior

when "clinic doctor" is triggered from cli "NODE_CLINIC_DOCTOR_TIMEOUT_DELAY" environmental variable is always set to 0

Notes

The value coming from environmental variable is being overridden by "collectDelay" parameter coming from constructor at the line: https://github.com/clinicjs/node-clinic-doctor/blob/main/index.js:75 And clinic library is not setting the "collectDelay" parameter, therefore it is getting the default value of 0.

Environment

  • Clinic.js v10.0.0 Doctor v9.0.0
  • Node.js v14.17.3 npm 7.24.1
  • Brave 1.31.88
  • OSX 11.5.2

fikret-buyukisik-bam avatar Nov 30 '21 19:11 fikret-buyukisik-bam