Skip to content

Commit ca7eef5

Browse files
committed
Adding guidance on using Durable Object logs in the dashboard.
1 parent 66a287d commit ca7eef5

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

src/content/docs/durable-objects/observability/graphql-analytics.mdx

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar:
66

77
---
88

9-
import { GlossaryTooltip, DashButton } from "~/components";
9+
import { GlossaryTooltip, DashButton, Steps, WranglerConfig } from "~/components";
1010

1111
<GlossaryTooltip term="Durable Object">Durable Objects</GlossaryTooltip> expose analytics for Durable Object namespace-level and request-level metrics.
1212

@@ -21,15 +21,49 @@ A Durable Object namespace is a set of Durable Objects that can be addressed by
2121

2222
Per-namespace analytics for Durable Objects are available in the Cloudflare dashboard. To view current and historical metrics for a namespace:
2323

24+
<Steps>
2425
1. In the Cloudflare dashboard, go to the **Durable Objects** page.
2526

2627
<DashButton url="/?to=/:account/workers/durable-objects" />
2728
2. View account-level Durable Objects usage.
28-
3. Select an existing namespace.
29+
3. Select an existing Durable Object namespace.
2930
4. Select the **Metrics** tab.
31+
</Steps>
3032

3133
You can optionally select a time window to query. This defaults to the last 24 hours.
3234

35+
## View Durable Object logs from the dashboard
36+
37+
You can view Durable Object logs from the Cloudflare dashboard. Logs are aggregated by the script name and the Durable Object class name.
38+
39+
To start using Durable Object logging:
40+
41+
<Steps>
42+
1. Enable Durable Object logging in the Wrangler configuration file of the Worker that defines your Durable Object class:
43+
<WranglerConfig>
44+
```jsonc
45+
{
46+
"observability": {
47+
"enabled": true
48+
}
49+
}
50+
```
51+
</WranglerConfig>
52+
2. Deploy the latest version of the Worker with the updated binding.
53+
3. Go to the **Durable Objects** page.
54+
55+
<DashButton url="/?to=/:account/workers/durable-objects" />
56+
4. Select an existing Durable Object namespace.
57+
5. Select the **Logs** tab.
58+
- You can use the Durable Object instance ID (displayed as `$workers.durableObjectId`) to understand which specific Durable Object instance generated the log entry.
59+
60+
6. (Optional) Use filters and the search bar to quickly find the log event you are looking for.
61+
</Steps>
62+
63+
:::note
64+
For information on log limits (such as maximum log retention period), refer to the [Workers Logs documentation](/workers/observability/logs/workers-logs/#limits).
65+
:::
66+
3367
## Query via the GraphQL API
3468

3569
Durable Object metrics are powered by GraphQL.

0 commit comments

Comments
 (0)