Skip to content

fix(angular): Fall back to element tagName when name is not provided to TraceDirective #14778

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

Merged
merged 3 commits into from
Dec 23, 2024

Conversation

arturovt
Copy link
Contributor

The trace directive should typically be declared on components to validly trace the lifecycle (from ngOnInit to ngAfterViewInit, when child views are also rendered). If trace is mistakenly not provided, we fall back to tagName.

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.

Interesting change, thanks @arturovt! Would be great to get this working but I wanna make sure it works across our supported version range. I'll give this a try in an old NG14 test app of mine but it would be great if you could add a test in our Angular 19 e2e test app: https://github.com/getsentry/sentry-javascript/tree/develop/dev-packages/e2e-tests/test-applications/angular-19

If you don't have time, let me know, then I can take over as well.

…ided

The `trace` directive should typically be declared on components to validly trace
the lifecycle (from `ngOnInit` to `ngAfterViewInit`, when child views are also rendered).
If `trace` is mistakenly not provided, we fall back to `tagName`.
@arturovt arturovt force-pushed the fix/angular-trace-tag branch from 2cbed30 to baf79c5 Compare December 18, 2024 12:54
@Lms24 Lms24 self-assigned this Dec 23, 2024
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.

I tested this in Angular 14 - worked perfectly! 👍

I adjusted our e2e tests to also cover the trace without a custom name call.

Thanks for contributing! Will merge this today. Due to the holidays, expect this to be released at the beginning of January.

@Lms24 Lms24 changed the title fix(angular): fall back to element tagName when trace is not provided fix(angular): Fall back to element tagName when trace is not provided Dec 23, 2024
@Lms24 Lms24 changed the title fix(angular): Fall back to element tagName when trace is not provided fix(angular): Fall back to element tagName when name is not provided to TraceDirective Dec 23, 2024
@Lms24 Lms24 enabled auto-merge (squash) December 23, 2024 11:49
@Lms24 Lms24 merged commit dc08b82 into getsentry:develop Dec 23, 2024
134 checks passed
Lms24 added a commit that referenced this pull request Dec 23, 2024
…d to `TraceDirective` (#14778)

The `trace` directive should typically be declared on components to
validly trace the lifecycle (from `ngOnInit` to `ngAfterViewInit`, when
child views are also rendered). If `trace` is mistakenly not provided,
we fall back to `tagName` instead of "unknown component".

---------

Co-authored-by: Lukas Stracke <[email protected]>
Lms24 added a commit that referenced this pull request Dec 23, 2024
…ided to `TraceDirective` (#14828)

Backport of #14778

---------

Co-authored-by: Artur <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants