Skip to content

Commit fb6ac39

Browse files
committed
wip
1 parent c952dfc commit fb6ac39

File tree

9 files changed

+131
-107
lines changed

9 files changed

+131
-107
lines changed

package-lock.json

Lines changed: 98 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"devDependencies": {
2828
"@actions/core": "1.11.1",
2929
"@actions/github": "6.0.1",
30+
"@anthropic-ai/sdk": "0.63.0",
3031
"@apidevtools/swagger-parser": "12.0.0",
3132
"@astrojs/check": "0.9.4",
3233
"@astrojs/react": "4.2.5",

src/content/docs/workers/observability/exporting-opentelemetry-data/3rd-party-destinations/datadog.mdx

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/content/docs/workers/observability/exporting-opentelemetry-data/3rd-party-destinations/grafana.mdx

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/content/docs/workers/observability/exporting-opentelemetry-data/3rd-party-destinations/honeycomb.mdx

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/content/docs/workers/observability/exporting-opentelemetry-data/3rd-party-destinations/index.mdx

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/content/docs/workers/observability/exporting-opentelemetry-data/3rd-party-destinations/sentry.mdx

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/content/docs/workers/observability/exporting-opentelemetry-data/index.mdx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,10 @@ You can export the following types of telemetry data:
1515

1616
- **Traces** - Traces showing request flows through your Worker and connected services
1717
- **Logs** - Application logs including `console.log()` output and system-generated logs
18-
- **Metrics** - Performance metrics and custom measurements (not yet supported - coming soon)
18+
- **Metrics** - Performance metrics and custom measurements (**not yet supported**)
1919

2020
### Supported destinations
21-
22-
Cloudflare Workers can export data to any platform that supports the OpenTelemetry Protocol (OTLP), including:
23-
- Datadog
24-
- Honeycomb
25-
- Grafana Cloud
26-
- Sentry
27-
- Custom OTLP endpoints
21+
Cloudflare Workers can export data to any platform that supports proper OpenTelemetry Protocol (OTLP) endpoints (e.g. `https://api.honeycomb.io/v1/traces`)
2822

2923
## Setting up OpenTelemetry-compatible destinations
3024

@@ -37,7 +31,7 @@ Before you can export telemetry data, you need to create and configure a destina
3731
- **Destination Name** - A descriptive name (e.g., "Datadog APM", "Honeycomb Logs")
3832
- **Destination Type** - Choose between "Traces" or "Logs"
3933
- **OTLP Endpoint** - The URL where your observability platform accepts OTLP data. This endpoint should end in `/logs` or /traces`
40-
- **Custom Headers** (Optional) - Add any authentication headers or other required headers
34+
- **Custom Headers** (Optional) - Any authentication headers or other required headers
4135

4236
## Enabling OpenTelemetry export for your Worker
4337

@@ -60,10 +54,4 @@ After setting up destinations in the dashboard, configure your Worker to export
6054
}
6155
}
6256
```
63-
Then redeploy your Worker for new configurations to take effect.
64-
65-
### Configuration options
66-
- **`enabled`** - Enable or disable telemetry collection
67-
- **`head_sample_rate`** - Percentage of requests to sample (0.0 to 1.0)
68-
- **`destinations`** - Array of destination names to export data to. These should be from the destination names created in the dashboard. Include `"cloudflare"` in this array to also send traces and logs to the Workers Dashboard.
69-
57+
Then redeploy your Worker for new configurations to take effect. It may take a few minutes for events to reach your destination.

src/content/docs/workers/observability/traces/index.mdx

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,66 +7,65 @@ sidebar:
77
hideIndex: false
88
---
99

10-
import { Badge, DirectoryListing } from "~/components";
10+
## What is Workers tracing?
1111

1212
Tracing gives you end-to-end visibility into the life of a request as it travels through your Workers application and connected services, helping you to identify performance bottlenecks, debug issues, and understand complex request flows.
1313

1414
With tracing you can answer questions such as:
1515
* What is the cause of a long-running request?
16-
* Where in the chain of services did a request fail?
1716
* How long do subrequests to my Worker take?
1817
* How long are my requests to my KV Namespace or R2 bucket taking?
1918

2019
## Automatic instrumentation
2120

2221
Each trace consists of one or more spans, representing the various calls made to different Worker services as part of the invocation. Cloudflare has automatically instrumented fetch calls and requests to Cloudflare resources (e.g. Workers KV, D1 Databases, Durable Objects) bound to your Workers application, without requiring you to install and configure an OpenTelemetry SDK.
2322

24-
Take for example, application that handles online ordering and makes request to a D1 Database to fetch customer information, an external API to validate payment information, and a Cloudflare Queue to submit the order.
23+
Take for example, an application that handles online ordering and makes request to a D1 Database to fetch customer information, an external API to validate payment information, and a Cloudflare Queue to submit the order. Tracing lets you visualize an invocation call by call at each part of the request journey. Our example above may look something like this:
2524

26-
Tracing lets you visualize an invocation call by call at each part of the request journey. Our example above may look something like this:
25+
**TODO: insert example of trace here**
2726

28-
TODO: insert example of trace here
27+
While our work for automatic instrumentation is ongoing, we've [documented](/workers/observability/traces/spans-and-attributes) all existing spans and attributes currently instrumented today.
2928

3029
## How to enable tracing
3130

32-
If you would like to view traces in the Cloudflare Dashboard using Workers Observability, you can set the following in your Wrangler configuration file:
31+
To view traces in the Workers dashboard, you can set the following in your Wrangler configuration file:
3332

3433
```jsonc title="wrangler.jsonc"
3534

36-
{
37-
"observability": {
38-
// enabling traces
39-
"traces": {
40-
"enabled": true,
41-
},
42-
}
35+
"observability": {
36+
// enabling traces
37+
"traces": {
38+
"enabled": true
39+
},
4340
}
44-
```
4541

46-
You can also export OpenTelemetry traces to a 3rd party destination such as Datadog or Honeycomb.
42+
```
43+
Or simply include the following to persist logs **and** traces to the Workers dashboard:
4744

48-
### Exporting OpenTelemetry traces to a 3rd party destination
45+
```jsonc title="wrangler.jsonc"
4946

50-
In addition to viewing traces in the Cloudflare Dashboard, you can export traces to any OpenTelemetry-compatible destination, including popular platforms such as Datadog and Honeycomb.
47+
"observability": {
48+
"enabled": true
49+
}
5150

52-
To configure trace export to external destinations, you'll need to set up a destination in the Cloudflare dashboard and set your desired destination within your Wrangler configuration.
51+
```
5352

53+
### Exporting OpenTelemetry traces to a 3rd party destination
54+
You can also export [OpenTelemetry](https://opentelemetry.io/) (OTel) traces to a 3rd party destination such as Honeycomb by [setting up an external destination](/src/content/docs/workers/observability/exporting-opentelemetry-data/index.mdx) in the Cloudflare dashboard and setting that destination in your Wrangler configuration file. Learn more [here](/src/content/docs/workers/observability/exporting-opentelemetry-data/index.mdx).
5455

5556
## Head-based sampling
57+
Head-based sampling allows you to trace a percentage of incoming requests in your Cloudflare Worker. With sampling, you can help reduce volume and manage costs, while still providing meaningful insights into your application. You can configure head-based sampling for both tracing and logging separately on a per-Worker basis.
5658

57-
Head-based sampling allows you to trace a percentage of incoming requests in your Cloudflare Worker. Most production applications at scale use head sampling because it is unnecessary and costly to trace every single request. With sampling, you can help reduce volume and manage costs, while still providing meaningful insights into your application.
58-
59-
You can configure head-based sampling for both tracing and logging separately on a per-Worker basis. The valid range is from 0 to 1, where 0 indicates zero out of one hundred invocations will be traced, and 1 indicates every requests will be traced. If head_sampling_rate is unspecified, it defaults to tracing 100% of requests.
59+
The valid range is from 0 to 1, where 0 indicates zero out of one hundred invocations will be traced, and 1 indicates every requests will be traced. If `head_sampling_rate` is unspecified, it defaults to tracing 100% of requests.
6060

61-
You can configure this in your Wrangler configuration like this:
61+
You can configure `head_sampling_rate` in your Wrangler configuration. If you have logs enabled with a `head_sampling_rate`, you can create a separate `head_sampling_rate` for traces.
6262

6363
```jsonc title="wrangler.jsonc"
6464

65-
{
65+
"observability":{
6666
"tracing": {
6767

6868
"enabled": true
69-
"destinations": ["datadog"]
7069
// set tracing sampling rate to 5%
7170
"head_sample_rate": 0.05
7271
},
@@ -85,16 +84,14 @@ Workers tracing is currently **free** during the early beta period. This include
8584

8685
Starting on xx/xx/xxxx, tracing will be billed as part of Workers observability. Each span in a trace counts as one observability event, sharing the same monthly quota and pricing as [Workers logs](https://developers.cloudflare.com/workers/platform/pricing/#workers-logs):
8786

88-
| | Events (trace spans or log events) | Retention |
87+
| | Events (trace spans or log events) | Retention |
8988
| ---------------- | ------------------------------------------------------------------------- | --------- |
9089
| **Workers Free** | 100,000 per day | 3 Days |
9190
| **Workers Paid** | 10 million included per month <br /> +$0.05 per additional 100,000 events | 30 Days |
9291

93-
When billing begins on xx/xx/xxxx, you'll automatically start being charged based on your plan.
94-
95-
96-
## [Spans and attributes](/workers/observability/traces/spans-and-attributes)
97-
While our work for automatic instrumentation is ongoing, we've documented all existing spans and attributes currently instrumented today.
92+
On xx/xx/xxxx, you will start being billed for your tracing usage.
9893

94+
## Known issues
95+
- Trace context propagation
96+
- Custom spans and attributes
9997

100-
<DirectoryListing />

0 commit comments

Comments
 (0)