ref(core): Do not send telemetry data for self-hosted users #120
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR turns telemetry off for self-hosted users, meaning that the plugin will only send Sentry events to Sentry.io if the URL used in the plugin (i.e. where sourcemaps are uploaded to) is sentry.io.
Unfortunately, this isn't entirely straight forward. Sentry-CLI will read a config file (
.sentryclirc) if it finds one. Either in the directory of a global CLI installation (default behaviour) or if a path to a config file was specified via theconfigFileoption. At option conversion time, we therefore don't know exactly yet, if the plugin is used for SaaS or self-hosted. We can only check theurloption andSENTRY_URLenv variable to make a first decision.Only at a later time, we can make a call to Sentry-CLI (with the
info) command which returns us the used Sentry server URL. At this point we can finally definitely make the call to leave telemetry running for SaaS or turn sending off for self-hosted.Note that I had to remove a call to Sentry for options validation which would until now have sent an error to Sentry in case of a validation error. However, given that this is mostly a user-facing config problem, I think we're not missing out on important data.
resolves #99