|
| 1 | +--- |
| 2 | +pcx_content_type: how-to |
| 3 | +title: Export to Honeycomb |
| 4 | +sidebar: |
| 5 | + order: 1 |
| 6 | +--- |
| 7 | + |
| 8 | +import {WranglerConfig} from "~/components"; |
| 9 | + |
| 10 | +Honeycomb is an observability platform built for high-cardinality data that helps you understand and debug your applications. By exporting your Cloudflare Workers application telemetry to Honeycomb, you can: |
| 11 | +- Visualize traces to understand request flows and identify performance bottlenecks |
| 12 | +- Query and analyze logs with unlimited dimensionality across any attribute |
| 13 | +- Create custom queries and dashboards to monitor your Workers |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +This guide will walk you through configuring your Cloudflare Worker application to export OpenTelemetry-compliant traces and logs to Honeycomb. |
| 18 | + |
| 19 | +## Prerequisites |
| 20 | + |
| 21 | +Before you begin, ensure you have: |
| 22 | + |
| 23 | +- An active [Honeycomb account](https://ui.honeycomb.io/signup) (free tier available) |
| 24 | +- A deployed Worker that you want to monitor |
| 25 | + |
| 26 | +## Step 1: Get your Honeycomb API key |
| 27 | + |
| 28 | +1. Log in to your [Honeycomb account](https://ui.honeycomb.io/) |
| 29 | +2. Navigate to your account settings by clicking on your profile icon in the top right |
| 30 | +3. Select **Team Settings** |
| 31 | +4. In the left sidebar, click **Environments** and click the gear icon |
| 32 | +5. Find your environment (e.g., `production`, `test`) or create a new one |
| 33 | +6. Under **API Keys**, click **Create Ingest API Key** |
| 34 | +7. Configure your API key: |
| 35 | + - **Name**: Enter a descriptive name (e.g., `cloudflare-workers-otel`) |
| 36 | + - **Permissions**: Select **Can create services/datasets** (required for OTLP ingestion) |
| 37 | +8. Click **Create** |
| 38 | +9. **Important**: Copy the API key immediately and store it securely - you won't be able to see it again |
| 39 | + |
| 40 | +The API key will look something like: `hcaik_01hq...` |
| 41 | + |
| 42 | +## Step 2: Configure Cloudflare destinations |
| 43 | + |
| 44 | +Now you'll create destinations in the Cloudflare dashboard that point to Honeycomb. |
| 45 | + |
| 46 | +### Honeycomb OTLP endpoints |
| 47 | + |
| 48 | +Honeycomb provides separate OTLP endpoints for traces and logs: |
| 49 | +- **Traces**: `https://api.honeycomb.io/v1/traces` |
| 50 | +- **Logs**: `https://api.honeycomb.io/v1/logs` |
| 51 | + |
| 52 | +### Configure trace destination |
| 53 | + |
| 54 | +1. Navigate to your Cloudflare account's [Workers Observability](https://dash.cloudflare.com/?to=/:account/workers-and-pages/observability/pipelines) section |
| 55 | +2. Click **Add destination** |
| 56 | +3. Configure your trace destination: |
| 57 | + - **Destination Name**: `honeycomb-traces` (or any descriptive name) |
| 58 | + - **Destination Type**: Select **Traces** |
| 59 | + - **OTLP Endpoint**: `https://api.honeycomb.io/v1/traces` |
| 60 | + - **Custom Headers**: Add the authentication header: |
| 61 | + - Header name: `x-honeycomb-team` |
| 62 | + - Header value: Your Honeycomb API key (e.g., `hcaik_01hq...`) |
| 63 | +4. Click **Save** |
| 64 | + |
| 65 | +### Configure logs destination |
| 66 | + |
| 67 | +Repeat the process for logs: |
| 68 | + |
| 69 | +1. Click **Add destination** again |
| 70 | +2. Configure your logs destination: |
| 71 | + - **Destination Name**: `honeycomb-logs` (or any descriptive name) |
| 72 | + - **Destination Type**: Select **Logs** |
| 73 | + - **OTLP Endpoint**: `https://api.honeycomb.io/v1/logs` |
| 74 | + - **Custom Headers**: Add the authentication header: |
| 75 | + - Header name: `x-honeycomb-team` |
| 76 | + - Header value: Your Honeycomb API key (same as above) |
| 77 | +3. Click **Save** |
| 78 | + |
| 79 | +## Step 3: Configure your Worker |
| 80 | + |
| 81 | +With your destinations created in the Cloudflare dashboard, update your Worker's configuration to enable telemetry export. |
| 82 | + |
| 83 | +<WranglerConfig> |
| 84 | + |
| 85 | +```json |
| 86 | +{ |
| 87 | + "observability": { |
| 88 | + "traces": { |
| 89 | + "enabled": true, |
| 90 | + // Must match the destination name in the dashboard |
| 91 | + "destinations": ["honeycomb-traces"] |
| 92 | + }, |
| 93 | + "logs": { |
| 94 | + "enabled": true, |
| 95 | + // Must match the destination name in the dashboard |
| 96 | + "destinations": ["honeycomb-logs"] |
| 97 | + } |
| 98 | + } |
| 99 | +} |
| 100 | +``` |
| 101 | + |
| 102 | +</WranglerConfig> |
| 103 | + |
| 104 | +After updating your configuration, deploy your Worker for the changes to take effect. |
| 105 | + |
| 106 | +:::note |
| 107 | +It may take a few minutes after deployment for data to appear in Honeycomb. |
| 108 | +::: |
0 commit comments