Skip to content

Commit 3e6d35b

Browse files
Oxyjunpedrosousa
andauthored
[DO] Adding guidance on using Durable Object logs in the dashboard. (#24996)
* Adding guidance on using Durable Object logs in the dashboard. * Implementing feedback * Accepting wording change * Update src/content/docs/data-localization/metadata-boundary/graphql-datasets.mdx Co-authored-by: Pedro Sousa <[email protected]> --------- Co-authored-by: Pedro Sousa <[email protected]>
1 parent 311cecf commit 3e6d35b

File tree

6 files changed

+56
-7
lines changed

6 files changed

+56
-7
lines changed

public/__redirects

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@
565565
/durable-objects/get-started/video-series/ /durable-objects/video-tutorials/ 301
566566

567567
/durable-objects/what-are-durable-objects/ /durable-objects/concepts/what-are-durable-objects/ 301
568+
/durable-objects/observability/graphql-analytics/ /durable-objects/observability/metrics-and-analytics/ 301
568569

569570
# email-routing
570571
/email-routing/enable-email-routing/ /email-routing/get-started/enable-email-routing/ 301

src/content/docs/data-localization/metadata-boundary/graphql-datasets.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The table below shows a non-exhaustive list of GraphQL Analytics API fields that
3333
| WAF/L7 Firewall | | US and EU <br/> [`firewallEventsAdaptive`](/analytics/graphql-api/tutorials/querying-firewall-events/) <br/> [`firewallEventsAdaptiveGroups`](https://blog.cloudflare.com/how-we-used-our-new-graphql-api-to-build-firewall-analytics/) <br/> `firewallEventsAdaptiveByTimeGroups` |
3434
| Developer Platform | Cloudflare Images | US only <br/> `imagesRequestsAdaptiveGroups` |
3535
| Cloudflare Pages | | US only <br/> `pagesFunctionsInvocationsAdaptiveGroups` <br/> |
36-
| Durable Objects | | US only <br/> [`durableObjectsInvocationsAdaptiveGroups`](/durable-objects/observability/graphql-analytics/) <br/> [`durableObjectsPeriodicGroups`](/durable-objects/observability/graphql-analytics/) <br/> [`durableObjectsStorageGroups`](/durable-objects/observability/graphql-analytics/) <br/> [`durableObjectsSubrequestsAdaptiveGroups`](/durable-objects/observability/graphql-analytics/) |
36+
| Durable Objects | | US only <br/> [`durableObjectsInvocationsAdaptiveGroups`](/durable-objects/observability/metrics-and-analytics/) <br/> [`durableObjectsPeriodicGroups`](/durable-objects/observability/metrics-and-analytics/) <br/> [`durableObjectsStorageGroups`](/durable-objects/observability/metrics-and-analytics/) <br/> [`durableObjectsSubrequestsAdaptiveGroups`](/durable-objects/observability/metrics-and-analytics/) |
3737
| Email Routing | | US and EU <br/> `emailRoutingAdaptive` <br/> `emailRoutingAdaptiveGroups` |
3838
| R2 | | US and EU <br/> `r2OperationsAdaptiveGroups` <br/> `r2StorageAdaptiveGroups` |
3939
| Stream | | US only <br/> [`streamMinutesViewedAdaptiveGroups`](/stream/getting-analytics/fetching-bulk-analytics/) <br/> [`videoPlaybackEventsAdaptiveGroups`](/stream/getting-analytics/fetching-bulk-analytics/) <br/> [`videoBufferEventsAdaptiveGroups`](/stream/getting-analytics/fetching-bulk-analytics/) <br/> [`videoQualityEventsAdaptiveGroups`](/stream/getting-analytics/fetching-bulk-analytics/) |

src/content/docs/durable-objects/observability/graphql-analytics.mdx renamed to src/content/docs/durable-objects/observability/metrics-and-analytics.mdx

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: Metrics and GraphQL analytics
2+
title: Metrics and analytics
33
pcx_content_type: concept
44
sidebar:
55
order: 6
66

77
---
88

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

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

@@ -17,19 +17,51 @@ The metrics displayed in the [Cloudflare dashboard](https://dash.cloudflare.com/
1717
A Durable Object namespace is a set of Durable Objects that can be addressed by name, backed by the same class. There is only one Durable Object namespace per class. A Durable Object namespace can contain any number of Durable Objects.
1818
:::
1919

20-
## View metrics and analytics via the dashboard
20+
## View metrics and analytics
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 logs
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+
59+
</Steps>
60+
61+
:::note
62+
For information on log limits (such as maximum log retention period), refer to the [Workers Logs documentation](/workers/observability/logs/workers-logs/#limits).
63+
:::
64+
3365
## Query via the GraphQL API
3466

3567
Durable Object metrics are powered by GraphQL.
@@ -85,4 +117,8 @@ Refer to the [Querying Workers Metrics with GraphQL](/analytics/graphql-api/tuto
85117

86118
## Additional resources
87119

88-
- For instructions on setting up a Grafana dashboard to query Cloudflare's GraphQL Analytics API, refer to [Grafana Dashboard starter for Durable Object metrics](https://github.com/TimoWilhelm/grafana-do-dashboard).
120+
- For instructions on setting up a Grafana dashboard to query Cloudflare's GraphQL Analytics API, refer to [Grafana Dashboard starter for Durable Object metrics](https://github.com/TimoWilhelm/grafana-do-dashboard).
121+
122+
## FAQs
123+
124+
<Render file="do-faq-metrics-and-analytics" product="durable-objects" />

src/content/docs/durable-objects/reference/faq.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ import { Render } from "~/components";
1616

1717
<Render file="do-faq-limits" product="durable-objects"/>
1818

19+
## Metrics and analytics
20+
21+
<Render file="do-faq-metrics-and-analytics" product="durable-objects"/>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
{}
3+
---
4+
5+
import {GlossaryTooltip, WranglerConfig} from "~/components";
6+
7+
### How can I identify which Durable Object instance generated a log entry?
8+
9+
You can use `$workers.durableObjectId` to identify the specific Durable Object instance that generated the log entry.

src/content/release-notes/durable-objects.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ entries:
6969
description: |-
7070
Durable Objects [request billing](/durable-objects/platform/pricing/#billing-metrics) applies a 20:1 ratio for incoming WebSocket messages. For example, 1 million Websocket received messages across connections would be charged as 50,000 Durable Objects requests.
7171
72-
This is a billing-only calculation and does not impact Durable Objects [metrics and analytics](/durable-objects/observability/graphql-analytics/).
72+
This is a billing-only calculation and does not impact Durable Objects [metrics and analytics](/durable-objects/observability/metrics-and-analytics/).
7373
7474
- publish_date: "2024-02-15"
7575
title: Optional `alarmInfo` parameter for Durable Object Alarms

0 commit comments

Comments
 (0)