Skip to content

Commit 1005ce9

Browse files
committed
Add detailed guide for exporting OpenTelemetry data to Grafana Cloud, including prerequisites, setup steps, and configuration examples for both wrangler.jsonc and wrangler.toml. This enhances the observability documentation by providing users with clear instructions on integrating Cloudflare Workers with Grafana Cloud for telemetry data visualization and analysis.
1 parent f5e1009 commit 1005ce9

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed
145 KB
Loading

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

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,86 @@ sidebar:
55
order: 2
66
---
77

8+
import { Tabs, TabItem } from "~/components";
9+
10+
Grafana Cloud is a fully managed observability platform that provides visualization, alerting, and analytics for your telemetry data. By exporting your Cloudflare Workers telemetry to Grafana Cloud, you can:
11+
- Visualize distributed traces in **Grafana Tempo** to understand request flows and performance bottlenecks
12+
- Query and analyze logs in **Grafana Loki** alongside your traces
13+
14+
This guide will walk you through configuring Cloudflare Workers to export OpenTelemetry-compliant traces and logs to your Grafana Cloud stack.
15+
16+
![Grafana Tempo trace view showing a distributed trace for a service with multiple spans including fetch requests, durable object subrequests, and queue operations, with timing information displayed on a timeline](~/assets/images/workers-observability/grafana-traces.png)
17+
18+
## Prerequisites
19+
20+
Before you begin, ensure you have:
21+
22+
- An active [Grafana Cloud account](https://grafana.com/auth/sign-up/create-user) (free tier available)
23+
- A deployed Worker that you want to monitor
24+
25+
## Step 1: Access the OpenTelemetry setup guide
26+
27+
1. Log in to your [Grafana Cloud portal](https://grafana.com/)
28+
2. From your organization's home page, navigate to **Connections****Add new connection**
29+
3. Search for "OpenTelemetry" and select **OpenTelemetry (OTLP)**
30+
4. Select **Quickstart** then select **JavaScript**
31+
6. Click **Create a new token**
32+
7. Enter a name for your token (e.g., `cloudflare-workers-otel`) and click **create token**
33+
34+
35+
## Step 2: Set up destination
36+
1. Navigate to your Cloudflare account's [Workers Observability](https://dash.cloudflare.com/?to=/:account/workers-and-pages/observability/pipelines) section
37+
2. Click **Add destination** and configure a destination name (e.g. `grafana-tracing`)
38+
3. From Grafana, copy your Otel endpoint, auth header, and auth value
39+
* Your OTEL endpoint will look like `https://otlp-gateway-prod-us-east-2.grafana.net/otlp` (append `/v1/traces for tracing and `/v1/logs` for logs)
40+
* Your custom header should include:
41+
* Your auth header name `Authorization`
42+
* Your auth header value `Basic MTMxxx...`
43+
44+
## Step 3: Configure your Worker
45+
46+
With your destination created in the Cloudflare dashboard, update your Worker's configuration to enable telemetry export.
47+
48+
<Tabs>
49+
<TabItem label="wrangler.jsonc">
50+
51+
```jsonc title="wrangler.jsonc"
52+
{
53+
"observability": {
54+
"traces": {
55+
"enabled": true,
56+
// Must match the destination name in the dashboard
57+
"destinations": ["grafana-traces"]
58+
},
59+
"logs": {
60+
"enabled": true,
61+
// Must match the destination name in the dashboard
62+
"destinations": ["grafana-logs"]
63+
}
64+
}
65+
}
66+
```
67+
68+
</TabItem>
69+
<TabItem label="wrangler.toml">
70+
71+
```toml title="wrangler.toml"
72+
[observability.traces]
73+
enabled = true
74+
# Must match the destination name in the dashboard
75+
destinations = ["grafana-traces"]
76+
77+
[observability.logs]
78+
enabled = true
79+
# Must match the destination name in the dashboard
80+
destinations = ["grafana-logs"]
81+
```
82+
83+
</TabItem>
84+
</Tabs>
85+
86+
After updating your configuration, deploy your Worker for the changes to take effect.
87+
88+
:::note
89+
It may take a few minutes after deployment for data to appear in Grafana Cloud.
90+
:::

0 commit comments

Comments
 (0)