File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ type Mixins = Parameters<Vue['mixin']>[0];
13
13
interface VueSentry extends ViewModel {
14
14
readonly $root : VueSentry ;
15
15
$_sentrySpans ?: {
16
- [ key : string ] : Span ;
16
+ [ key : string ] : Span | undefined ;
17
17
} ;
18
18
$_sentryRootSpan ?: Span ;
19
19
$_sentryRootSpanTimer ?: ReturnType < typeof setTimeout > ;
@@ -98,6 +98,14 @@ export const createTracingMixins = (options: TracingOptions): Mixins => {
98
98
if ( internalHook == internalHooks [ 0 ] ) {
99
99
const activeTransaction = this . $root ?. $_sentryRootSpan || getActiveTransaction ( ) ;
100
100
if ( activeTransaction ) {
101
+ // Cancel old span for this hook operation in case it didn't get cleaned up. We're not actually sure if it
102
+ // will ever be the case that cleanup hooks re not called, but we had users report that spans didn't get
103
+ // finished so we finish the span before starting a new one, just to be sure.
104
+ const oldSpan = this . $_sentrySpans [ operation ] ;
105
+ if ( oldSpan && ! oldSpan . endTimestamp ) {
106
+ oldSpan . finish ( ) ;
107
+ }
108
+
101
109
this . $_sentrySpans [ operation ] = activeTransaction . startChild ( {
102
110
description : `Vue <${ name } >` ,
103
111
op : `${ VUE_OP } .${ operation } ` ,
You can’t perform that action at this time.
0 commit comments