← Back to Cookbook

Send Shopify Hydrogen OpenTelemetry 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.

Features
Category Monitoring
Time
20–30 minutes
Complexity
Beginner
Steps
5 steps

Before you start

Accounts & access
  • A Shopify store on the 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 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

1
Copy your Sentry OTLP endpoint and auth header

In Sentry, open Project Settings, 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.

Sentry docs: Shopify Hydrogen drains
Example values
https://o{ORG_ID}.ingest.us.sentry.io/api/{PROJECT_ID}/integration/otlp/v1/traces

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

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=.
  • Click Save.
Shopify docs: Export storefront traces

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 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

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. 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

That's it.

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.

  • 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

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.

Frequently asked questions

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.

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.

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.

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

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

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

Fix it, don't observe it.

Get started with the only application monitoring platform that empowers developers to fix application problems without compromising on velocity.