Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust span names to say "(partial render tree)" instead of "RSC" for RSC requests #69728

Open
wants to merge 2 commits into
base: canary
Choose a base branch
from

Conversation

lforst
Copy link
Contributor

@lforst lforst commented Sep 5, 2024

What?

This PR removes the RSC prefix from OpenTelemetry span names for "RSC Requests". From my understanding RSC Requests in the code base are requests that are made as part of a navigation in app router, requesting an RSC payload.

Why?

This should probably be changed because a) it does not follow the Semantic OpenTelemetry conventions (https://opentelemetry.io/docs/specs/semconv/http/http-spans/#name) b) it causes grouping issues with other RSC requests that are non navigational, like prefetch requests, and initial pageloads/hard-navigations.

The original PR that added this prefix does not contain a description so I may lack some background info as to why the prefix was introduced in the first place: #62464

In my opinion, it is not clear to downstream users what the "RSC" prefix actually means, so it is fine to remove. I am happy to learn something different though!

How?

Right now this PR simply updates the name. In theory, no data is lost because the fact whether the request was an "RSC request" by the definition above is still stored as a next.rsc span attribute.

Relates to #64723
Fixes getsentry/sentry-javascript#13597

@ijjk
Copy link
Member

ijjk commented Sep 5, 2024

Allow CI Workflow Run

  • approve CI run for commit: aa91899

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@dvoytenko
Copy link
Member

@lforst This change makes sense for HTTP layer. However, RSC requests are different from standalone (root?) requests: they may only execute a partial render tree. This would often lead to RSC requests being much faster/cheaper that standalone requests, which might cause confusion. E.g. if one sets up a performance monitor on the duration of a "GET /my/route/[slug]" span, but RSC vs standalone timings will be wildly different. WDYT?

@lforst
Copy link
Contributor Author

lforst commented Sep 10, 2024

@dvoytenko I see your concern 🤔 I assumed that RSC requests are also always full requests.
I can see the risk of conflating two different types of request handlers, however, I think I would still go through with the rename and transfer the information one or more layers down in the abstraction tree. Simply because it is more conventional that way.

At the level where we are creating the GET /... span, we are still very much at the HTTP layer. If we created child spans for the HTTP spans that are named differently for RSC requests and “root” requests that would totally work in my opinion.

@lforst
Copy link
Contributor Author

lforst commented Sep 10, 2024

The more I think of this the more sense it makes to keep the spans for RSC and "root" requests separate names. Maybe the wording of "RSC" is just very confusing because I would have expected that "root" requests are also React Server Component requests.

Would there be appetite to rename the spans into something like GET /my/route (partial render tree)?

@lforst lforst changed the title Remove "RSC" prefix from requests Adjust span names to say "(partial render tree)" instead of "RSC" for RSC requests Sep 10, 2024
@dvoytenko
Copy link
Member

Would there be appetite to rename the spans into something like GET /my/route (parial render tree)?

IMHO stressing "partial" in the name makes a lot of sense to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Next.js: Upstream removal of "RSC" prefix for navigation transactions
3 participants