feat: CATALYST-676 add generic otel setup#2674
Merged
chanceaclark merged 1 commit intocanaryfrom Nov 13, 2025
Merged
Conversation
🦋 Changeset detectedLatest commit: d8f5ce6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
c3e45dc to
d8f5ce6
Compare
jorgemoya
approved these changes
Nov 11, 2025
jordanarldt
added a commit
that referenced
this pull request
Nov 14, 2025
This reverts commit a48bcf2.
jordanarldt
added a commit
that referenced
this pull request
Nov 14, 2025
This reverts commit a48bcf2.
Merged
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Nov 14, 2025
* Revert "test(reviews): add e2e tests for reviews form (#2686)" This reverts commit d1d1249. * Revert "feat: CATALYST-676 add generic otel setup (#2674)" This reverts commit a48bcf2. * Revert "refactor(auth): separate first and last name fields on user session (#2684)" This reverts commit edbd202. * Revert "feat(reviews): add reviews form enabling shoppers to submit reviews (#2676)" This reverts commit b7ba003.
This was referenced Nov 14, 2025
jamesqquick
pushed a commit
that referenced
this pull request
Feb 11, 2026
jamesqquick
pushed a commit
that referenced
this pull request
Feb 11, 2026
* Revert "test(reviews): add e2e tests for reviews form (#2686)" This reverts commit d1d1249. * Revert "feat: CATALYST-676 add generic otel setup (#2674)" This reverts commit a48bcf2. * Revert "refactor(auth): separate first and last name fields on user session (#2684)" This reverts commit edbd202. * Revert "feat(reviews): add reviews form enabling shoppers to submit reviews (#2676)" This reverts commit b7ba003.
chanceaclark
added a commit
that referenced
this pull request
Apr 27, 2026
chanceaclark
pushed a commit
that referenced
this pull request
Apr 27, 2026
* Revert "test(reviews): add e2e tests for reviews form (#2686)" This reverts commit d1d1249. * Revert "feat: CATALYST-676 add generic otel setup (#2674)" This reverts commit a48bcf2. * Revert "refactor(auth): separate first and last name fields on user session (#2684)" This reverts commit edbd202. * Revert "feat(reviews): add reviews form enabling shoppers to submit reviews (#2676)" This reverts commit b7ba003.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What/Why?
Adds OpenTelemetry instrumentation for Catalyst, enabling the collection of spans for Catalyst storefronts.
Testing
Spans populating within Sentry traces.


Migration
Change is new code only, so just copy over
/core/instrumentation.tsandcore/lib/otel/tracers.ts.@chris-nowicki I took a stab at whipping up some documentation for you here:
Documentation
OpenTelemetry in Catalyst
Overview
Catalyst includes built-in OpenTelemetry instrumentation for monitoring your storefront's performance and behavior. OpenTelemetry provides distributed tracing, which helps you understand how requests flow through your application, identify performance bottlenecks, and debug issues in production.
This guide covers practical usage of OpenTelemetry within Catalyst, focusing on how to use traces to improve your storefront's performance.
What is OpenTelemetry?
OpenTelemetry is an open-source observability framework that provides a standardized way to collect telemetry data (traces, metrics, and logs) from your applications. It's platform-agnostic, meaning you can change your observability provider without changing your code.
Key concepts:
Quick Setup
Catalyst uses the
@vercel/otelpackage, which simplifies OpenTelemetry configuration. The setup is already complete in your project:package.jsoninstrumentation.tsin the root of the core directory~/lib/otel/tracerto create custom spansFor detailed setup instructions and collector configuration, refer to the official Next.js OpenTelemetry guide.
Environment Variables
Configure OpenTelemetry using environment variables:
Add these to your
.env.localfile or deployment environment.Configuring Exporters
Exporters send telemetry data to observability backends where you can analyze traces and monitor performance. Configure exporters using standard OpenTelemetry environment variables:
Add these to your
.env.localfile for local development or set them in your deployment platform's environment settings for production.For detailed configuration options, protocol settings, and provider-specific examples, refer to the OpenTelemetry Exporter documentation.
What's Instrumented by Default
Next.js automatically instruments several key operations:
fetch()generateMetadatafunction executionEach span includes helpful attributes like:
http.method: The HTTP method (GET, POST, etc.)http.route: The route pattern (e.g.,/[locale]/(default)/cart)http.status_code: Response status codenext.route: Next.js route identifierViewing and Analyzing Traces
To view traces, you need an OpenTelemetry collector and observability backend. Common options:
Trace Hierarchy
Traces are organized hierarchically:
Using Traces to Debug Performance
Analyzing the Cart Page
The cart page is a critical conversion point in your storefront. Let's use traces to understand what impacts its load speed.
What to look for:
Example analysis:
Findings:
Common performance patterns:
Sequential fetches (slow):
Parallel fetches (fast):
Identifying N+1 Query Problems
Look for repeated fetch spans with similar patterns:
This indicates an N+1 query problem. Consider batching these requests or using a different API endpoint.
Monitoring Server Actions
Server actions (like
applyCouponCode,updateLineItem) also appear in traces:Use this to understand:
Creating Custom Spans
Add custom spans to instrument important operations in your codebase.
Basic usage:
Practical examples:
1. Instrument data transformations
2. Instrument external API calls
3. Instrument critical business logic
When to add custom spans:
Best Practices for Instrumentation
1. Use descriptive span names
2. Add meaningful attributes
3. Always end spans in finally blocks
4. Mark errors appropriately
5. Use hierarchical naming
Group related spans with dot notation:
This creates logical grouping in your observability dashboard.
Interpreting Cart Page Traces
Key metrics to monitor:
Common issues and solutions:
Promise.all()generateMetadata> 100msReal-world example:
Before optimization:
After optimization:
Changes made:
Advanced Patterns
Propagating context across async boundaries
Sampling for high-traffic routes
Configure sampling in
instrumentation.tsto reduce overhead on high-traffic routes (refer to the Next.js OpenTelemetry guide for collector configuration).Troubleshooting
Spans not appearing
instrumentation.tsexists in the project rootregisterOTel()is being calledOTEL_SERVICE_NAMEis set (optional but recommended)Missing fetch spans
Set
NEXT_OTEL_FETCH_DISABLED=0or remove this environment variable.Too much data
NEXT_OTEL_VERBOSE=0to reduce span volumeSpans appear out of order
This is usually a visualization issue. Check the span timestamps in your observability tool.
Resources
Next Steps
Screenshot Recommendations
To complete this documentation, add the following screenshots:
These screenshots should come from your actual observability tool (Vercel, Jaeger, Honeycomb, etc.) showing real Catalyst traces.