Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions packages/apm/src/integrations/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ export class Tracing implements Integration {
);

Tracing._activeTransaction = span;
Tracing._addOffsetToSpan(`idleTransactionStarted-${Tracing._currentIndex}`, span as SpanClass);
Tracing._addOffsetToSpan(span as SpanClass);

// We need to do this workaround here and not use configureScope
// Reason being at the time we start the inital transaction we do not have a client bound on the hub yet
Expand Down Expand Up @@ -543,15 +543,9 @@ export class Tracing implements Integration {
* @param measureName name of the performance measure
* @param span Span to add data.offset to
*/
private static _addOffsetToSpan(measureName: string, span: SpanClass): void {
private static _addOffsetToSpan(span: SpanClass): void {
if (global.performance) {
const name = `#sentry-${measureName}`;
performance.measure(name);
const measure = performance.getEntriesByName(name).pop();
if (measure) {
span.setData('offset', Tracing._msToSec(measure.duration));
}
performance.clearMeasures(name);
span.setData('offset', Tracing._msToSec(performance.now()));
}
}

Expand Down Expand Up @@ -594,7 +588,7 @@ export class Tracing implements Integration {
const hub = _getCurrentHub();
if (hub) {
const span = hub.startSpan(spanContext);
Tracing._addOffsetToSpan(`${name}${Tracing._currentIndex}`, span as SpanClass);
Tracing._addOffsetToSpan(span as SpanClass);
Tracing._activities[Tracing._currentIndex] = {
name,
span,
Expand Down