You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@sentry/apm

Package Overview
Dependencies
Maintainers
13
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/apm - npm Package Compare versions

Comparing version

to
5.13.2

14

dist/integrations/tracing.d.ts

@@ -66,2 +66,11 @@ import { EventProcessor, Hub, Integration, Span, SpanContext, SpanStatus } from '@sentry/types';

maxTransactionDuration: number;
/**
* Flag to discard all spans that occur in background. This includes transactions. Browser background tab timing is
* not suited towards doing precise measurements of operations. That's why this option discards any active transaction
* and also doesn't add any spans that happen in the background. Background spans/transaction can mess up your
* statistics in non deterministic ways that's why we by default recommend leaving this opition enabled.
*
* Default: true
*/
discardBackgroundSpans: boolean;
}

@@ -77,3 +86,2 @@ /** JSDoc */

export declare class Tracing implements Integration {
private readonly _options?;
/**

@@ -99,3 +107,3 @@ * @inheritDoc

private static _currentIndex;
static readonly _activities: {
static _activities: {
[key: number]: Activity;

@@ -110,3 +118,3 @@ };

*/
constructor(_options?: Partial<TracingOptions> | undefined);
constructor(_options?: Partial<TracingOptions>);
/**

@@ -113,0 +121,0 @@ * @inheritDoc

@@ -17,3 +17,2 @@ Object.defineProperty(exports, "__esModule", { value: true });

function Tracing(_options) {
this._options = _options;
/**

@@ -25,2 +24,3 @@ * @inheritDoc

var defaults = {
discardBackgroundSpans: true,
idleTimeout: 500,

@@ -43,3 +43,3 @@ maxTransactionDuration: 600,

}
Tracing.options = this._options = tslib_1.__assign({}, defaults, _options);
Tracing.options = tslib_1.__assign({}, defaults, _options);
}

@@ -58,4 +58,3 @@ /**

}
// tslint:disable-next-line: no-non-null-assertion
if (this._options.traceXHR !== false) {
if (Tracing.options.traceXHR) {
utils_1.addInstrumentationHandler({

@@ -66,4 +65,3 @@ callback: xhrCallback,

}
// tslint:disable-next-line: no-non-null-assertion
if (this._options.traceFetch !== false && utils_1.supportsNativeFetch()) {
if (Tracing.options.traceFetch && utils_1.supportsNativeFetch()) {
utils_1.addInstrumentationHandler({

@@ -74,4 +72,3 @@ callback: fetchCallback,

}
// tslint:disable-next-line: no-non-null-assertion
if (this._options.startTransactionOnLocationChange) {
if (Tracing.options.startTransactionOnLocationChange) {
utils_1.addInstrumentationHandler({

@@ -89,2 +86,11 @@ callback: historyCallback,

}
if (Tracing.options.discardBackgroundSpans && global.document) {
document.addEventListener('visibilitychange', function () {
if (document.hidden && Tracing._activeTransaction) {
utils_1.logger.log('[Tracing] Discarded active transaction incl. activities since tab moved to the background');
Tracing._activeTransaction = undefined;
Tracing._activities = {};
}
});
}
// This EventProcessor makes sure that the transaction is not longer than maxTransactionDuration

@@ -208,2 +214,6 @@ addGlobalEventProcessor(function (event) {

}
if (!Tracing._activeTransaction) {
utils_1.logger.log("[Tracing] Not pushing activity " + name + " since there is no active transaction");
return 0;
}
// We want to clear the timeout also here since we push a new activity

@@ -244,3 +254,6 @@ clearTimeout(Tracing._debounce);

Tracing.popActivity = function (id, spanData) {
if (!Tracing._isEnabled()) {
// The !id is on purpose to also fail with 0
// Since 0 is returned by push activity in case tracing is not enabled
// or there is no active transaction
if (!Tracing._isEnabled() || !id) {
// Tracing is not enabled

@@ -273,3 +286,3 @@ return;

utils_1.logger.log('[Tracing] activies count', count);
if (count === 0) {
if (count === 0 && Tracing._activeTransaction) {
var timeout = Tracing.options && Tracing.options.idleTimeout;

@@ -286,3 +299,3 @@ utils_1.logger.log("[Tracing] Flushing Transaction in " + timeout + "ms");

Tracing.id = 'Tracing';
Tracing._currentIndex = 0;
Tracing._currentIndex = 1;
Tracing._activities = {};

@@ -289,0 +302,0 @@ Tracing._debounce = 0;

@@ -66,2 +66,11 @@ import { EventProcessor, Hub, Integration, Span, SpanContext, SpanStatus } from '@sentry/types';

maxTransactionDuration: number;
/**
* Flag to discard all spans that occur in background. This includes transactions. Browser background tab timing is
* not suited towards doing precise measurements of operations. That's why this option discards any active transaction
* and also doesn't add any spans that happen in the background. Background spans/transaction can mess up your
* statistics in non deterministic ways that's why we by default recommend leaving this opition enabled.
*
* Default: true
*/
discardBackgroundSpans: boolean;
}

