@sentry/tracing
Advanced tools
Comparing version 6.17.7 to 6.17.8-beta.0
@@ -10,2 +10,3 @@ import { Hub } from '@sentry/hub'; | ||
* the last finished span as the endtime for the transaction. | ||
* | ||
* Time is in ms. | ||
@@ -17,2 +18,11 @@ * | ||
/** | ||
* The max transaction duration for a transaction. If a transaction duration hits the `finalTimeout` value, it | ||
* will be finished. | ||
* | ||
* Time is in ms. | ||
* | ||
* Default: 30000 | ||
*/ | ||
finalTimeout: number; | ||
/** | ||
* Flag to enable/disable creation of `navigation` transaction on history changes. | ||
@@ -19,0 +29,0 @@ * |
@@ -12,3 +12,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DEFAULT_MAX_TRANSACTION_DURATION_SECONDS = 600; | ||
var DEFAULT_BROWSER_TRACING_OPTIONS = tslib_1.__assign({ idleTimeout: idletransaction_1.DEFAULT_IDLE_TIMEOUT, markBackgroundTransactions: true, maxTransactionDuration: exports.DEFAULT_MAX_TRANSACTION_DURATION_SECONDS, routingInstrumentation: router_1.instrumentRoutingWithDefaults, startTransactionOnLocationChange: true, startTransactionOnPageLoad: true }, request_1.defaultRequestInstrumentationOptions); | ||
var DEFAULT_BROWSER_TRACING_OPTIONS = tslib_1.__assign({ idleTimeout: idletransaction_1.DEFAULT_IDLE_TIMEOUT, finalTimeout: idletransaction_1.DEFAULT_FINAL_TIMEOUT, markBackgroundTransactions: true, maxTransactionDuration: exports.DEFAULT_MAX_TRANSACTION_DURATION_SECONDS, routingInstrumentation: router_1.instrumentRoutingWithDefaults, startTransactionOnLocationChange: true, startTransactionOnPageLoad: true }, request_1.defaultRequestInstrumentationOptions); | ||
/** | ||
@@ -15,0 +15,0 @@ * The Browser Tracing integration automatically instruments browser pageload/navigation |
export declare const FINISH_REASON_TAG = "finishReason"; | ||
export declare const IDLE_TRANSACTION_FINISH_REASONS: readonly ["heartbeatFailed", "idleTimeout", "documentHidden"]; | ||
export declare const IDLE_TRANSACTION_FINISH_REASONS: readonly ["heartbeatFailed", "idleTimeout", "documentHidden", "finalTimeout"]; | ||
//# sourceMappingURL=constants.d.ts.map |
@@ -5,3 +5,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FINISH_REASON_TAG = 'finishReason'; | ||
exports.IDLE_TRANSACTION_FINISH_REASONS = ['heartbeatFailed', 'idleTimeout', 'documentHidden']; | ||
exports.IDLE_TRANSACTION_FINISH_REASONS = [ | ||
'heartbeatFailed', | ||
'idleTimeout', | ||
'documentHidden', | ||
'finalTimeout', | ||
]; | ||
//# sourceMappingURL=constants.js.map |
@@ -6,2 +6,3 @@ import { Hub } from '@sentry/hub'; | ||
export declare const DEFAULT_IDLE_TIMEOUT = 1000; | ||
export declare const DEFAULT_FINAL_TIMEOUT = 30000; | ||
export declare const HEARTBEAT_INTERVAL = 5000; | ||
@@ -32,5 +33,16 @@ /** | ||
* @default 1000 | ||
* | ||
* TODO: Make _idleTimeout and _finalTimeout required to reduce duplication when setting the options | ||
* in `BrowserTracing`. This is considered a breaking change to the IdleTransaction API, | ||
* so we need to make sure we communicate it with react native. | ||
*/ | ||
private readonly _idleTimeout; | ||
private readonly _onScope; | ||
/** | ||
* The final value that a transaction cannot exceed | ||
* @default 30000 | ||
* @experimental | ||
* @internal | ||
*/ | ||
private readonly _finalTimeout; | ||
activities: Record<string, boolean>; | ||
@@ -45,3 +57,3 @@ private _prevHeartbeatString; | ||
*/ | ||
private _initTimeout; | ||
private _idleTimeoutID; | ||
constructor(transactionContext: TransactionContext, _idleHub?: Hub | undefined, | ||
@@ -51,4 +63,15 @@ /** | ||
* @default 1000 | ||
* | ||
* TODO: Make _idleTimeout and _finalTimeout required to reduce duplication when setting the options | ||
* in `BrowserTracing`. This is considered a breaking change to the IdleTransaction API, | ||
* so we need to make sure we communicate it with react native. | ||
*/ | ||
_idleTimeout?: number, _onScope?: boolean); | ||
_idleTimeout?: number, _onScope?: boolean, | ||
/** | ||
* The final value that a transaction cannot exceed | ||
* @default 30000 | ||
* @experimental | ||
* @internal | ||
*/ | ||
_finalTimeout?: number); | ||
/** {@inheritDoc} */ | ||
@@ -69,2 +92,10 @@ finish(endTimestamp?: number): string | undefined; | ||
/** | ||
* Creates an idletimeout | ||
*/ | ||
private _cancelIdleTimeout; | ||
/** | ||
* Creates an idletimeout | ||
*/ | ||
private _startIdleTimeout; | ||
/** | ||
* Start tracking a specific activity. | ||
@@ -71,0 +102,0 @@ * @param spanId The span id that represents the activity |
@@ -8,3 +8,5 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DEFAULT_IDLE_TIMEOUT = 1000; | ||
exports.DEFAULT_FINAL_TIMEOUT = 30000; | ||
exports.HEARTBEAT_INTERVAL = 5000; | ||
var global = utils_1.getGlobalObject(); | ||
/** | ||
@@ -57,8 +59,20 @@ * @inheritDoc | ||
* @default 1000 | ||
* | ||
* TODO: Make _idleTimeout and _finalTimeout required to reduce duplication when setting the options | ||
* in `BrowserTracing`. This is considered a breaking change to the IdleTransaction API, | ||
* so we need to make sure we communicate it with react native. | ||
*/ | ||
_idleTimeout, | ||
// Whether or not the transaction should put itself on the scope when it starts and pop itself off when it ends | ||
_onScope) { | ||
_onScope, | ||
/** | ||
* The final value that a transaction cannot exceed | ||
* @default 30000 | ||
* @experimental | ||
* @internal | ||
*/ | ||
_finalTimeout) { | ||
if (_idleTimeout === void 0) { _idleTimeout = exports.DEFAULT_IDLE_TIMEOUT; } | ||
if (_onScope === void 0) { _onScope = false; } | ||
if (_finalTimeout === void 0) { _finalTimeout = exports.DEFAULT_FINAL_TIMEOUT; } | ||
var _this = _super.call(this, transactionContext, _idleHub) || this; | ||
@@ -68,2 +82,3 @@ _this._idleHub = _idleHub; | ||
_this._onScope = _onScope; | ||
_this._finalTimeout = _finalTimeout; | ||
// Activities store a list of active spans | ||
@@ -84,7 +99,9 @@ _this.activities = {}; | ||
} | ||
_this._initTimeout = setTimeout(function () { | ||
_this._startIdleTimeout(); | ||
global.setTimeout(function () { | ||
if (!_this._finished) { | ||
_this.setTag(constants_1.FINISH_REASON_TAG, constants_1.IDLE_TRANSACTION_FINISH_REASONS[3]); | ||
_this.finish(); | ||
} | ||
}, _this._idleTimeout); | ||
}, _this._finalTimeout); | ||
return _this; | ||
@@ -178,2 +195,24 @@ } | ||
/** | ||
* Creates an idletimeout | ||
*/ | ||
IdleTransaction.prototype._cancelIdleTimeout = function () { | ||
if (this._idleTimeoutID) { | ||
global.clearTimeout(this._idleTimeoutID); | ||
this._idleTimeoutID = undefined; | ||
} | ||
}; | ||
/** | ||
* Creates an idletimeout | ||
*/ | ||
IdleTransaction.prototype._startIdleTimeout = function (end) { | ||
var _this = this; | ||
this._cancelIdleTimeout(); | ||
this._idleTimeoutID = global.setTimeout(function () { | ||
if (!_this._finished && Object.keys(_this.activities).length === 0) { | ||
_this.setTag(constants_1.FINISH_REASON_TAG, constants_1.IDLE_TRANSACTION_FINISH_REASONS[1]); | ||
_this.finish(end); | ||
} | ||
}, this._idleTimeout); | ||
}; | ||
/** | ||
* Start tracking a specific activity. | ||
@@ -183,6 +222,3 @@ * @param spanId The span id that represents the activity | ||
IdleTransaction.prototype._pushActivity = function (spanId) { | ||
if (this._initTimeout) { | ||
clearTimeout(this._initTimeout); | ||
this._initTimeout = undefined; | ||
} | ||
this._cancelIdleTimeout(); | ||
utils_1.logger.log("[Tracing] pushActivity: " + spanId); | ||
@@ -197,3 +233,2 @@ this.activities[spanId] = true; | ||
IdleTransaction.prototype._popActivity = function (spanId) { | ||
var _this = this; | ||
if (this.activities[spanId]) { | ||
@@ -209,9 +244,4 @@ utils_1.logger.log("[Tracing] popActivity " + spanId); | ||
// Remember timestampWithMs is in seconds, timeout is in ms | ||
var end_1 = utils_1.timestampWithMs() + timeout / 1000; | ||
setTimeout(function () { | ||
if (!_this._finished) { | ||
_this.setTag(constants_1.FINISH_REASON_TAG, constants_1.IDLE_TRANSACTION_FINISH_REASONS[1]); | ||
_this.finish(end_1); | ||
} | ||
}, timeout); | ||
var end = utils_1.timestampWithMs() + timeout / 1000; | ||
this._startIdleTimeout(end); | ||
} | ||
@@ -252,3 +282,3 @@ }; | ||
utils_1.logger.log("pinging Heartbeat -> current counter: " + this._heartbeatCounter); | ||
setTimeout(function () { | ||
global.setTimeout(function () { | ||
_this._beat(); | ||
@@ -255,0 +285,0 @@ }, exports.HEARTBEAT_INTERVAL); |
@@ -10,2 +10,3 @@ import { Hub } from '@sentry/hub'; | ||
* the last finished span as the endtime for the transaction. | ||
* | ||
* Time is in ms. | ||
@@ -17,2 +18,11 @@ * | ||
/** | ||
* The max transaction duration for a transaction. If a transaction duration hits the `finalTimeout` value, it | ||
* will be finished. | ||
* | ||
* Time is in ms. | ||
* | ||
* Default: 30000 | ||
*/ | ||
finalTimeout: number; | ||
/** | ||
* Flag to enable/disable creation of `navigation` transaction on history changes. | ||
@@ -19,0 +29,0 @@ * |
import { __assign } from "tslib"; | ||
import { getGlobalObject, logger } from '@sentry/utils'; | ||
import { startIdleTransaction } from '../hubextensions'; | ||
import { DEFAULT_IDLE_TIMEOUT } from '../idletransaction'; | ||
import { DEFAULT_FINAL_TIMEOUT, DEFAULT_IDLE_TIMEOUT } from '../idletransaction'; | ||
import { extractTraceparentData, secToMs } from '../utils'; | ||
@@ -11,3 +11,3 @@ import { registerBackgroundTabDetection } from './backgroundtab'; | ||
export var DEFAULT_MAX_TRANSACTION_DURATION_SECONDS = 600; | ||
var DEFAULT_BROWSER_TRACING_OPTIONS = __assign({ idleTimeout: DEFAULT_IDLE_TIMEOUT, markBackgroundTransactions: true, maxTransactionDuration: DEFAULT_MAX_TRANSACTION_DURATION_SECONDS, routingInstrumentation: instrumentRoutingWithDefaults, startTransactionOnLocationChange: true, startTransactionOnPageLoad: true }, defaultRequestInstrumentationOptions); | ||
var DEFAULT_BROWSER_TRACING_OPTIONS = __assign({ idleTimeout: DEFAULT_IDLE_TIMEOUT, finalTimeout: DEFAULT_FINAL_TIMEOUT, markBackgroundTransactions: true, maxTransactionDuration: DEFAULT_MAX_TRANSACTION_DURATION_SECONDS, routingInstrumentation: instrumentRoutingWithDefaults, startTransactionOnLocationChange: true, startTransactionOnPageLoad: true }, defaultRequestInstrumentationOptions); | ||
/** | ||
@@ -14,0 +14,0 @@ * The Browser Tracing integration automatically instruments browser pageload/navigation |
export declare const FINISH_REASON_TAG = "finishReason"; | ||
export declare const IDLE_TRANSACTION_FINISH_REASONS: readonly ["heartbeatFailed", "idleTimeout", "documentHidden"]; | ||
export declare const IDLE_TRANSACTION_FINISH_REASONS: readonly ["heartbeatFailed", "idleTimeout", "documentHidden", "finalTimeout"]; | ||
//# sourceMappingURL=constants.d.ts.map |
// Store finish reasons in tuple to save on bundle size | ||
// Readonly type should enforce that this is not mutated. | ||
export var FINISH_REASON_TAG = 'finishReason'; | ||
export var IDLE_TRANSACTION_FINISH_REASONS = ['heartbeatFailed', 'idleTimeout', 'documentHidden']; | ||
export var IDLE_TRANSACTION_FINISH_REASONS = [ | ||
'heartbeatFailed', | ||
'idleTimeout', | ||
'documentHidden', | ||
'finalTimeout', | ||
]; | ||
//# sourceMappingURL=constants.js.map |
@@ -6,2 +6,3 @@ import { Hub } from '@sentry/hub'; | ||
export declare const DEFAULT_IDLE_TIMEOUT = 1000; | ||
export declare const DEFAULT_FINAL_TIMEOUT = 30000; | ||
export declare const HEARTBEAT_INTERVAL = 5000; | ||
@@ -32,5 +33,16 @@ /** | ||
* @default 1000 | ||
* | ||
* TODO: Make _idleTimeout and _finalTimeout required to reduce duplication when setting the options | ||
* in `BrowserTracing`. This is considered a breaking change to the IdleTransaction API, | ||
* so we need to make sure we communicate it with react native. | ||
*/ | ||
private readonly _idleTimeout; | ||
private readonly _onScope; | ||
/** | ||
* The final value that a transaction cannot exceed | ||
* @default 30000 | ||
* @experimental | ||
* @internal | ||
*/ | ||
private readonly _finalTimeout; | ||
activities: Record<string, boolean>; | ||
@@ -45,3 +57,3 @@ private _prevHeartbeatString; | ||
*/ | ||
private _initTimeout; | ||
private _idleTimeoutID; | ||
constructor(transactionContext: TransactionContext, _idleHub?: Hub | undefined, | ||
@@ -51,4 +63,15 @@ /** | ||
* @default 1000 | ||
* | ||
* TODO: Make _idleTimeout and _finalTimeout required to reduce duplication when setting the options | ||
* in `BrowserTracing`. This is considered a breaking change to the IdleTransaction API, | ||
* so we need to make sure we communicate it with react native. | ||
*/ | ||
_idleTimeout?: number, _onScope?: boolean); | ||
_idleTimeout?: number, _onScope?: boolean, | ||
/** | ||
* The final value that a transaction cannot exceed | ||
* @default 30000 | ||
* @experimental | ||
* @internal | ||
*/ | ||
_finalTimeout?: number); | ||
/** {@inheritDoc} */ | ||
@@ -69,2 +92,10 @@ finish(endTimestamp?: number): string | undefined; | ||
/** | ||
* Creates an idletimeout | ||
*/ | ||
private _cancelIdleTimeout; | ||
/** | ||
* Creates an idletimeout | ||
*/ | ||
private _startIdleTimeout; | ||
/** | ||
* Start tracking a specific activity. | ||
@@ -71,0 +102,0 @@ * @param spanId The span id that represents the activity |
import { __extends, __values } from "tslib"; | ||
import { logger, timestampWithMs } from '@sentry/utils'; | ||
import { getGlobalObject, logger, timestampWithMs } from '@sentry/utils'; | ||
import { FINISH_REASON_TAG, IDLE_TRANSACTION_FINISH_REASONS } from './constants'; | ||
@@ -7,3 +7,5 @@ import { SpanRecorder } from './span'; | ||
export var DEFAULT_IDLE_TIMEOUT = 1000; | ||
export var DEFAULT_FINAL_TIMEOUT = 30000; | ||
export var HEARTBEAT_INTERVAL = 5000; | ||
var global = getGlobalObject(); | ||
/** | ||
@@ -56,8 +58,20 @@ * @inheritDoc | ||
* @default 1000 | ||
* | ||
* TODO: Make _idleTimeout and _finalTimeout required to reduce duplication when setting the options | ||
* in `BrowserTracing`. This is considered a breaking change to the IdleTransaction API, | ||
* so we need to make sure we communicate it with react native. | ||
*/ | ||
_idleTimeout, | ||
// Whether or not the transaction should put itself on the scope when it starts and pop itself off when it ends | ||
_onScope) { | ||
_onScope, | ||
/** | ||
* The final value that a transaction cannot exceed | ||
* @default 30000 | ||
* @experimental | ||
* @internal | ||
*/ | ||
_finalTimeout) { | ||
if (_idleTimeout === void 0) { _idleTimeout = DEFAULT_IDLE_TIMEOUT; } | ||
if (_onScope === void 0) { _onScope = false; } | ||
if (_finalTimeout === void 0) { _finalTimeout = DEFAULT_FINAL_TIMEOUT; } | ||
var _this = _super.call(this, transactionContext, _idleHub) || this; | ||
@@ -67,2 +81,3 @@ _this._idleHub = _idleHub; | ||
_this._onScope = _onScope; | ||
_this._finalTimeout = _finalTimeout; | ||
// Activities store a list of active spans | ||
@@ -83,7 +98,9 @@ _this.activities = {}; | ||
} | ||
_this._initTimeout = setTimeout(function () { | ||
_this._startIdleTimeout(); | ||
global.setTimeout(function () { | ||
if (!_this._finished) { | ||
_this.setTag(FINISH_REASON_TAG, IDLE_TRANSACTION_FINISH_REASONS[3]); | ||
_this.finish(); | ||
} | ||
}, _this._idleTimeout); | ||
}, _this._finalTimeout); | ||
return _this; | ||
@@ -177,2 +194,24 @@ } | ||
/** | ||
* Creates an idletimeout | ||
*/ | ||
IdleTransaction.prototype._cancelIdleTimeout = function () { | ||
if (this._idleTimeoutID) { | ||
global.clearTimeout(this._idleTimeoutID); | ||
this._idleTimeoutID = undefined; | ||
} | ||
}; | ||
/** | ||
* Creates an idletimeout | ||
*/ | ||
IdleTransaction.prototype._startIdleTimeout = function (end) { | ||
var _this = this; | ||
this._cancelIdleTimeout(); | ||
this._idleTimeoutID = global.setTimeout(function () { | ||
if (!_this._finished && Object.keys(_this.activities).length === 0) { | ||
_this.setTag(FINISH_REASON_TAG, IDLE_TRANSACTION_FINISH_REASONS[1]); | ||
_this.finish(end); | ||
} | ||
}, this._idleTimeout); | ||
}; | ||
/** | ||
* Start tracking a specific activity. | ||
@@ -182,6 +221,3 @@ * @param spanId The span id that represents the activity | ||
IdleTransaction.prototype._pushActivity = function (spanId) { | ||
if (this._initTimeout) { | ||
clearTimeout(this._initTimeout); | ||
this._initTimeout = undefined; | ||
} | ||
this._cancelIdleTimeout(); | ||
logger.log("[Tracing] pushActivity: " + spanId); | ||
@@ -196,3 +232,2 @@ this.activities[spanId] = true; | ||
IdleTransaction.prototype._popActivity = function (spanId) { | ||
var _this = this; | ||
if (this.activities[spanId]) { | ||
@@ -208,9 +243,4 @@ logger.log("[Tracing] popActivity " + spanId); | ||
// Remember timestampWithMs is in seconds, timeout is in ms | ||
var end_1 = timestampWithMs() + timeout / 1000; | ||
setTimeout(function () { | ||
if (!_this._finished) { | ||
_this.setTag(FINISH_REASON_TAG, IDLE_TRANSACTION_FINISH_REASONS[1]); | ||
_this.finish(end_1); | ||
} | ||
}, timeout); | ||
var end = timestampWithMs() + timeout / 1000; | ||
this._startIdleTimeout(end); | ||
} | ||
@@ -251,3 +281,3 @@ }; | ||
logger.log("pinging Heartbeat -> current counter: " + this._heartbeatCounter); | ||
setTimeout(function () { | ||
global.setTimeout(function () { | ||
_this._beat(); | ||
@@ -254,0 +284,0 @@ }, HEARTBEAT_INTERVAL); |
{ | ||
"name": "@sentry/tracing", | ||
"version": "6.17.7", | ||
"version": "6.17.8-beta.0", | ||
"description": "Extensions for Sentry AM", | ||
@@ -19,10 +19,10 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/hub": "6.17.7", | ||
"@sentry/minimal": "6.17.7", | ||
"@sentry/types": "6.17.7", | ||
"@sentry/utils": "6.17.7", | ||
"@sentry/hub": "6.17.8-beta.0", | ||
"@sentry/minimal": "6.17.8-beta.0", | ||
"@sentry/types": "6.17.8-beta.0", | ||
"@sentry/utils": "6.17.8-beta.0", | ||
"tslib": "^1.9.3" | ||
}, | ||
"devDependencies": { | ||
"@sentry/browser": "6.17.7", | ||
"@sentry/browser": "6.17.8-beta.0", | ||
"@types/express": "^4.17.1", | ||
@@ -29,0 +29,0 @@ "@types/jsdom": "^16.2.3", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
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
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
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2284596
16728
2
+ Added@sentry/hub@6.17.8-beta.0(transitive)
+ Added@sentry/minimal@6.17.8-beta.0(transitive)
+ Added@sentry/types@6.17.8-beta.0(transitive)
+ Added@sentry/utils@6.17.8-beta.0(transitive)
- Removed@sentry/hub@6.17.7(transitive)
- Removed@sentry/minimal@6.17.7(transitive)
- Removed@sentry/types@6.17.7(transitive)
- Removed@sentry/utils@6.17.7(transitive)
Updated@sentry/hub@6.17.8-beta.0
Updated@sentry/types@6.17.8-beta.0
Updated@sentry/utils@6.17.8-beta.0