# Send Shopify Hydrogen OpenTelemetry traces to Sentry

> Send Shopify Hydrogen trace exports to Sentry over OTLP. See storefront request timing, Storefront API queries, and cache misses with no code changes.

**URL:** https://sentry.io/cookbook/send-shopify-hydrogen-traces-to-sentry/

---

Shopify can export traces from your Hydrogen storefront on Oxygen in OpenTelemetry format. Point them at Sentry to see request timing, Storefront API queries, cache hits and misses, and third-party calls, without changing any code.

**Time:** 20–30 minutes | **Difficulty:** Beginner

## What You'll Learn

- Copied your Sentry OTLP endpoint and auth header

- Connected an observability drain in the Shopify admin

- Confirmed exported traces in the Trace Explorer

- Found slow pages, slow queries, and cache misses

- Saved a dashboard and an alert on page response time

**Topics:** Tracing, Dashboards, Alerts

## Before you start

**Accounts & access**

- A Shopify store on the [Shopify Plus plan](https://help.shopify.com/manual/intro-to-shopify/pricing-plans/plans-features/shopify-plus-plan) (trace exports are Plus-only)

- A Hydrogen storefront deployed to Oxygen (Hydrogen 2026.04 or earlier on Oxygen; Shopify lists trace exports under legacy Hydrogen docs)

- Admin access to the Hydrogen sales channel

- A [Sentry account](https://sentry.io/signup/) with a project for the storefront

**SDKs & packages**

- None. Shopify sends the traces, so there's nothing to install.

**Knowledge**

- A basic idea of how traces and spans work

## Steps

### 1. Copy your Sentry OTLP endpoint and auth header

In Sentry, open [Project Settings](https://sentry.io/orgredirect/organizations/:orgslug/settings/projects/), select your project, then **Client Keys (DSN)**, and select the **OpenTelemetry (OTLP)** tab. Copy the **OTLP Traces Endpoint** (the URL Shopify will send traces to) and the **OTLP Traces Endpoint Headers** value. Sentry shows the header as `x-sentry-auth=sentry sentry_key=`. In step 2, Shopify asks for the header name and value separately, so you will paste only the part after `x-sentry-auth=`. Copy the values from your own project settings. The host depends on your organization's data region, so don't build the URL by hand.

```text
https://o{ORG_ID}.ingest.us.sentry.io/api/{PROJECT_ID}/integration/otlp/v1/traces

x-sentry-auth=sentry sentry_key={YOUR_PUBLIC_KEY}
```

[Sentry docs: Shopify Hydrogen drains](https://docs.sentry.io/product/drains/shopify-hydrogen/)

### 2. Connect an observability drain in Shopify

In your Shopify admin, go to **Sales channels > Hydrogen**, open your storefront, and add an HTTP observability drain that points at Sentry:

- Under **Sales channels**, click **Hydrogen**.

- On the Hydrogen storefront page, click **Storefront settings**, then **Integrations**.

- Click **Connect an observability drain** and select **HTTP**.

- Paste the OTLP Traces Endpoint into the endpoint URL field.

- Add a header named `x-sentry-auth`. For the value, paste only the part after `x-sentry-auth=`: `sentry sentry_key=<your public key>`.

- Click **Save**.

[Shopify docs: Export storefront traces](https://shopify.dev/docs/storefronts/headless/legacy/hydrogen/trace-exports)

### 3. Generate traffic and confirm traces arrive

Browse a few pages on your live storefront: the home page, a collection, a product, and the cart. Because only about 5% of requests are sampled, you may need to load pages a few dozen times before the first trace shows up, and traces can take a few minutes to arrive. Open the [Trace Explorer](https://sentry.io/orgredirect/organizations/:orgslug/explore/traces/) in the project you chose and filter to `request.type:request`. Open a trace to see the page request with its Storefront API, cache, and third-party spans nested underneath. If nothing appears after 15 minutes of traffic, check the endpoint URL and the header value in Shopify for typos.

[Trace Explorer documentation](https://docs.sentry.io/product/explore/trace-explorer/)

### 4. Find slow queries and cache misses

Each exported trace includes four kinds of spans (the primary page request, Storefront API queries, Hydrogen cache lookups, and third-party calls), and each carries its own attributes. Filter on `request.type` and group by the right field to answer specific questions. Add `client.country` or `client.device_type` as a second grouping to see whether a slow page is slow everywhere or only for some shoppers.

- **Slowest pages:** filter `request.type:request`, group by `http.path`, and sort by p95 duration.

- **Slowest Storefront API queries:** filter `request.type:sfapi_subrequest` and group by `sfapi.query.name`.

- **Queries that keep missing the cache:** filter `request.type:cache_api cache.status:miss` and group by `cache.query.name`. A query that misses on most requests may need a longer cache strategy.

- **Slow third-party services:** filter `request.type:subrequest` and group by `http.host`.

### 5. Save a dashboard and add an alert

Save the queries from step 4 as widgets on a storefront performance dashboard in [Dashboards](https://sentry.io/orgredirect/organizations/:orgslug/dashboards/). Then create an alert on p95 span duration for `request.type:request`, so you hear about it when page response times climb above a number you care about, such as 1 second. Because the data is sampled, alert on durations and percentiles, not on request counts.

[Alerts documentation](https://docs.sentry.io/product/monitors-and-alerts/alerts/)

## Summary

**Your Shopify traces now flow into Sentry.**

Shopify now sends a sample of your Hydrogen request traces to Sentry, with every Storefront API query, cache lookup, and third-party call broken out, and you didn't change a line of code.

## Pro Tips

- Name your GraphQL operations in code. The export uses the operation name for `sfapi.query.name`, so anonymous queries are hard to tell apart.

- Send trace exports to the same project as your Hydrogen SDK so storefront performance and errors sit side by side. Only exported spans carry `request.type`, so keep that filter on every widget and alert. If you also run the Sentry SDK, each request shows up as two separate traces; consider a separate project for exports.

- Use Shopify's log drains alongside trace exports if you need a record of every request, not just a sample.

## Common Pitfalls

- Expecting complete data. Shopify samples about 5% of requests, so counts and totals will be far lower than your real traffic.

- Expecting errors. Trace exports contain spans only. Add the Sentry SDK to capture exceptions.

- Leaving out the `x-sentry-auth` header. Without it, Sentry rejects the traces.

- Assuming delivery is guaranteed. Shopify retries failed exports for a short time, then drops them.

## FAQ

**Do I need the Sentry SDK for this?**

No. Trace exports work on their own and need no code changes. The SDK adds error monitoring, browser performance, Session Replay, and your own custom spans. Many teams use both.

**Will exported traces connect to traces from the Sentry SDK?**

No. Shopify generates its own trace IDs, so exported traces appear separately from traces the Sentry SDK creates. Treat them as a separate view of server-side timing.

**SDK or trace export: which should I use?**

Trace export needs no code but samples about 5% of requests and has no errors, replays, or browser data. The SDK gives you errors, browser tracing, and Session Replay, and you can run both in separate projects.

**Can I change the sampling rate?**

Not today. Shopify sets it at about 5% and notes that it may change.

**Is this available on every Shopify plan?**

No. Trace exports are only available to stores on the Shopify Plus plan.

**Is Sentry's OTLP endpoint generally available?**

Sentry's OTLP ingestion is in open beta. Send feedback to feedback-tracing@sentry.io.

## Next Steps

- [Instrument a Shopify Hydrogen storefront with Sentry](/cookbook/instrument-shopify-hydrogen-storefront/): Capture errors, browser performance, and Session Replay alongside your exported traces.

- [OpenTelemetry in Sentry](https://docs.sentry.io/concepts/otlp/): Learn the other ways to send OTLP traces and logs to Sentry.

---

*Source: [sentry.io/cookbook/send-shopify-hydrogen-traces-to-sentry/](https://sentry.io/cookbook/send-shopify-hydrogen-traces-to-sentry/)*
