@elastic/apm-rum-core
Advanced tools
Comparing version 5.18.0 to 5.19.0
import { Promise } from './polyfills'; | ||
import { NAVIGATION_TIMING_MARKS, COMPRESSED_NAV_TIMING_MARKS } from '../performance-monitoring/capture-navigation'; | ||
import { NAVIGATION_TIMING_MARKS, COMPRESSED_NAV_TIMING_MARKS } from '../performance-monitoring/navigation/marks'; | ||
import { isBeaconInspectionEnabled } from './utils'; | ||
@@ -4,0 +4,0 @@ |
@@ -53,6 +53,12 @@ import { Promise } from '../polyfills'; | ||
var request, url; | ||
var isURL = input instanceof URL; | ||
if (typeof input === 'string') { | ||
if (typeof input === 'string' || isURL) { | ||
request = new Request(input, init); | ||
url = input; | ||
if (isURL) { | ||
url = request.url; | ||
} else { | ||
url = input; | ||
} | ||
} else if (input) { | ||
@@ -59,0 +65,0 @@ request = input; |
@@ -367,2 +367,6 @@ import { Promise } from './polyfills'; | ||
export { extend, merge, isUndefined, noop, baseExtend, bytesToHex, isCORSSupported, isObject, isFunction, isPlatformSupported, isDtHeaderValid, parseDtHeaderValue, getServerTimingInfo, getDtHeaderValue, getTSHeaderValue, getCurrentScript, getElasticScript, getTimeOrigin, generateRandomId, getEarliestSpan, getLatestNonXHRSpan, getLatestXHRSpan, getDuration, getTime, now, rng, checkSameOrigin, scheduleMacroTask, scheduleMicroTask, setLabel, setRequestHeader, stripQueryStringFromUrl, find, removeInvalidChars, PERF, isPerfTimelineSupported, isBrowser, isPerfTypeSupported, isBeaconInspectionEnabled }; | ||
function isRedirectInfoAvailable(timing) { | ||
return timing.redirectStart > 0; | ||
} | ||
export { extend, merge, isUndefined, noop, baseExtend, bytesToHex, isCORSSupported, isObject, isFunction, isPlatformSupported, isDtHeaderValid, parseDtHeaderValue, getServerTimingInfo, getDtHeaderValue, getTSHeaderValue, getCurrentScript, getElasticScript, getTimeOrigin, generateRandomId, getEarliestSpan, getLatestNonXHRSpan, getLatestXHRSpan, getDuration, getTime, now, rng, checkSameOrigin, scheduleMacroTask, scheduleMicroTask, setLabel, setRequestHeader, stripQueryStringFromUrl, find, removeInvalidChars, PERF, isPerfTimelineSupported, isBrowser, isPerfTypeSupported, isBeaconInspectionEnabled, isRedirectInfoAvailable }; |
import { LONG_TASK, LARGEST_CONTENTFUL_PAINT, FIRST_CONTENTFUL_PAINT, FIRST_INPUT, LAYOUT_SHIFT } from '../common/constants'; | ||
import { noop, PERF, isPerfTypeSupported } from '../common/utils'; | ||
import { noop, PERF, isPerfTypeSupported, isRedirectInfoAvailable } from '../common/utils'; | ||
import Span from './span'; | ||
@@ -158,2 +158,7 @@ export var metrics = { | ||
var unloadDiff = timing.fetchStart - timing.navigationStart; | ||
if (isRedirectInfoAvailable(timing)) { | ||
unloadDiff = 0; | ||
} | ||
var fcpEntry = list.getEntriesByName(FIRST_CONTENTFUL_PAINT)[0]; | ||
@@ -160,0 +165,0 @@ |
@@ -5,3 +5,3 @@ import { Promise } from '../common/polyfills'; | ||
import { extend, getEarliestSpan, getLatestNonXHRSpan, getLatestXHRSpan, isPerfTypeSupported, generateRandomId } from '../common/utils'; | ||
import { captureNavigation } from './capture-navigation'; | ||
import { captureNavigation } from './navigation/capture-navigation'; | ||
import { PAGE_LOAD, NAME_UNKNOWN, TRANSACTION_START, TRANSACTION_END, TEMPORARY_TYPE, TRANSACTION_TYPE_ORDER, LARGEST_CONTENTFUL_PAINT, LONG_TASK, PAINT, TRUNCATED_TYPE, FIRST_INPUT, LAYOUT_SHIFT, SESSION_TIMEOUT, PAGE_LOAD_DELAY } from '../common/constants'; | ||
@@ -8,0 +8,0 @@ import { addTransactionContext } from '../common/context'; |
@@ -12,3 +12,3 @@ "use strict"; | ||
var _captureNavigation = require("../performance-monitoring/capture-navigation"); | ||
var _marks = require("../performance-monitoring/navigation/marks"); | ||
@@ -136,4 +136,4 @@ var _utils = require("./utils"); | ||
_captureNavigation.COMPRESSED_NAV_TIMING_MARKS.forEach(function (mark, index) { | ||
var mapping = _captureNavigation.NAVIGATION_TIMING_MARKS[index]; | ||
_marks.COMPRESSED_NAV_TIMING_MARKS.forEach(function (mark, index) { | ||
var mapping = _marks.NAVIGATION_TIMING_MARKS[index]; | ||
compressed[mark] = ntMarks[mapping]; | ||
@@ -140,0 +140,0 @@ }); |
@@ -63,6 +63,12 @@ "use strict"; | ||
var request, url; | ||
var isURL = input instanceof URL; | ||
if (typeof input === 'string') { | ||
if (typeof input === 'string' || isURL) { | ||
request = new Request(input, init); | ||
url = input; | ||
if (isURL) { | ||
url = request.url; | ||
} else { | ||
url = input; | ||
} | ||
} else if (input) { | ||
@@ -69,0 +75,0 @@ request = input; |
@@ -41,2 +41,3 @@ "use strict"; | ||
exports.isBeaconInspectionEnabled = isBeaconInspectionEnabled; | ||
exports.isRedirectInfoAvailable = isRedirectInfoAvailable; | ||
exports.isBrowser = exports.PERF = void 0; | ||
@@ -411,2 +412,6 @@ | ||
return false; | ||
} | ||
function isRedirectInfoAvailable(timing) { | ||
return timing.redirectStart > 0; | ||
} |
@@ -181,2 +181,7 @@ "use strict"; | ||
var unloadDiff = timing.fetchStart - timing.navigationStart; | ||
if ((0, _utils.isRedirectInfoAvailable)(timing)) { | ||
unloadDiff = 0; | ||
} | ||
var fcpEntry = list.getEntriesByName(_constants.FIRST_CONTENTFUL_PAINT)[0]; | ||
@@ -183,0 +188,0 @@ |
@@ -14,3 +14,3 @@ "use strict"; | ||
var _captureNavigation = require("./capture-navigation"); | ||
var _captureNavigation = require("./navigation/capture-navigation"); | ||
@@ -17,0 +17,0 @@ var _constants = require("../common/constants"); |
{ | ||
"name": "@elastic/apm-rum-core", | ||
"version": "5.18.0", | ||
"version": "5.19.0", | ||
"description": "Elastic apm core", | ||
@@ -46,3 +46,3 @@ "license": "MIT", | ||
], | ||
"gitHead": "6ddf95eec49495904d19ebeaae1fbe18eb6c0a74" | ||
"gitHead": "05d6195c449afb3676ed80d98c03cdeda4e03ec7" | ||
} |
@@ -30,3 +30,3 @@ /** | ||
COMPRESSED_NAV_TIMING_MARKS | ||
} from '../performance-monitoring/capture-navigation' | ||
} from '../performance-monitoring/navigation/marks' | ||
import { isBeaconInspectionEnabled } from './utils' | ||
@@ -33,0 +33,0 @@ |
@@ -77,5 +77,14 @@ /** | ||
var request, url | ||
if (typeof input === 'string') { | ||
var isURL = input instanceof URL | ||
if (typeof input === 'string' || isURL) { | ||
request = new Request(input, init) | ||
url = input | ||
if (isURL) { | ||
url = request.url | ||
} else { | ||
// when the input is a string, the url value should be copied from it, rather than from request.url | ||
// this is important, there are existing users using relative urls when using fetch, which generates a span.name like 'GET /path-example' | ||
// switching to request.url like we do now with the introduction of URL objects support would start changing existing spans | ||
// the name would start being something like 'GET http://the-url-of-the-web-page.tld/path-example' which would cause unexpected results in the Kibana side | ||
url = input | ||
} | ||
} else if (input) { | ||
@@ -82,0 +91,0 @@ request = input |
@@ -434,2 +434,7 @@ /** | ||
// redirect info is only available for same-origin redirects | ||
function isRedirectInfoAvailable(timing) { | ||
return timing.redirectStart > 0 | ||
} | ||
export { | ||
@@ -474,3 +479,4 @@ extend, | ||
isPerfTypeSupported, | ||
isBeaconInspectionEnabled | ||
isBeaconInspectionEnabled, | ||
isRedirectInfoAvailable | ||
} |
@@ -33,3 +33,8 @@ /** | ||
} from '../common/constants' | ||
import { noop, PERF, isPerfTypeSupported } from '../common/utils' | ||
import { | ||
noop, | ||
PERF, | ||
isPerfTypeSupported, | ||
isRedirectInfoAvailable | ||
} from '../common/utils' | ||
import Span from './span' | ||
@@ -266,6 +271,13 @@ | ||
/** | ||
* | ||
* To avoid capturing the unload event handler effect | ||
* as part of the page-load transaction duration | ||
*/ | ||
const unloadDiff = timing.fetchStart - timing.navigationStart | ||
let unloadDiff = timing.fetchStart - timing.navigationStart | ||
if (isRedirectInfoAvailable(timing)) { | ||
// this makes sure the FCP startTime includes the redirect time | ||
// otherwise the mark would not show up properly in the UI waterfall | ||
unloadDiff = 0 | ||
} | ||
const fcpEntry = list.getEntriesByName(FIRST_CONTENTFUL_PAINT)[0] | ||
@@ -272,0 +284,0 @@ if (fcpEntry) { |
@@ -42,3 +42,3 @@ /** | ||
} from '../common/utils' | ||
import { captureNavigation } from './capture-navigation' | ||
import { captureNavigation } from './navigation/capture-navigation' | ||
import { | ||
@@ -45,0 +45,0 @@ PAGE_LOAD, |
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
508332
156
15227