Skip to content
New issue

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

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

Already on GitHub? # to your account

feat(nuxt): Always add tracing meta tags #13273

Merged
merged 4 commits into from
Aug 12, 2024
Merged

feat(nuxt): Always add tracing meta tags #13273

merged 4 commits into from
Aug 12, 2024

Conversation

s1gr1d
Copy link
Member

@s1gr1d s1gr1d commented Aug 8, 2024

Making sure tracing without performance works.

ref (SvelteKit): #13231

@s1gr1d s1gr1d requested review from Lms24, a team and chargome and removed request for a team August 8, 2024 07:51
Copy link
Member

@chargome chargome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

head.push(`<meta name="baggage" content="${dynamicSamplingContext}"/>`);
}
const metaTags = getTraceMetaTags();
head.push(metaTags);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: Not sure if this is problematic but I see we did this differently before: If nuxt expects one tag per array item we should split the return value from getTraceMetaTags() at \n since we usually return two tags separated by a \n.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked this and nuxt puts the html together in the correct way so this should be fine. But I would rather add a function parameter { options.asArray } to return it as array instead of adding \n and splitting it again afterwards.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a PR for this: #13293

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I closed the PR I just use the returned string now. This works with Nuxt as well and we don't have to split the string (slightly better performance).

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for explaining! LGTM!

].join('\n');

// return value is mocked here as return values of `getTraceMetaTags` are tested separately (in @sentry/core)
(getTraceMetaTags as Mock).mockReturnValue(mockMetaTags);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's fine, given the unit under test here is the Nuxt-specific addSentryTracingMetaTags function.

What we should do in the near future is to make sure our e2e tests cover distributed tracing behaviour. For example, we should check that

  • the sever-side request transaction and the client-side pageload transaction is connected by the same trace. This will validate that the trace meta tag injection generally works.
  • potential requests made on the client side to the server (thinking of API endpoint or data loading calls, whatever nuxt offers) are connected to the server side. This is probably easiest testable when making these calls during or directly after a navigation so that we can make sure a client-side root span exists.

I'm also working on a SvelteKit e2e test app that's specifically configured for tracing without performance. We could think about doing something similar for Nuxt but I wouldn't require it for the moment.

@s1gr1d s1gr1d merged commit b29d771 into develop Aug 12, 2024
97 checks passed
@s1gr1d s1gr1d deleted the sig/nuxt-meta-tags branch August 12, 2024 09:30
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants