@sentry/apm
Advanced tools
Comparing version 5.12.5 to 5.13.0
@@ -135,4 +135,10 @@ import { EventProcessor, Hub, Integration, Span, SpanContext, SpanStatus } from '@sentry/types'; | ||
* Starts tracking for a specifc activity | ||
* | ||
* @param name Name of the activity, can be any string (Only used internally to identify the activity) | ||
* @param spanContext If provided a Span with the SpanContext will be created. | ||
* @param options _autoPopAfter_ | Time in ms, if provided the activity will be popped automatically after this timeout. This can be helpful in cases where you cannot gurantee your application knows the state and calls `popActivity` for sure. | ||
*/ | ||
static pushActivity(name: string, spanContext?: SpanContext): number; | ||
static pushActivity(name: string, spanContext?: SpanContext, options?: { | ||
autoPopAfter?: number; | ||
}): number; | ||
/** | ||
@@ -139,0 +145,0 @@ * Removes activity and finishes the span in case there is one |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var types_1 = require("@sentry/types"); | ||
var utils_1 = require("@sentry/utils"); | ||
@@ -48,4 +49,4 @@ var global = utils_1.getGlobalObject(); | ||
if (this._emitOptionsWarning) { | ||
utils_1.logger.warn('Sentry: You need to define `tracingOrigins` in the options. Set an array of urls or patterns to trace.'); | ||
utils_1.logger.warn("Sentry: We added a reasonable default for you: " + defaultTracingOrigins); | ||
utils_1.logger.warn('[Tracing] You need to define `tracingOrigins` in the options. Set an array of urls or patterns to trace.'); | ||
utils_1.logger.warn("[Tracing] We added a reasonable default for you: " + defaultTracingOrigins); | ||
} | ||
@@ -128,2 +129,3 @@ if (!Tracing._isEnabled()) { | ||
Tracing.finishIdleTransaction(); | ||
utils_1.logger.log('[Tracing] startIdleTransaction, name:', name); | ||
var _getCurrentHub = Tracing._getCurrentHub; | ||
@@ -157,2 +159,3 @@ if (!_getCurrentHub) { | ||
Tracing.updateTransactionName = function (name) { | ||
utils_1.logger.log('[Tracing] DEPRECATED, use Sentry.configureScope => scope.setTransaction instead', name); | ||
var _getCurrentHub = Tracing._getCurrentHub; | ||
@@ -174,2 +177,3 @@ if (_getCurrentHub) { | ||
if (active) { | ||
utils_1.logger.log('[Tracing] finishIdleTransaction', active.transaction); | ||
// true = use timestamp of last span | ||
@@ -185,2 +189,3 @@ active.finish(true); | ||
if (active) { | ||
utils_1.logger.log('[Tracing] setTransactionStatus', status); | ||
active.setStatus(status); | ||
@@ -191,4 +196,8 @@ } | ||
* Starts tracking for a specifc activity | ||
* | ||
* @param name Name of the activity, can be any string (Only used internally to identify the activity) | ||
* @param spanContext If provided a Span with the SpanContext will be created. | ||
* @param options _autoPopAfter_ | Time in ms, if provided the activity will be popped automatically after this timeout. This can be helpful in cases where you cannot gurantee your application knows the state and calls `popActivity` for sure. | ||
*/ | ||
Tracing.pushActivity = function (name, spanContext) { | ||
Tracing.pushActivity = function (name, spanContext, options) { | ||
if (!Tracing._isEnabled()) { | ||
@@ -215,2 +224,14 @@ // Tracing is not enabled | ||
} | ||
utils_1.logger.log("[Tracing] pushActivity: " + name + "#" + Tracing._currentIndex); | ||
utils_1.logger.log('[Tracing] activies count', Object.keys(Tracing._activities).length); | ||
if (options && typeof options.autoPopAfter === 'number') { | ||
utils_1.logger.log("[Tracing] auto pop of: " + name + "#" + Tracing._currentIndex + " in " + options.autoPopAfter + "ms"); | ||
var index_1 = Tracing._currentIndex; | ||
setTimeout(function () { | ||
Tracing.popActivity(index_1, { | ||
autoPop: true, | ||
status: types_1.SpanStatus.DeadlineExceeded, | ||
}); | ||
}, options.autoPopAfter); | ||
} | ||
return Tracing._currentIndex++; | ||
@@ -228,2 +249,3 @@ }; | ||
if (activity) { | ||
utils_1.logger.log("[Tracing] popActivity " + activity.name + "#" + id); | ||
var span_1 = activity.span; | ||
@@ -237,2 +259,5 @@ if (span_1) { | ||
} | ||
if (key === 'status') { | ||
span_1.setStatus(spanData[key]); | ||
} | ||
}); | ||
@@ -247,4 +272,6 @@ } | ||
clearTimeout(Tracing._debounce); | ||
utils_1.logger.log('[Tracing] activies count', count); | ||
if (count === 0) { | ||
var timeout = Tracing.options && Tracing.options.idleTimeout; | ||
utils_1.logger.log("[Tracing] Flushing Transaction in " + timeout + "ms"); | ||
Tracing._debounce = setTimeout(function () { | ||
@@ -251,0 +278,0 @@ Tracing.finishIdleTransaction(); |
@@ -54,2 +54,12 @@ import { Hub } from '@sentry/hub'; | ||
/** | ||
* Internal start time tracked with a monotonic clock. | ||
* | ||
* Works with mostly any browser version released since 2012. | ||
* https://caniuse.com/#search=performance.now | ||
* | ||
* Works with Node.js v8.5.0 or higher. | ||
* https://nodejs.org/api/perf_hooks.html#perf_hooks_performance_now | ||
*/ | ||
private readonly _startTimestampMonotonic; | ||
/** | ||
* Finish timestamp of the span. | ||
@@ -56,0 +66,0 @@ */ |
@@ -7,2 +7,13 @@ // tslint:disable:max-classes-per-file | ||
var utils_1 = require("@sentry/utils"); | ||
var crossPlatformPerformance = (function () { | ||
if (utils_1.isNodeEnv()) { | ||
var performance_1 = utils_1.dynamicRequire(module, 'perf_hooks').performance; | ||
return performance_1; | ||
} | ||
return (utils_1.getGlobalObject().performance || { | ||
now: function () { | ||
return Date.now(); | ||
}, | ||
}); | ||
})(); | ||
// TODO: Should this be exported? | ||
@@ -66,2 +77,12 @@ exports.TRACEPARENT_REGEXP = new RegExp('^[ \\t]*' + // whitespace | ||
/** | ||
* Internal start time tracked with a monotonic clock. | ||
* | ||
* Works with mostly any browser version released since 2012. | ||
* https://caniuse.com/#search=performance.now | ||
* | ||
* Works with Node.js v8.5.0 or higher. | ||
* https://nodejs.org/api/perf_hooks.html#perf_hooks_performance_now | ||
*/ | ||
this._startTimestampMonotonic = crossPlatformPerformance.now(); | ||
/** | ||
* @inheritDoc | ||
@@ -197,3 +218,4 @@ */ | ||
} | ||
this.timestamp = utils_1.timestampWithMs(); | ||
var durationSeconds = (crossPlatformPerformance.now() - this._startTimestampMonotonic) / 1000; | ||
this.timestamp = this.startTimestamp + durationSeconds; | ||
if (this.spanRecorder === undefined) { | ||
@@ -200,0 +222,0 @@ return undefined; |
@@ -135,4 +135,10 @@ import { EventProcessor, Hub, Integration, Span, SpanContext, SpanStatus } from '@sentry/types'; | ||
* Starts tracking for a specifc activity | ||
* | ||
* @param name Name of the activity, can be any string (Only used internally to identify the activity) | ||
* @param spanContext If provided a Span with the SpanContext will be created. | ||
* @param options _autoPopAfter_ | Time in ms, if provided the activity will be popped automatically after this timeout. This can be helpful in cases where you cannot gurantee your application knows the state and calls `popActivity` for sure. | ||
*/ | ||
static pushActivity(name: string, spanContext?: SpanContext): number; | ||
static pushActivity(name: string, spanContext?: SpanContext, options?: { | ||
autoPopAfter?: number; | ||
}): number; | ||
/** | ||
@@ -139,0 +145,0 @@ * Removes activity and finishes the span in case there is one |
import * as tslib_1 from "tslib"; | ||
import { SpanStatus } from '@sentry/types'; | ||
import { addInstrumentationHandler, getGlobalObject, isMatchingPattern, logger, supportsNativeFetch, } from '@sentry/utils'; | ||
@@ -47,4 +48,4 @@ var global = getGlobalObject(); | ||
if (this._emitOptionsWarning) { | ||
logger.warn('Sentry: You need to define `tracingOrigins` in the options. Set an array of urls or patterns to trace.'); | ||
logger.warn("Sentry: We added a reasonable default for you: " + defaultTracingOrigins); | ||
logger.warn('[Tracing] You need to define `tracingOrigins` in the options. Set an array of urls or patterns to trace.'); | ||
logger.warn("[Tracing] We added a reasonable default for you: " + defaultTracingOrigins); | ||
} | ||
@@ -127,2 +128,3 @@ if (!Tracing._isEnabled()) { | ||
Tracing.finishIdleTransaction(); | ||
logger.log('[Tracing] startIdleTransaction, name:', name); | ||
var _getCurrentHub = Tracing._getCurrentHub; | ||
@@ -156,2 +158,3 @@ if (!_getCurrentHub) { | ||
Tracing.updateTransactionName = function (name) { | ||
logger.log('[Tracing] DEPRECATED, use Sentry.configureScope => scope.setTransaction instead', name); | ||
var _getCurrentHub = Tracing._getCurrentHub; | ||
@@ -173,2 +176,3 @@ if (_getCurrentHub) { | ||
if (active) { | ||
logger.log('[Tracing] finishIdleTransaction', active.transaction); | ||
// true = use timestamp of last span | ||
@@ -184,2 +188,3 @@ active.finish(true); | ||
if (active) { | ||
logger.log('[Tracing] setTransactionStatus', status); | ||
active.setStatus(status); | ||
@@ -190,4 +195,8 @@ } | ||
* Starts tracking for a specifc activity | ||
* | ||
* @param name Name of the activity, can be any string (Only used internally to identify the activity) | ||
* @param spanContext If provided a Span with the SpanContext will be created. | ||
* @param options _autoPopAfter_ | Time in ms, if provided the activity will be popped automatically after this timeout. This can be helpful in cases where you cannot gurantee your application knows the state and calls `popActivity` for sure. | ||
*/ | ||
Tracing.pushActivity = function (name, spanContext) { | ||
Tracing.pushActivity = function (name, spanContext, options) { | ||
if (!Tracing._isEnabled()) { | ||
@@ -214,2 +223,14 @@ // Tracing is not enabled | ||
} | ||
logger.log("[Tracing] pushActivity: " + name + "#" + Tracing._currentIndex); | ||
logger.log('[Tracing] activies count', Object.keys(Tracing._activities).length); | ||
if (options && typeof options.autoPopAfter === 'number') { | ||
logger.log("[Tracing] auto pop of: " + name + "#" + Tracing._currentIndex + " in " + options.autoPopAfter + "ms"); | ||
var index_1 = Tracing._currentIndex; | ||
setTimeout(function () { | ||
Tracing.popActivity(index_1, { | ||
autoPop: true, | ||
status: SpanStatus.DeadlineExceeded, | ||
}); | ||
}, options.autoPopAfter); | ||
} | ||
return Tracing._currentIndex++; | ||
@@ -227,2 +248,3 @@ }; | ||
if (activity) { | ||
logger.log("[Tracing] popActivity " + activity.name + "#" + id); | ||
var span_1 = activity.span; | ||
@@ -236,2 +258,5 @@ if (span_1) { | ||
} | ||
if (key === 'status') { | ||
span_1.setStatus(spanData[key]); | ||
} | ||
}); | ||
@@ -246,4 +271,6 @@ } | ||
clearTimeout(Tracing._debounce); | ||
logger.log('[Tracing] activies count', count); | ||
if (count === 0) { | ||
var timeout = Tracing.options && Tracing.options.idleTimeout; | ||
logger.log("[Tracing] Flushing Transaction in " + timeout + "ms"); | ||
Tracing._debounce = setTimeout(function () { | ||
@@ -250,0 +277,0 @@ Tracing.finishIdleTransaction(); |
@@ -54,2 +54,12 @@ import { Hub } from '@sentry/hub'; | ||
/** | ||
* Internal start time tracked with a monotonic clock. | ||
* | ||
* Works with mostly any browser version released since 2012. | ||
* https://caniuse.com/#search=performance.now | ||
* | ||
* Works with Node.js v8.5.0 or higher. | ||
* https://nodejs.org/api/perf_hooks.html#perf_hooks_performance_now | ||
*/ | ||
private readonly _startTimestampMonotonic; | ||
/** | ||
* Finish timestamp of the span. | ||
@@ -56,0 +66,0 @@ */ |
@@ -5,3 +5,14 @@ // tslint:disable:max-classes-per-file | ||
import { SpanStatus } from '@sentry/types'; | ||
import { dropUndefinedKeys, isInstanceOf, logger, timestampWithMs, uuid4 } from '@sentry/utils'; | ||
import { dropUndefinedKeys, dynamicRequire, getGlobalObject, isInstanceOf, isNodeEnv, logger, timestampWithMs, uuid4, } from '@sentry/utils'; | ||
var crossPlatformPerformance = (function () { | ||
if (isNodeEnv()) { | ||
var performance_1 = dynamicRequire(module, 'perf_hooks').performance; | ||
return performance_1; | ||
} | ||
return (getGlobalObject().performance || { | ||
now: function () { | ||
return Date.now(); | ||
}, | ||
}); | ||
})(); | ||
// TODO: Should this be exported? | ||
@@ -65,2 +76,12 @@ export var TRACEPARENT_REGEXP = new RegExp('^[ \\t]*' + // whitespace | ||
/** | ||
* Internal start time tracked with a monotonic clock. | ||
* | ||
* Works with mostly any browser version released since 2012. | ||
* https://caniuse.com/#search=performance.now | ||
* | ||
* Works with Node.js v8.5.0 or higher. | ||
* https://nodejs.org/api/perf_hooks.html#perf_hooks_performance_now | ||
*/ | ||
this._startTimestampMonotonic = crossPlatformPerformance.now(); | ||
/** | ||
* @inheritDoc | ||
@@ -196,3 +217,4 @@ */ | ||
} | ||
this.timestamp = timestampWithMs(); | ||
var durationSeconds = (crossPlatformPerformance.now() - this._startTimestampMonotonic) / 1000; | ||
this.timestamp = this.startTimestamp + durationSeconds; | ||
if (this.spanRecorder === undefined) { | ||
@@ -199,0 +221,0 @@ return undefined; |
{ | ||
"name": "@sentry/apm", | ||
"version": "5.12.5", | ||
"version": "5.13.0", | ||
"description": "Extensions for APM", | ||
@@ -19,7 +19,7 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/browser": "5.12.5", | ||
"@sentry/hub": "5.12.5", | ||
"@sentry/minimal": "5.12.5", | ||
"@sentry/browser": "5.13.0", | ||
"@sentry/hub": "5.13.0", | ||
"@sentry/minimal": "5.13.0", | ||
"@sentry/types": "5.12.4", | ||
"@sentry/utils": "5.12.5", | ||
"@sentry/utils": "5.13.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
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
223357
2558
+ Added@sentry/browser@5.13.0(transitive)
+ Added@sentry/core@5.13.0(transitive)
+ Added@sentry/hub@5.13.0(transitive)
+ Added@sentry/minimal@5.13.0(transitive)
+ Added@sentry/utils@5.13.0(transitive)
- Removed@sentry/browser@5.12.5(transitive)
- Removed@sentry/core@5.12.5(transitive)
- Removed@sentry/hub@5.12.5(transitive)
- Removed@sentry/minimal@5.12.5(transitive)
- Removed@sentry/utils@5.12.5(transitive)
Updated@sentry/browser@5.13.0
Updated@sentry/hub@5.13.0
Updated@sentry/minimal@5.13.0
Updated@sentry/utils@5.13.0