@sentry/tracing
Advanced tools
Comparing version 5.27.2 to 5.27.3
@@ -111,2 +111,28 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
if (transaction.op === 'pageload') { | ||
// normalize applicable web vital values to be relative to transaction.startTimestamp | ||
var timeOrigin_1 = utils_2.msToSec(performance.timeOrigin); | ||
['fcp', 'fp', 'lcp', 'ttfb'].forEach(function (name) { | ||
if (!_this._measurements[name] || timeOrigin_1 >= transaction.startTimestamp) { | ||
return; | ||
} | ||
// The web vitals, fcp, fp, lcp, and ttfb, all measure relative to timeOrigin. | ||
// Unfortunately, timeOrigin is not captured within the transaction span data, so these web vitals will need | ||
// to be adjusted to be relative to transaction.startTimestamp. | ||
var oldValue = _this._measurements[name].value; | ||
var measurementTimestamp = timeOrigin_1 + utils_2.msToSec(oldValue); | ||
// normalizedValue should be in milliseconds | ||
var normalizedValue = (measurementTimestamp - transaction.startTimestamp) * 1000; | ||
var delta = normalizedValue - oldValue; | ||
utils_1.logger.log("[Measurements] Normalized " + name + " from " + _this._measurements[name].value + " to " + normalizedValue + " (" + delta + ")"); | ||
_this._measurements[name].value = normalizedValue; | ||
}); | ||
if (this._measurements['mark.fid'] && this._measurements['fid']) { | ||
// create span for FID | ||
_startChild(transaction, { | ||
description: 'first input delay', | ||
endTimestamp: this._measurements['mark.fid'].value + utils_2.msToSec(this._measurements['fid'].value), | ||
op: 'web.vitals', | ||
startTimestamp: this._measurements['mark.fid'].value, | ||
}); | ||
} | ||
transaction.setMeasurements(this._measurements); | ||
@@ -215,2 +241,3 @@ } | ||
addPerformanceNavigationTiming(transaction, entry, 'secureConnection', timeOrigin, 'connectEnd'); | ||
addPerformanceNavigationTiming(transaction, entry, 'fetch', timeOrigin, 'domainLookupStart'); | ||
addPerformanceNavigationTiming(transaction, entry, 'domainLookup', timeOrigin); | ||
@@ -217,0 +244,0 @@ addRequest(transaction, entry, timeOrigin); |
@@ -17,3 +17,5 @@ /* | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var utils_1 = require("@sentry/utils"); | ||
var initMetric_1 = require("./lib/initMetric"); | ||
var global = utils_1.getGlobalObject(); | ||
var afterLoad = function (callback) { | ||
@@ -34,3 +36,3 @@ if (document.readyState === 'complete') { | ||
// eslint-disable-next-line deprecation/deprecation | ||
var timing = performance.timing; | ||
var timing = global.performance.timing; | ||
var navigationEntry = { | ||
@@ -52,3 +54,3 @@ entryType: 'navigation', | ||
// Use the NavigationTiming L2 entry if available. | ||
var navigationEntry = performance.getEntriesByType('navigation')[0] || getNavigationEntryFromPerformanceTiming(); | ||
var navigationEntry = global.performance.getEntriesByType('navigation')[0] || getNavigationEntryFromPerformanceTiming(); | ||
metric.value = metric.delta = navigationEntry.responseStart; | ||
@@ -55,0 +57,0 @@ metric.entries = [navigationEntry]; |
@@ -82,3 +82,4 @@ import { Span as SpanInterface, SpanContext, Transaction } from '@sentry/types'; | ||
/** | ||
* You should never call the constructor manually, always use `hub.startSpan()`. | ||
* You should never call the constructor manually, always use `Sentry.startTransaction()` | ||
* or call `startChild()` on an existing span. | ||
* @internal | ||
@@ -85,0 +86,0 @@ * @hideconstructor |
@@ -39,3 +39,4 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* You should never call the constructor manually, always use `hub.startSpan()`. | ||
* You should never call the constructor manually, always use `Sentry.startTransaction()` | ||
* or call `startChild()` on an existing span. | ||
* @internal | ||
@@ -42,0 +43,0 @@ * @hideconstructor |
@@ -110,2 +110,28 @@ import { __assign, __rest } from "tslib"; | ||
if (transaction.op === 'pageload') { | ||
// normalize applicable web vital values to be relative to transaction.startTimestamp | ||
var timeOrigin_1 = msToSec(performance.timeOrigin); | ||
['fcp', 'fp', 'lcp', 'ttfb'].forEach(function (name) { | ||
if (!_this._measurements[name] || timeOrigin_1 >= transaction.startTimestamp) { | ||
return; | ||
} | ||
// The web vitals, fcp, fp, lcp, and ttfb, all measure relative to timeOrigin. | ||
// Unfortunately, timeOrigin is not captured within the transaction span data, so these web vitals will need | ||
// to be adjusted to be relative to transaction.startTimestamp. | ||
var oldValue = _this._measurements[name].value; | ||
var measurementTimestamp = timeOrigin_1 + msToSec(oldValue); | ||
// normalizedValue should be in milliseconds | ||
var normalizedValue = (measurementTimestamp - transaction.startTimestamp) * 1000; | ||
var delta = normalizedValue - oldValue; | ||
logger.log("[Measurements] Normalized " + name + " from " + _this._measurements[name].value + " to " + normalizedValue + " (" + delta + ")"); | ||
_this._measurements[name].value = normalizedValue; | ||
}); | ||
if (this._measurements['mark.fid'] && this._measurements['fid']) { | ||
// create span for FID | ||
_startChild(transaction, { | ||
description: 'first input delay', | ||
endTimestamp: this._measurements['mark.fid'].value + msToSec(this._measurements['fid'].value), | ||
op: 'web.vitals', | ||
startTimestamp: this._measurements['mark.fid'].value, | ||
}); | ||
} | ||
transaction.setMeasurements(this._measurements); | ||
@@ -214,2 +240,3 @@ } | ||
addPerformanceNavigationTiming(transaction, entry, 'secureConnection', timeOrigin, 'connectEnd'); | ||
addPerformanceNavigationTiming(transaction, entry, 'fetch', timeOrigin, 'domainLookupStart'); | ||
addPerformanceNavigationTiming(transaction, entry, 'domainLookup', timeOrigin); | ||
@@ -216,0 +243,0 @@ addRequest(transaction, entry, timeOrigin); |
@@ -16,3 +16,5 @@ /* | ||
*/ | ||
import { getGlobalObject } from '@sentry/utils'; | ||
import { initMetric } from './lib/initMetric'; | ||
var global = getGlobalObject(); | ||
var afterLoad = function (callback) { | ||
@@ -33,3 +35,3 @@ if (document.readyState === 'complete') { | ||
// eslint-disable-next-line deprecation/deprecation | ||
var timing = performance.timing; | ||
var timing = global.performance.timing; | ||
var navigationEntry = { | ||
@@ -51,3 +53,3 @@ entryType: 'navigation', | ||
// Use the NavigationTiming L2 entry if available. | ||
var navigationEntry = performance.getEntriesByType('navigation')[0] || getNavigationEntryFromPerformanceTiming(); | ||
var navigationEntry = global.performance.getEntriesByType('navigation')[0] || getNavigationEntryFromPerformanceTiming(); | ||
metric.value = metric.delta = navigationEntry.responseStart; | ||
@@ -54,0 +56,0 @@ metric.entries = [navigationEntry]; |
@@ -82,3 +82,4 @@ import { Span as SpanInterface, SpanContext, Transaction } from '@sentry/types'; | ||
/** | ||
* You should never call the constructor manually, always use `hub.startSpan()`. | ||
* You should never call the constructor manually, always use `Sentry.startTransaction()` | ||
* or call `startChild()` on an existing span. | ||
* @internal | ||
@@ -85,0 +86,0 @@ * @hideconstructor |
@@ -38,3 +38,4 @@ import { __assign } from "tslib"; | ||
/** | ||
* You should never call the constructor manually, always use `hub.startSpan()`. | ||
* You should never call the constructor manually, always use `Sentry.startTransaction()` | ||
* or call `startChild()` on an existing span. | ||
* @internal | ||
@@ -41,0 +42,0 @@ * @hideconstructor |
{ | ||
"name": "@sentry/tracing", | ||
"version": "5.27.2", | ||
"version": "5.27.3", | ||
"description": "Extensions for Sentry AM", | ||
@@ -19,11 +19,11 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/hub": "5.27.2", | ||
"@sentry/minimal": "5.27.2", | ||
"@sentry/types": "5.27.2", | ||
"@sentry/utils": "5.27.2", | ||
"@sentry/hub": "5.27.3", | ||
"@sentry/minimal": "5.27.3", | ||
"@sentry/types": "5.27.3", | ||
"@sentry/utils": "5.27.3", | ||
"tslib": "^1.9.3" | ||
}, | ||
"devDependencies": { | ||
"@sentry-internal/eslint-config-sdk": "5.27.2", | ||
"@sentry/browser": "5.27.2", | ||
"@sentry-internal/eslint-config-sdk": "5.27.3", | ||
"@sentry/browser": "5.27.3", | ||
"@types/express": "^4.17.1", | ||
@@ -30,0 +30,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
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
2022925
14827
+ Added@sentry/hub@5.27.3(transitive)
+ Added@sentry/minimal@5.27.3(transitive)
+ Added@sentry/types@5.27.3(transitive)
+ Added@sentry/utils@5.27.3(transitive)
- Removed@sentry/hub@5.27.2(transitive)
- Removed@sentry/minimal@5.27.2(transitive)
- Removed@sentry/types@5.27.2(transitive)
- Removed@sentry/utils@5.27.2(transitive)
Updated@sentry/hub@5.27.3
Updated@sentry/minimal@5.27.3
Updated@sentry/types@5.27.3
Updated@sentry/utils@5.27.3