Skip to content

Commit a56160d

Browse files
committed
feat(WO-1109): update workers for platforms logs to include otel exports/tracing
1 parent 6acdfca commit a56160d

File tree

1 file changed

+31
-5
lines changed
  • src/content/docs/cloudflare-for-platforms/workers-for-platforms/configuration

1 file changed

+31
-5
lines changed

src/content/docs/cloudflare-for-platforms/workers-for-platforms/configuration/observability.mdx

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
pcx_content_type: concept
33
title: Observability
4-
54
---
65

7-
Workers for Platforms provides you with logs and analytics that can be used to share data with end users.
6+
Workers for Platforms provides you with logs, traces, and analytics that can be used to share data with end users.
87

98
## Logs
109

@@ -29,16 +28,43 @@ A [Tail Worker](/workers/observability/logs/tail-workers/) receives information
2928

3029
Use [Tail Workers](/workers/observability/logs/tail-workers/) instead of Logpush if you want granular control over formatting before logs are sent to their destination to receive [diagnostics channel events](/workers/runtime-apis/nodejs/diagnostics-channel), or if you want logs delivered in real-time.
3130

32-
Adding a Tail Worker to your dispatch Worker collects logs for both the dispatch Worker and for any user Workers in the dispatch namespace. Logs are automatically collected for all new Workers added to a dispatch namespace. To enable logging for an individual user Worker rather than an entire dispatch namespace, add the [Tail Worker configuration](/workers/observability/logs/tail-workers/#configure-tail-workers) directly to the user Worker.
31+
Adding a Tail Worker to your dispatch Worker collects logs for both the dispatch Worker and for any user Workers in the dispatch namespace. Logs are automatically collected for all new Workers added to a dispatch namespace. To enable logging for an individual user Worker rather than an entire dispatch namespace, add the [Tail Worker configuration](/workers/observability/logs/tail-workers/#configure-tail-workers) directly to the user Worker.
3332

3433
## Analytics
3534

3635
There are two ways for you to review your Workers for Platforms analytics.
3736

3837
### Workers Analytics Engine
3938

40-
[Workers Analytics Engine](/analytics/analytics-engine/) can be used with Workers for Platforms to provide analytics to end users. It can be used to expose events relating to a Workers invocation or custom user-defined events. Platforms can write/query events by script tag to get aggregates over a users usage.
39+
[Workers Analytics Engine](/analytics/analytics-engine/) can be used with Workers for Platforms to provide analytics to end users. It can be used to expose events relating to a Workers invocation or custom user-defined events. Platforms can write/query events by script tag to get aggregates over a user's usage.
4140

4241
### GraphQL Analytics API
4342

44-
Use Cloudflare’s [GraphQL Analytics API](/analytics/graphql-api) to get metrics relating to your Dispatch Namespaces. Use the `dispatchNamespaceName` dimension in the `workersInvocationsAdaptive` node to query usage by namespace.
43+
Use Cloudflare's [GraphQL Analytics API](/analytics/graphql-api) to get metrics relating to your Dispatch Namespaces. Use the `dispatchNamespaceName` dimension in the `workersInvocationsAdaptive` node to query usage by namespace.
44+
45+
## OpenTelemetry Exports
46+
47+
Workers for Platforms supports exporting traces and application logs from user Workers to any [supported OpenTelemetry destination](/workers/observability/exporting-opentelemetry-data/#available-opentelemetry-destinations). To configure this, [create a destination](/workers/observability/exporting-opentelemetry-data/#creating-a-destination) in the Cloudflare dashboard, then set the `observability` field in the worker metadata when uploading the user Worker via the [dispatch namespace API](/cloudflare-for-platforms/workers-for-platforms/platform/management/#upload-a-user-worker).
48+
49+
To enable log and trace export when uploading a user Worker:
50+
51+
```js
52+
await client.workersForPlatforms.dispatch.namespaces.scripts.update(
53+
"my-dispatch-namespace",
54+
"user-worker-name",
55+
{
56+
account_id: "your-account-id",
57+
metadata: {
58+
main_module: "worker.js",
59+
observability: {
60+
logs: { enabled: true, destinations: ["logs-destination"] },
61+
traces: { enabled: true, destinations: ["traces-destination"] },
62+
},
63+
},
64+
},
65+
);
66+
```
67+
68+
Exported telemetry include the `cloudflare.dispatch_namespace` attribute, which identifies the dispatch namespace the user Worker belongs to.
69+
70+
For details on supported destinations, limits, and pricing, refer to [Exporting OpenTelemetry Data](/workers/observability/exporting-opentelemetry-data/).

0 commit comments

Comments
 (0)