Skip to content

Commit c0f87fd

Browse files
taylorleeharshil1712
authored andcommitted
Fix durable-object and observability sections of wrangler.toml docs (#17800)
* [Workers] Document Durable Object migrations in configuration and add missing brace in renamed_classes * [Workers] Fix observabilty and logpush wrangler configuration * fix type info * remove duplicate example toml key * link to logpush info * [Workers] lift observability in wrangler configuration It is not a binding. It is a script-setting, which lives somewhere between triggers and versioned settings (including bindings).
1 parent aa8cebe commit c0f87fd

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

src/content/docs/workers/wrangler/configuration.mdx

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ Top-level keys apply to the Worker as a whole (and therefore all environments).
6363

6464
- Whether Wrangler should keep variables configured in the dashboard on deploy. Refer to [source of truth](#source-of-truth).
6565

66+
- `migrations` <Type text="object[]" /> <MetaInfo text="optional" />
67+
68+
- When making changes to your Durable Object classes, you must perform a migration. Refer to [Durable Object migrations](/durable-objects/reference/durable-objects-migrations/).
69+
6670
- `send_metrics` <Type text="boolean" /> <MetaInfo text="optional" />
6771

6872
- Whether Wrangler should send usage metrics to Cloudflare for this project.
@@ -161,13 +165,13 @@ At a minimum, the `name`, `main` and `compatibility_date` keys are required to d
161165

162166
- `logpush` <Type text="boolean" /> <MetaInfo text="optional" />
163167

164-
- Enables Workers Trace Events Logpush for a Worker. Any scripts with this property will automatically get picked up by the Workers Logpush job configured for your account. Defaults to `false`.
168+
- Enables Workers Trace Events Logpush for a Worker. Any scripts with this property will automatically get picked up by the Workers Logpush job configured for your account. Defaults to `false`. Refer to [Workers Logpush](/workers/observability/logs/logpush/).
165169

166170
- `limits` <Type text="Limits" /> <MetaInfo text="optional" />
167171

168172
- Configures limits to be imposed on execution at runtime. Refer to [Limits](#limits).
169173

170-
* `observability` object optional
174+
* `observability` <Type text="object" /> <MetaInfo text="optional" />
171175

172176
- Configures automatic observability settings for telemetry data emitted from your Worker. Refer to [Observability](#observability).
173177

@@ -322,6 +326,26 @@ Example:
322326
crons = ["* * * * *"]
323327
```
324328

329+
## Observability
330+
331+
The [Observability](/workers/observability/logs/workers-logs) setting allows you to automatically ingest, store, filter, and analyze logging data emitted from Cloudflare Workers directly from your Cloudflare Worker's dashboard.
332+
333+
- `enabled` <Type text="boolean" /> <MetaInfo text="required" />
334+
335+
- When set to `true` on a Worker, logs for the Worker are persisted. Defaults to `true` for all new Workers.
336+
337+
- `head_sampling_rate` <Type text="number" /> <MetaInfo text="optional" />
338+
- A number between 0 and 1, where 0 indicates zero out of one hundred requests are logged, and 1 indicates every request is logged. If `head_sampling_rate` is unspecified, it is configured to a default value of 1 (100%). Read more about [head-based sampling](/workers/observability/logs/workers-logs/#head-based-sampling).
339+
340+
Example:
341+
342+
```toml title="wrangler.toml"
343+
[observability]
344+
enabled = true
345+
head_sampling_rate = 0.1 # 10% of requests are logged
346+
```
347+
348+
325349
## Custom builds
326350

327351
You can configure a custom build step that will be run before your Worker is deployed. Refer to [Custom builds](/workers/wrangler/custom-builds/).
@@ -510,7 +534,7 @@ When making changes to your Durable Object classes, you must perform a migration
510534

511535
- The new Durable Objects being defined.
512536

513-
- `renamed_classes` <Type text="from: string, to: string}[]" /> <MetaInfo text="optional" />
537+
- `renamed_classes` <Type text="{from: string, to: string}[]" /> <MetaInfo text="optional" />
514538

515539
- The Durable Objects being renamed.
516540

@@ -629,28 +653,6 @@ binding = "<BINDING_NAME2>"
629653
id = "<NAMESPACE_ID2>"
630654
```
631655

632-
### Observability
633-
634-
The [Observability](/workers/observability/logs/workers-logs) setting allows you to automatically ingest, store, filter, and analyze logging data emitted from Cloudflare Workers directly from your Cloudflare Worker's dashboard.
635-
636-
- `enabled` boolean required
637-
638-
- When set to `true` on a Worker, logs for the Worker are persisted. Defaults to `true` for all new Workers.
639-
640-
- `head_sampling_rate` number optional
641-
- A number between 0 and 1, where 0 indicates zero out of one hundred requests are logged, and 1 indicates every request is logged. If `head_sampling_rate` is unspecified, it is configured to a default value of 1 (100%). Read more about [head-based sampling](/workers/observability/logs/workers-logs/#head-based-sampling).
642-
643-
Example:
644-
645-
```toml title="wrangler.toml"
646-
[observability]
647-
enabled = true
648-
649-
[observability]
650-
enabled = true
651-
head_sampling_rate = 0.1 # 10% of requests are logged
652-
```
653-
654656
### Queues
655657

656658
[Queues](/queues/) is Cloudflare's global message queueing service, providing [guaranteed delivery](/queues/reference/delivery-guarantees/) and [message batching](/queues/configuration/batching-retries/). To interact with a queue with Workers, you need a producer Worker to send messages to the queue and a consumer Worker to pull batches of messages out of the Queue. A single Worker can produce to and consume from multiple Queues.

0 commit comments

Comments
 (0)