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

ref: Convert React and Vue Tracing to use active transaction #2741

Merged
merged 2 commits into from Jul 14, 2020

Conversation

AbhiPrasad
Copy link
Member

Last PR before #2719 is ready :)

This one changes both React and Vue to add children to the current active transaction instead of pushing and popping activities.

This is a change in behaviour, as if the components no longer add/remove activities, the 0 activity point is reached more quickly by the Tracing integration, but I figured if we are looking to move past it, we should just do this.

I updated the react tests and tested on Sentry and everything seems good.

Comment on lines +389 to +398
export function getActiveTransaction<T extends Transaction>(hub: HubType): T | undefined {
if (hub && hub.getScope) {
const scope = hub.getScope() as Scope;
if (scope) {
return scope.getTransaction() as T | undefined;
}
}

return undefined;
}
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I don't like that we have this duplicated everywhere :/

Copy link
Member

Choose a reason for hiding this comment

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

Isn't doing hub.getScope().getTransaction() the same?

Copy link
Member Author

Choose a reason for hiding this comment

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

public getScope(): Scope | undefined

public getScope(): Scope | undefined {

Copy link
Member Author

Choose a reason for hiding this comment

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

So it is more like hub?.getScope?.getTransaction()

Copy link
Member Author

Choose a reason for hiding this comment

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

We can always refactor this if we figure out a better way to do this.

@AbhiPrasad AbhiPrasad merged commit eb3917e into abhi/ref/add-sentry-tracing Jul 14, 2020
@AbhiPrasad AbhiPrasad deleted the abhi/ref/react-vue branch July 14, 2020 15:47
AbhiPrasad added a commit that referenced this pull request Jul 14, 2020
* ref: Make React Profiler use active transaction

* ref: Make Vue Tracing using active transaction
AbhiPrasad added a commit that referenced this pull request Jul 17, 2020
* feat: Create IdleTransaction class (#2720)

* feat: Add BrowserTracing integration (#2723)

* feat: Add span creators to @sentry/tracing package (#2736)

* ref: Convert React and Vue Tracing to use active transaction (#2741)

* build: generate tracing bundles

* fix: Remove circular dependency between span and transaction

* ref: Add side effects true to tracing

* build: Only include @sentry/browser for bundle

* fix: Make sure vue and react are backwards compatible with @sentry/apm
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.

None yet

2 participants