-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add configuration option to disable CLI telemetry #12128
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: f690a58 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
Wouldn't this config option still has the caveat mentioned at #11820 (comment) (and the telemetry is disabled later than the The absolute solution would be what Matthew suggested or a new CLI flag (which isn't exactly the cleanest either). I can't think of a cleaner way around this 🤔 |
From what I can see, the only problem is the notification that it prints about use of telemetry. There's nothing that logs before the config is loaded. Perhaps if we immediately printed that telemetry is disabled for this site that would be ok. |
import { defineConfig } from 'astro/config'; | ||
|
||
export default defineConfig({ | ||
disableTelemetry: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be nicer to have telemetry: boolean
, defaulting to true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I didn;t go with that is because it might imply that it overrides the global setting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because telemetry starts before the config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I mean that naming it like that might make users thing that true
would override their global values, but actually true
would mean "true unless there's a global override or environment variable to disable it".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm i see. I think I'd still prefer telemetry: boolean
but log a warning if there's a mismatch with a global override
I think you're right. Looks like the places where we call However there's an edge case here where we possibly can't based on the config to determine that:
If we can figure out how to log the telemetry state correctly, and always respect the config, then that would be the best I think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preemptively approving for docs here, as these look fabulous, and I trust if things change with the configuration option, the docs will be updated just as fabulously! 🚀
* @description | ||
* Disable anonymous telemetry collection for this project. | ||
* | ||
* You can also disable telemetry globally by running `astro telemetry disable`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* You can also disable telemetry globally by running `astro telemetry disable`. | |
* You can also disable telemetry globally from the CLI by running [`astro telemetry disable`](/en/reference/cli-reference/#astro-telemetry)`. |
Just thought the link might be handy here! That section also has a tip for setting the environment variable, so might be nice to surface it.
Changes
This change adds a new configuration option to disable telemetry for the project.
Fixes #11820
Testing
Adds tests
Docs
Adds a config option