This PR adds another parameter to the constructor of the telemetry package to allow to pass it additional config params.
I've decided to go through this path to not cause a breaking change, but it may make sense to change the API (I don't have strong feeling about it).
The added parameters will make it easier to debug telemetry events without having to modify the code:
reportingFrequency: Allows to change how often to send metrics, this is useful to not have to wait 24h to send the metrics.
verboseMode: Logs all the requests that log any type of data, useful to debug if the client code works correctly.
logInDevMode: This makes telemetry send events also in Dev Mode. When using this option in dev mode, verboseMode is automatically enabled, so users don't forget to turn this option off after debugging.
The API could be different (e.g add the other constructor arguments to the options object).
Benefits
Much easier debugging of metrics. The current way to verify that a new metric is sent correctly is quite manual:
Check that atom/telemetry sends the correct payload to GitHub's backend. To do so, I've had to edit the code of the atom/telemetry package (more specifically, I've manually modified node_modules/telemetry-github/out/index.js to set the variable this.isDevMode to false (code). I've also had to increase how often Atom sends metrics, since by default it only sends them every 24 hours. To do so, I've set the variables DailyStatsReportIntervalInMs and ReportingLoopIntervalInMs located in the previous file to something like 15000 (code).
Description of the Change
This PR adds another parameter to the constructor of the
telemetry
package to allow to pass it additional config params.I've decided to go through this path to not cause a breaking change, but it may make sense to change the API (I don't have strong feeling about it).
The added parameters will make it easier to debug telemetry events without having to modify the code:
verboseMode
is automatically enabled, so users don't forget to turn this option off after debugging.Testing plan
Tested as part of https://github.com/atom/metrics/pull/110
Alternate Designs
The API could be different (e.g add the other constructor arguments to the
options
object).Benefits
Much easier debugging of metrics. The current way to verify that a new metric is sent correctly is quite manual:
Possible Drawbacks
N/A
Applicable Issues
N/A