Unable to Disable Logging by Setting samplingRate to Zero
gunzip opened this issue · comments
In certain scenarios, it is useful to completely suppress logging by setting the samplingRate
to zero. However, the current code prevents this by taking the default value when samplingRate
is set to zero, as shown in the following segment:
To address this, we need to modify the code to allow samplingRate to be set to zero without reverting to the default value. This change will provide greater flexibility in controlling logging behavior.
@gunzip I agree that this should be possible. Looks like the current implementation contains an oversight regarding 0 being falsy. I'll update this and link the PR to this issue.
@gunzip Working on getting a fix in at the moment. I am curious though what scenario you rely on this 0 sampling rate for. Is this for testing scenarios? Or some other use case?
Yes, exactly. I'm doing some tests to compute AI overhead at different levels of sampling. Moreover it's useful when you have a setup for staging slots, ie. using some sticky setting.
Consider also that the current README states:
Setting samplingPercentage to 100 (the default) means all data will be sent, and 0 means nothing will be sent.
When in reality you currently obtain a defaut to 100% sampling, which of course increase costs.