Skip to content

Commit a286f4c

Browse files
authored
[workers-observability] wrangler observability setting configuration (#16787)
Co-authored-by: Rohin Lohe <[email protected]>
1 parent 3f63fd0 commit a286f4c

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

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

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,11 @@ At a minimum, the `name`, `main` and `compatibility_date` keys are required to d
156156

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

159-
* `assets` <Type text="Assets" /> <MetaInfo text="optional" />
159+
* `observability` object optional
160+
161+
* Configures automatic observability settings for telemetry data emitted from your Worker. Refer to [Observability](#observability).
160162

163+
* `assets` <Type text="Assets" /> <MetaInfo text="optional" />
161164
- Configures static assets that will be served. Refer to [Assets](/workers/static-assets/binding/) for more details.
162165

163166
### Usage model
@@ -611,6 +614,27 @@ binding = "<BINDING_NAME2>"
611614
id = "<NAMESPACE_ID2>"
612615
```
613616

617+
### Observability
618+
619+
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.
620+
621+
* `enabled` boolean required
622+
* When set to `true` on a Worker, logs for the Worker are persisted. Defaults to `true` for all new Workers.
623+
624+
* `head_sampling_rate` number optional
625+
* 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).
626+
627+
Example:
628+
629+
```toml title="wrangler.toml"
630+
[observability]
631+
enabled = true
632+
633+
[observability]
634+
enabled = true
635+
head_sampling_rate = 0.1 # 10% of requests are logged
636+
```
637+
614638
### Queues
615639

616640
[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)