Skip to content
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

[wrangler]: add wrangler telemetry commands and update existing info on telemetry collection #18350

Merged
merged 5 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ Inheritable keys are configurable at the top-level, and can be inherited (or ove

- `send_metrics` <Type text="boolean" /> <MetaInfo text="optional" />

- Whether Wrangler should send usage metrics to Cloudflare for this project.
- Whether Wrangler should send usage metrics to Cloudflare for this project. Defaults to `true`. You can learn more about this in our [data policy](https://github.com/cloudflare/workers-sdk/tree/main/packages/wrangler/telemetry.md).
emily-shen marked this conversation as resolved.
Show resolved Hide resolved

- `limits` Limits optional

Expand Down
33 changes: 33 additions & 0 deletions src/content/docs/workers/wrangler/commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Wrangler offers a number of commands to manage your Cloudflare Workers.
- [`dispatch-namespace`](#dispatch-namespace) - Interact with a [dispatch namespace](/cloudflare-for-platforms/workers-for-platforms/reference/how-workers-for-platforms-works/#dispatch-namespace).
- [`mtls-certificate`](#mtls-certificate) - Manage certificates used for mTLS connections.
- [`types`](#types) - Generate types from bindings and module rules in configuration.
- [`telemetry`](#telemetry) - Configure whether Wrangler can collect anonymous usage data.

:::note

Expand Down Expand Up @@ -2585,3 +2586,35 @@ The minimum required Wrangler version to use this command is 3.66.0.
- A custom path must have a `d.ts` extension.

<Render file="wrangler-commands/global-flags" product="workers" />

---

## `telemetry`

Cloudflare collects anonymous usage data to improve Wrangler. You can learn more about this in our [data policy](https://github.com/cloudflare/workers-sdk/tree/main/packages/wrangler/telemetry.md).

You can manage sharing of usage data at any time using these commands.

### `disable`

Disable telemetry collection for Wrangler.

```txt
wrangler telemetry disable
```

### `enable`

Enable telemetry collection for Wrangler.

```txt
wrangler telemetry enable
```

### `status`

Check whether telemetry collection is currently enabled. This will resolve the global status set by `wrangler telemetry disable / enable`, the environment variable [`WRANGLER_SEND_METRICS`](/workers/wrangler/system-environment-variables/#supported-environment-variables) and the [`send_metrics`](/workers/wrangler/configuration/#top-level-only-keys) key in `wrangler.toml`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a very basic question, but what do we mean by "resolve"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

telemetry could be set at a project or user/global level, so this command 'resolves' the telemetry status given where you've run the command. so if you've globally enabled it with npx wrangler telemetry enable but put in send_metrics=false in a specific projects' config, then running npx wrangler telemetry status while you're in that project folder would say telemetry is disabled.

happy to update if you've got a better way of phrasing it though! :))

emily-shen marked this conversation as resolved.
Show resolved Hide resolved

```txt
wrangler telemetry status
```
2 changes: 1 addition & 1 deletion src/content/docs/workers/wrangler/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Top-level keys apply to the Worker as a whole (and therefore all environments).

- `send_metrics` <Type text="boolean" /> <MetaInfo text="optional" />

- Whether Wrangler should send usage metrics to Cloudflare for this project.
- Whether Wrangler should send usage metrics to Cloudflare for this project. Defaults to `true`. You can learn more about this in our [data policy](https://github.com/cloudflare/workers-sdk/tree/main/packages/wrangler/telemetry.md).
emily-shen marked this conversation as resolved.
Show resolved Hide resolved

- `site` <Type text="object" /> <MetaInfo text="optional deprecated" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Wrangler supports the following environment variables:

* `WRANGLER_SEND_METRICS` <Type text="string" /> <MetaInfo text="optional" />

* Options for this are `true` and `false`, the default behavior is `false`.
* Options for this are `true` and `false`. Defaults to `true`. Controls whether Wrangler can send anonymous usage data to Cloudflare for this project. You can learn more about this in our [data policy](https://github.com/cloudflare/workers-sdk/tree/main/packages/wrangler/telemetry.md).

* `WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_<BINDING_NAME>`<Type text="string" /> <MetaInfo text="optional" />

Expand All @@ -52,7 +52,7 @@ Wrangler supports the following environment variables:

* `WRANGLER_LOG` <Type text="string" /> <MetaInfo text="optional" />

* Options for Logging levels are `"none"`, `"error"`, `"warn"`, `"info"`, `"log"` and `"debug"`. Levels are case-insensitive and default to `"log"`. If an invalid level is specified, Wrangler will fallback to the default.
* Options for Logging levels are `"none"`, `"error"`, `"warn"`, `"info"`, `"log"` and `"debug"`. Levels are case-insensitive and default to `"log"`. If an invalid level is specified, Wrangler will fallback to the default. Logs can include requests to Cloudflare's API, any usage data being collected, and more verbose error logs.

* `FORCE_COLOR` <Type text="string" /> <MetaInfo text="optional" />

Expand Down
Loading