@sentry/apm
Advanced tools
@@ -92,2 +92,10 @@ import { Hub } from '@sentry/hub'; | ||
}; | ||
/** | ||
* beforeNavigate is called before a pageload/navigation transaction is created and allows for users | ||
* to set a custom navigation transaction name based on the current `window.location`. Defaults to returning | ||
* `window.location.pathname`. | ||
* | ||
* @param location the current location before navigation span is created | ||
*/ | ||
beforeNavigate(location: Location): string; | ||
} | ||
@@ -227,2 +235,5 @@ /** JSDoc */ | ||
* Removes activity and finishes the span in case there is one | ||
* @param id the id of the activity being removed | ||
* @param spanData span data that can be updated | ||
* | ||
*/ | ||
@@ -232,4 +243,8 @@ static popActivity(id: number, spanData?: { | ||
}): void; | ||
/** | ||
* Get span based on activity id | ||
*/ | ||
static getActivitySpan(id: number): Span | undefined; | ||
} | ||
export {}; | ||
//# sourceMappingURL=tracing.d.ts.map |
@@ -24,6 +24,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
if (global.performance) { | ||
global.performance.mark('sentry-tracing-init'); | ||
if (global.performance.mark) { | ||
global.performance.mark('sentry-tracing-init'); | ||
} | ||
Tracing._trackLCP(); | ||
} | ||
var defaults = { | ||
beforeNavigate: function (location) { | ||
return location.pathname; | ||
}, | ||
debug: { | ||
@@ -63,6 +68,5 @@ spanDebugTimingInfo: false, | ||
// Starting pageload transaction | ||
if (global.location && global.location.href && Tracing.options && Tracing.options.startTransactionOnPageLoad) { | ||
// Use `${global.location.href}` as transaction name | ||
if (global.location && Tracing.options && Tracing.options.startTransactionOnPageLoad) { | ||
Tracing.startIdleTransaction({ | ||
name: global.location.href, | ||
name: Tracing.options.beforeNavigate(window.location), | ||
op: 'pageload', | ||
@@ -420,3 +424,3 @@ }); | ||
// We remember the entry script end time to calculate the difference to the first init mark | ||
if (entryScriptStartEndTime === undefined && (entryScriptSrc || '').includes(resourceName_1)) { | ||
if (entryScriptStartEndTime === undefined && (entryScriptSrc || '').indexOf(resourceName_1) > -1) { | ||
entryScriptStartEndTime = resource.endTimestamp; | ||
@@ -580,2 +584,5 @@ } | ||
* Removes activity and finishes the span in case there is one | ||
* @param id the id of the activity being removed | ||
* @param spanData span data that can be updated | ||
* | ||
*/ | ||
@@ -626,2 +633,15 @@ Tracing.popActivity = function (id, spanData) { | ||
/** | ||
* Get span based on activity id | ||
*/ | ||
Tracing.getActivitySpan = function (id) { | ||
if (!id) { | ||
return undefined; | ||
} | ||
var activity = Tracing._activities[id]; | ||
if (activity) { | ||
return activity.span; | ||
} | ||
return undefined; | ||
}; | ||
/** | ||
* @inheritDoc | ||
@@ -734,3 +754,3 @@ */ | ||
Tracing.startIdleTransaction({ | ||
name: global.location.href, | ||
name: Tracing.options.beforeNavigate(window.location), | ||
op: 'navigation', | ||
@@ -737,0 +757,0 @@ }); |
@@ -92,2 +92,10 @@ import { Hub } from '@sentry/hub'; | ||
}; | ||
/** | ||
* beforeNavigate is called before a pageload/navigation transaction is created and allows for users | ||
* to set a custom navigation transaction name based on the current `window.location`. Defaults to returning | ||
* `window.location.pathname`. | ||
* | ||
* @param location the current location before navigation span is created | ||
*/ | ||
beforeNavigate(location: Location): string; | ||
} | ||
@@ -227,2 +235,5 @@ /** JSDoc */ | ||
* Removes activity and finishes the span in case there is one | ||
* @param id the id of the activity being removed | ||
* @param spanData span data that can be updated | ||
* | ||
*/ | ||
@@ -232,4 +243,8 @@ static popActivity(id: number, spanData?: { | ||
}): void; | ||
/** | ||
* Get span based on activity id | ||
*/ | ||
static getActivitySpan(id: number): Span | undefined; | ||
} | ||
export {}; | ||
//# sourceMappingURL=tracing.d.ts.map |
@@ -23,6 +23,11 @@ import * as tslib_1 from "tslib"; | ||
if (global.performance) { | ||
global.performance.mark('sentry-tracing-init'); | ||
if (global.performance.mark) { | ||
global.performance.mark('sentry-tracing-init'); | ||
} | ||
Tracing._trackLCP(); | ||
} | ||
var defaults = { | ||
beforeNavigate: function (location) { | ||
return location.pathname; | ||
}, | ||
debug: { | ||
@@ -62,6 +67,5 @@ spanDebugTimingInfo: false, | ||
// Starting pageload transaction | ||
if (global.location && global.location.href && Tracing.options && Tracing.options.startTransactionOnPageLoad) { | ||
// Use `${global.location.href}` as transaction name | ||
if (global.location && Tracing.options && Tracing.options.startTransactionOnPageLoad) { | ||
Tracing.startIdleTransaction({ | ||
name: global.location.href, | ||
name: Tracing.options.beforeNavigate(window.location), | ||
op: 'pageload', | ||
@@ -419,3 +423,3 @@ }); | ||
// We remember the entry script end time to calculate the difference to the first init mark | ||
if (entryScriptStartEndTime === undefined && (entryScriptSrc || '').includes(resourceName_1)) { | ||
if (entryScriptStartEndTime === undefined && (entryScriptSrc || '').indexOf(resourceName_1) > -1) { | ||
entryScriptStartEndTime = resource.endTimestamp; | ||
@@ -579,2 +583,5 @@ } | ||
* Removes activity and finishes the span in case there is one | ||
* @param id the id of the activity being removed | ||
* @param spanData span data that can be updated | ||
* | ||
*/ | ||
@@ -625,2 +632,15 @@ Tracing.popActivity = function (id, spanData) { | ||
/** | ||
* Get span based on activity id | ||
*/ | ||
Tracing.getActivitySpan = function (id) { | ||
if (!id) { | ||
return undefined; | ||
} | ||
var activity = Tracing._activities[id]; | ||
if (activity) { | ||
return activity.span; | ||
} | ||
return undefined; | ||
}; | ||
/** | ||
* @inheritDoc | ||
@@ -733,3 +753,3 @@ */ | ||
Tracing.startIdleTransaction({ | ||
name: global.location.href, | ||
name: Tracing.options.beforeNavigate(window.location), | ||
op: 'navigation', | ||
@@ -736,0 +756,0 @@ }); |
{ | ||
"name": "@sentry/apm", | ||
"version": "5.17.0", | ||
"version": "5.18.0", | ||
"description": "Extensions for APM", | ||
@@ -19,7 +19,7 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/browser": "5.17.0", | ||
"@sentry/hub": "5.17.0", | ||
"@sentry/minimal": "5.17.0", | ||
"@sentry/types": "5.17.0", | ||
"@sentry/utils": "5.17.0", | ||
"@sentry/browser": "5.18.0", | ||
"@sentry/hub": "5.18.0", | ||
"@sentry/minimal": "5.18.0", | ||
"@sentry/types": "5.18.0", | ||
"@sentry/utils": "5.18.0", | ||
"tslib": "^1.9.3" | ||
@@ -26,0 +26,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
363427
1.48%4000
1.78%