@@ -77,3 +86,2 @@ /** JSDoc */

export declare class Tracing implements Integration {
private readonly _options?;
/**

@@ -99,3 +107,3 @@ * @inheritDoc

private static _currentIndex;
static readonly _activities: {
static _activities: {
[key: number]: Activity;

@@ -110,3 +118,3 @@ };

*/
constructor(_options?: Partial<TracingOptions> | undefined);
constructor(_options?: Partial<TracingOptions>);
/**

@@ -113,0 +121,0 @@ * @inheritDoc

@@ -16,3 +16,2 @@ import * as tslib_1 from "tslib";

function Tracing(_options) {
this._options = _options;
/**

@@ -24,2 +23,3 @@ * @inheritDoc

var defaults = {
discardBackgroundSpans: true,
idleTimeout: 500,

@@ -42,3 +42,3 @@ maxTransactionDuration: 600,

}
Tracing.options = this._options = tslib_1.__assign({}, defaults, _options);
Tracing.options = tslib_1.__assign({}, defaults, _options);
}

@@ -57,4 +57,3 @@ /**

}
// tslint:disable-next-line: no-non-null-assertion
if (this._options.traceXHR !== false) {
if (Tracing.options.traceXHR) {
addInstrumentationHandler({

@@ -65,4 +64,3 @@ callback: xhrCallback,

}
// tslint:disable-next-line: no-non-null-assertion
if (this._options.traceFetch !== false && supportsNativeFetch()) {
if (Tracing.options.traceFetch && supportsNativeFetch()) {
addInstrumentationHandler({

@@ -73,4 +71,3 @@ callback: fetchCallback,

}
// tslint:disable-next-line: no-non-null-assertion
if (this._options.startTransactionOnLocationChange) {
if (Tracing.options.startTransactionOnLocationChange) {
addInstrumentationHandler({

@@ -88,2 +85,11 @@ callback: historyCallback,

}
if (Tracing.options.discardBackgroundSpans && global.document) {
document.addEventListener('visibilitychange', function () {
if (document.hidden && Tracing._activeTransaction) {
logger.log('[Tracing] Discarded active transaction incl. activities since tab moved to the background');
Tracing._activeTransaction = undefined;
Tracing._activities = {};
}
});
}
// This EventProcessor makes sure that the transaction is not longer than maxTransactionDuration

@@ -207,2 +213,6 @@ addGlobalEventProcessor(function (event) {

}
if (!Tracing._activeTransaction) {
logger.log("[Tracing] Not pushing activity " + name + " since there is no active transaction");
return 0;
}
// We want to clear the timeout also here since we push a new activity

@@ -243,3 +253,6 @@ clearTimeout(Tracing._debounce);

Tracing.popActivity = function (id, spanData) {
if (!Tracing._isEnabled()) {
// The !id is on purpose to also fail with 0
// Since 0 is returned by push activity in case tracing is not enabled
// or there is no active transaction
if (!Tracing._isEnabled() || !id) {
// Tracing is not enabled

@@ -272,3 +285,3 @@ return;

logger.log('[Tracing] activies count', count);
if (count === 0) {
if (count === 0 && Tracing._activeTransaction) {
var timeout = Tracing.options && Tracing.options.idleTimeout;

@@ -285,3 +298,3 @@ logger.log("[Tracing] Flushing Transaction in " + timeout + "ms");

Tracing.id = 'Tracing';
Tracing._currentIndex = 0;
Tracing._currentIndex = 1;
Tracing._activities = {};

@@ -288,0 +301,0 @@ Tracing._debounce = 0;

{
"name": "@sentry/apm",
"version": "5.13.1",
"version": "5.13.2",
"description": "Extensions for APM",

@@ -19,7 +19,7 @@ "repository": "git://github.com/getsentry/sentry-javascript.git",

"dependencies": {
"@sentry/browser": "5.13.0",
"@sentry/hub": "5.13.0",
"@sentry/minimal": "5.13.0",
"@sentry/types": "5.12.4",
"@sentry/utils": "5.13.0",
"@sentry/browser": "5.13.2",
"@sentry/hub": "5.13.2",
"@sentry/minimal": "5.13.2",
"@sentry/types": "5.13.2",
"@sentry/utils": "5.13.2",
"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