@sentry/integrations
Advanced tools
Comparing version 5.10.0-beta.2 to 5.10.0-beta.3
@@ -269,3 +269,4 @@ (function (__window) { | ||
// This happens only in test cases where the integration isn't initalized properly | ||
if (!TransactionActivity.options || isNaN(TransactionActivity.options.tracesSampleRate)) { | ||
// tslint:disable-next-line: strict-type-predicates | ||
if (!TransactionActivity.options || typeof TransactionActivity.options.tracesSampleRate !== 'number') { | ||
return false; | ||
@@ -301,5 +302,7 @@ } | ||
TransactionActivity._activeTransaction = span; | ||
hub.configureScope(function (scope) { | ||
scope.setSpan(span); | ||
}); | ||
// 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 | ||
// therefore configureScope wouldn't be executed and we would miss setting the transaction | ||
// tslint:disable-next-line: no-unsafe-any | ||
hub.getScope().setSpan(span); | ||
// The reason we do this here is because of cached responses | ||
@@ -342,2 +345,4 @@ // If we start and transaction without an activity it would never finish since there is no activity | ||
} | ||
// We want to clear the timeout also here since we push a new activity | ||
clearTimeout(TransactionActivity._debounce); | ||
var _getCurrentHub = TransactionActivity._getCurrentHub; | ||
@@ -363,3 +368,3 @@ if (spanContext && _getCurrentHub) { | ||
*/ | ||
TransactionActivity.popActivity = function (id) { | ||
TransactionActivity.popActivity = function (id, spanData) { | ||
if (!TransactionActivity._isEnabled()) { | ||
@@ -371,4 +376,10 @@ // Tracing is not enabled | ||
if (activity) { | ||
if (activity.span) { | ||
activity.span.finish(); | ||
var span_1 = activity.span; | ||
if (span_1) { | ||
if (spanData) { | ||
Object.keys(spanData).forEach(function (key) { | ||
span_1.setData(key, spanData[key]); | ||
}); | ||
} | ||
span_1.finish(); | ||
} | ||
@@ -402,3 +413,3 @@ // tslint:disable-next-line: no-dynamic-delete | ||
if (handlerData.requestComplete && handlerData.xhr.__sentry_xhr_activity_id__) { | ||
TransactionActivity.popActivity(handlerData.xhr.__sentry_xhr_activity_id__); | ||
TransactionActivity.popActivity(handlerData.xhr.__sentry_xhr_activity_id__, handlerData.xhr.__sentry_xhr__); | ||
return; | ||
@@ -405,0 +416,0 @@ } |
@@ -1,2 +0,2 @@ | ||
!function(t){var n={};Object.defineProperty(n,"__esModule",{value:!0});var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)};var o=function(){return(o=Object.assign||function(t){for(var n,e=1,o=arguments.length;e<o;e++)for(var r in n=arguments[e])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){return t.__proto__=n,t}:function(t,n){for(var e in n)t.hasOwnProperty(e)||(t[e]=n[e]);return t});!function(t){function n(n){var e=this.constructor,o=t.call(this,n)||this;return o.message=n,o.name=e.prototype.constructor.name,r(o,e.prototype),o}(function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)})(n,t)}(Error);var i={};function a(){return"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:i}function c(t){var n=a();if(!("console"in n))return t();var e=n.console,o={};["debug","info","warn","error","log","assert"].forEach(function(t){t in n.console&&e[t].__sentry__&&(o[t]=e[t].__sentry_wrapped__,e[t]=e[t].__sentry_original__)});var r=t();return Object.keys(o).forEach(function(t){e[t]=o[t]}),r}var s=a(),_="Sentry Logger ",u=function(){function t(){this._enabled=!1}return t.prototype.disable=function(){this._enabled=!1},t.prototype.enable=function(){this._enabled=!0},t.prototype.log=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._enabled&&c(function(){s.console.log(_+"[Log]: "+t.join(" "))})},t.prototype.warn=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._enabled&&c(function(){s.console.warn(_+"[Warn]: "+t.join(" "))})},t.prototype.error=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._enabled&&c(function(){s.console.error(_+"[Error]: "+t.join(" "))})},t}();s.__SENTRY__=s.__SENTRY__||{};var p;s.__SENTRY__.logger||(s.__SENTRY__.logger=new u);!function(t){t.PENDING="PENDING",t.RESOLVED="RESOLVED",t.REJECTED="REJECTED"}(p||(p={}));var f=a(),l=function(){function t(n){this._options=n,this.name=t.id;var e={idleTimeout:500,onLocationChange:function(){return f.location.href},patchHistory:!0,startTransactionOnLocationChange:!0,tracesSampleRate:1};t.options=o({},e,n)}return t.prototype.setupOnce=function(n,e){t._getCurrentHub=e,t._isEnabled()&&f.location&&f.location.href&&t.startIdleTransaction(f.location.href,{op:"pageload",sampled:!0})},t._isEnabled=function(){return void 0!==t._enabled?t._enabled:!(!t.options||isNaN(t.options.tracesSampleRate))&&(t._enabled=!(Math.random()>t.options.tracesSampleRate),t._enabled)},t.startIdleTransaction=function(n,e){if(t._isEnabled()){var r=t._activeTransaction;r&&r.finish();var i=t._getCurrentHub;if(i){var a=i();if(a){var c=a.startSpan(o({},e,{transaction:n}),!0);t._activeTransaction=c,a.configureScope(function(t){t.setSpan(c)});var s=t.pushActivity("idleTransactionStarted");return setTimeout(function(){t.popActivity(s)},t.options&&t.options.idleTimeout||100),c}}}},t.updateTransactionName=function(n){var e=t._activeTransaction;e&&(e.transaction=n)},t.finishIdleTransaction=function(){var n=t._activeTransaction;n&&n.finish(!0)},t.pushActivity=function(n,e){if(!t._isEnabled())return 0;var o=t._getCurrentHub;if(e&&o){var r=o();r&&(t._activities[t._currentIndex]={name:n,span:r.startSpan(e)})}else t._activities[t._currentIndex]={name:n};return t._currentIndex++},t.popActivity=function(n){if(t._isEnabled()){var e=t._activities[n];e&&(e.span&&e.span.finish(),delete t._activities[n]);var o=Object.keys(t._activities).length;if(clearTimeout(t._debounce),0===o){var r=t.options&&t.options.idleTimeout;t._debounce=setTimeout(function(){t.finishIdleTransaction()},r)}}},t.id="TransactionActivity",t._currentIndex=0,t._activities={},t._debounce=0,t}();var d=[{callback:function(t){l.options.startTransactionOnLocationChange&&l.startIdleTransaction(f.location.href,{op:"navigation",sampled:!0})},type:"history"},{callback:function(t){if(t.requestComplete&&t.xhr.__sentry_xhr_activity_id__)l.popActivity(t.xhr.__sentry_xhr_activity_id__);else if(!t.xhr.__sentry_own_request__){var n=t.xhr.__sentry_xhr__;t.xhr.__sentry_xhr_activity_id__=l.pushActivity("xhr",{data:{request_data:n.data},description:n.method+" "+n.url,op:"http"})}},type:"xhr"}];for(var v in n.TransactionActivity=l,n.TransactionActivityHandlers=d,t.Sentry=t.Sentry||{},t.Sentry.Integrations=t.Sentry.Integrations||{},n)Object.prototype.hasOwnProperty.call(n,v)&&(t.Sentry.Integrations[v]=n[v])}(window); | ||
!function(t){var n={};Object.defineProperty(n,"__esModule",{value:!0});var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)};var r=function(){return(r=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t}).apply(this,arguments)},o=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){return t.__proto__=n,t}:function(t,n){for(var e in n)t.hasOwnProperty(e)||(t[e]=n[e]);return t});!function(t){function n(n){var e=this.constructor,r=t.call(this,n)||this;return r.message=n,r.name=e.prototype.constructor.name,o(r,e.prototype),r}(function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)})(n,t)}(Error);var i={};function a(){return"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:i}function c(t){var n=a();if(!("console"in n))return t();var e=n.console,r={};["debug","info","warn","error","log","assert"].forEach(function(t){t in n.console&&e[t].__sentry__&&(r[t]=e[t].__sentry_wrapped__,e[t]=e[t].__sentry_original__)});var o=t();return Object.keys(r).forEach(function(t){e[t]=r[t]}),o}var s=a(),_="Sentry Logger ",u=function(){function t(){this._enabled=!1}return t.prototype.disable=function(){this._enabled=!1},t.prototype.enable=function(){this._enabled=!0},t.prototype.log=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._enabled&&c(function(){s.console.log(_+"[Log]: "+t.join(" "))})},t.prototype.warn=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._enabled&&c(function(){s.console.warn(_+"[Warn]: "+t.join(" "))})},t.prototype.error=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._enabled&&c(function(){s.console.error(_+"[Error]: "+t.join(" "))})},t}();s.__SENTRY__=s.__SENTRY__||{};var p;s.__SENTRY__.logger||(s.__SENTRY__.logger=new u);!function(t){t.PENDING="PENDING",t.RESOLVED="RESOLVED",t.REJECTED="REJECTED"}(p||(p={}));var f=a(),l=function(){function t(n){this._options=n,this.name=t.id;var e={idleTimeout:500,onLocationChange:function(){return f.location.href},patchHistory:!0,startTransactionOnLocationChange:!0,tracesSampleRate:1};t.options=r({},e,n)}return t.prototype.setupOnce=function(n,e){t._getCurrentHub=e,t._isEnabled()&&f.location&&f.location.href&&t.startIdleTransaction(f.location.href,{op:"pageload",sampled:!0})},t._isEnabled=function(){return void 0!==t._enabled?t._enabled:!(!t.options||"number"!=typeof t.options.tracesSampleRate)&&(t._enabled=!(Math.random()>t.options.tracesSampleRate),t._enabled)},t.startIdleTransaction=function(n,e){if(t._isEnabled()){var o=t._activeTransaction;o&&o.finish();var i=t._getCurrentHub;if(i){var a=i();if(a){var c=a.startSpan(r({},e,{transaction:n}),!0);t._activeTransaction=c,a.getScope().setSpan(c);var s=t.pushActivity("idleTransactionStarted");return setTimeout(function(){t.popActivity(s)},t.options&&t.options.idleTimeout||100),c}}}},t.updateTransactionName=function(n){var e=t._activeTransaction;e&&(e.transaction=n)},t.finishIdleTransaction=function(){var n=t._activeTransaction;n&&n.finish(!0)},t.pushActivity=function(n,e){if(!t._isEnabled())return 0;clearTimeout(t._debounce);var r=t._getCurrentHub;if(e&&r){var o=r();o&&(t._activities[t._currentIndex]={name:n,span:o.startSpan(e)})}else t._activities[t._currentIndex]={name:n};return t._currentIndex++},t.popActivity=function(n,e){if(t._isEnabled()){var r=t._activities[n];if(r){var o=r.span;o&&(e&&Object.keys(e).forEach(function(t){o.setData(t,e[t])}),o.finish()),delete t._activities[n]}var i=Object.keys(t._activities).length;if(clearTimeout(t._debounce),0===i){var a=t.options&&t.options.idleTimeout;t._debounce=setTimeout(function(){t.finishIdleTransaction()},a)}}},t.id="TransactionActivity",t._currentIndex=0,t._activities={},t._debounce=0,t}();var d=[{callback:function(t){l.options.startTransactionOnLocationChange&&l.startIdleTransaction(f.location.href,{op:"navigation",sampled:!0})},type:"history"},{callback:function(t){if(t.requestComplete&&t.xhr.__sentry_xhr_activity_id__)l.popActivity(t.xhr.__sentry_xhr_activity_id__,t.xhr.__sentry_xhr__);else if(!t.xhr.__sentry_own_request__){var n=t.xhr.__sentry_xhr__;t.xhr.__sentry_xhr_activity_id__=l.pushActivity("xhr",{data:{request_data:n.data},description:n.method+" "+n.url,op:"http"})}},type:"xhr"}];for(var y in n.TransactionActivity=l,n.TransactionActivityHandlers=d,t.Sentry=t.Sentry||{},t.Sentry.Integrations=t.Sentry.Integrations||{},n)Object.prototype.hasOwnProperty.call(n,y)&&(t.Sentry.Integrations[y]=n[y])}(window); | ||
//# sourceMappingURL=transactionactivity.min.js.map |
@@ -69,3 +69,5 @@ import { EventProcessor, Hub, Integration, Span, SpanContext } from '@sentry/types'; | ||
*/ | ||
static popActivity(id: number): void; | ||
static popActivity(id: number, spanData?: { | ||
[key: string]: any; | ||
}): void; | ||
} | ||
@@ -72,0 +74,0 @@ /** |
@@ -49,3 +49,4 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
// This happens only in test cases where the integration isn't initalized properly | ||
if (!TransactionActivity.options || isNaN(TransactionActivity.options.tracesSampleRate)) { | ||
// tslint:disable-next-line: strict-type-predicates | ||
if (!TransactionActivity.options || typeof TransactionActivity.options.tracesSampleRate !== 'number') { | ||
return false; | ||
@@ -81,5 +82,7 @@ } | ||
TransactionActivity._activeTransaction = span; | ||
hub.configureScope(function (scope) { | ||
scope.setSpan(span); | ||
}); | ||
// 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 | ||
// therefore configureScope wouldn't be executed and we would miss setting the transaction | ||
// tslint:disable-next-line: no-unsafe-any | ||
hub.getScope().setSpan(span); | ||
// The reason we do this here is because of cached responses | ||
@@ -122,2 +125,4 @@ // If we start and transaction without an activity it would never finish since there is no activity | ||
} | ||
// We want to clear the timeout also here since we push a new activity | ||
clearTimeout(TransactionActivity._debounce); | ||
var _getCurrentHub = TransactionActivity._getCurrentHub; | ||
@@ -143,3 +148,3 @@ if (spanContext && _getCurrentHub) { | ||
*/ | ||
TransactionActivity.popActivity = function (id) { | ||
TransactionActivity.popActivity = function (id, spanData) { | ||
if (!TransactionActivity._isEnabled()) { | ||
@@ -151,4 +156,10 @@ // Tracing is not enabled | ||
if (activity) { | ||
if (activity.span) { | ||
activity.span.finish(); | ||
var span_1 = activity.span; | ||
if (span_1) { | ||
if (spanData) { | ||
Object.keys(spanData).forEach(function (key) { | ||
span_1.setData(key, spanData[key]); | ||
}); | ||
} | ||
span_1.finish(); | ||
} | ||
@@ -183,3 +194,3 @@ // tslint:disable-next-line: no-dynamic-delete | ||
if (handlerData.requestComplete && handlerData.xhr.__sentry_xhr_activity_id__) { | ||
TransactionActivity.popActivity(handlerData.xhr.__sentry_xhr_activity_id__); | ||
TransactionActivity.popActivity(handlerData.xhr.__sentry_xhr_activity_id__, handlerData.xhr.__sentry_xhr__); | ||
return; | ||
@@ -186,0 +197,0 @@ } |
@@ -69,3 +69,5 @@ import { EventProcessor, Hub, Integration, Span, SpanContext } from '@sentry/types'; | ||
*/ | ||
static popActivity(id: number): void; | ||
static popActivity(id: number, spanData?: { | ||
[key: string]: any; | ||
}): void; | ||
} | ||
@@ -72,0 +74,0 @@ /** |
@@ -48,3 +48,4 @@ import * as tslib_1 from "tslib"; | ||
// This happens only in test cases where the integration isn't initalized properly | ||
if (!TransactionActivity.options || isNaN(TransactionActivity.options.tracesSampleRate)) { | ||
// tslint:disable-next-line: strict-type-predicates | ||
if (!TransactionActivity.options || typeof TransactionActivity.options.tracesSampleRate !== 'number') { | ||
return false; | ||
@@ -80,5 +81,7 @@ } | ||
TransactionActivity._activeTransaction = span; | ||
hub.configureScope(function (scope) { | ||
scope.setSpan(span); | ||
}); | ||
// 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 | ||
// therefore configureScope wouldn't be executed and we would miss setting the transaction | ||
// tslint:disable-next-line: no-unsafe-any | ||
hub.getScope().setSpan(span); | ||
// The reason we do this here is because of cached responses | ||
@@ -121,2 +124,4 @@ // If we start and transaction without an activity it would never finish since there is no activity | ||
} | ||
// We want to clear the timeout also here since we push a new activity | ||
clearTimeout(TransactionActivity._debounce); | ||
var _getCurrentHub = TransactionActivity._getCurrentHub; | ||
@@ -142,3 +147,3 @@ if (spanContext && _getCurrentHub) { | ||
*/ | ||
TransactionActivity.popActivity = function (id) { | ||
TransactionActivity.popActivity = function (id, spanData) { | ||
if (!TransactionActivity._isEnabled()) { | ||
@@ -150,4 +155,10 @@ // Tracing is not enabled | ||
if (activity) { | ||
if (activity.span) { | ||
activity.span.finish(); | ||
var span_1 = activity.span; | ||
if (span_1) { | ||
if (spanData) { | ||
Object.keys(spanData).forEach(function (key) { | ||
span_1.setData(key, spanData[key]); | ||
}); | ||
} | ||
span_1.finish(); | ||
} | ||
@@ -182,3 +193,3 @@ // tslint:disable-next-line: no-dynamic-delete | ||
if (handlerData.requestComplete && handlerData.xhr.__sentry_xhr_activity_id__) { | ||
TransactionActivity.popActivity(handlerData.xhr.__sentry_xhr_activity_id__); | ||
TransactionActivity.popActivity(handlerData.xhr.__sentry_xhr_activity_id__, handlerData.xhr.__sentry_xhr__); | ||
return; | ||
@@ -185,0 +196,0 @@ } |
{ | ||
"name": "@sentry/integrations", | ||
"version": "5.10.0-beta.2", | ||
"version": "5.10.0-beta.3", | ||
"description": "Pluggable integrations that can be used to enchance JS SDKs", | ||
@@ -19,4 +19,4 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/types": "5.10.0-beta.2", | ||
"@sentry/utils": "5.10.0-beta.2", | ||
"@sentry/types": "5.10.0-beta.3", | ||
"@sentry/utils": "5.10.0-beta.3", | ||
"tslib": "^1.9.3" | ||
@@ -23,0 +23,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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1472047
9283
+ Added@sentry/types@5.10.0-beta.3(transitive)
+ Added@sentry/utils@5.10.0-beta.3(transitive)
- Removed@sentry/types@5.10.0-beta.2(transitive)
- Removed@sentry/utils@5.10.0-beta.2(transitive)
Updated@sentry/types@5.10.0-beta.3
Updated@sentry/utils@5.10.0-beta.3