@newrelic/browser-agent 1.292.1 → 1.293.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/wrap/wrap-function.js +19 -4
- package/dist/cjs/features/ajax/instrument/distributed-tracing.js +1 -1
- package/dist/cjs/features/page_view_event/aggregate/index.js +8 -0
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/wrap/wrap-function.js +19 -4
- package/dist/esm/features/ajax/instrument/distributed-tracing.js +1 -1
- package/dist/esm/features/page_view_event/aggregate/index.js +8 -0
- package/dist/types/common/wrap/wrap-function.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/wrap/wrap-function.js +19 -4
- package/src/features/ajax/instrument/distributed-tracing.js +1 -1
- package/src/features/page_view_event/aggregate/index.js +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.293.0](https://github.com/newrelic/newrelic-browser-agent/compare/v1.292.1...v1.293.0) (2025-07-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Add "long tasks" internal message ([#1506](https://github.com/newrelic/newrelic-browser-agent/issues/1506)) ([c1d0a56](https://github.com/newrelic/newrelic-browser-agent/commit/c1d0a564e645dcc02b747cd0b9035084b665747f))
|
|
12
|
+
* Emit SM on rum response invalid timestamps ([#1518](https://github.com/newrelic/newrelic-browser-agent/issues/1518)) ([8413c59](https://github.com/newrelic/newrelic-browser-agent/commit/8413c59fedc2d1505056787dd0ac9149ca46991d))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* Address issue keeping distributed traces from being disabled ([#1520](https://github.com/newrelic/newrelic-browser-agent/issues/1520)) ([f473350](https://github.com/newrelic/newrelic-browser-agent/commit/f4733508dc9911dff890f0f535f5eef0c2641fd1))
|
|
18
|
+
|
|
6
19
|
## [1.292.1](https://github.com/newrelic/newrelic-browser-agent/compare/v1.292.0...v1.292.1) (2025-06-26)
|
|
7
20
|
|
|
8
21
|
|
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.
|
|
20
|
+
const VERSION = exports.VERSION = "1.293.0";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.
|
|
20
|
+
const VERSION = exports.VERSION = "1.293.0";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -78,6 +78,7 @@ function createWrapperWithEmitter(emitter, always) {
|
|
|
78
78
|
var originalThis;
|
|
79
79
|
var ctx;
|
|
80
80
|
var result;
|
|
81
|
+
let thrownError;
|
|
81
82
|
try {
|
|
82
83
|
originalThis = this;
|
|
83
84
|
args = [...arguments];
|
|
@@ -92,17 +93,31 @@ function createWrapperWithEmitter(emitter, always) {
|
|
|
92
93
|
|
|
93
94
|
// Warning: start events may mutate args!
|
|
94
95
|
safeEmit(prefix + 'start', [args, originalThis, methodName], ctx, bubble);
|
|
96
|
+
const fnStartTime = performance.now();
|
|
97
|
+
let fnEndTime = fnStartTime;
|
|
95
98
|
try {
|
|
96
99
|
result = fn.apply(originalThis, args);
|
|
100
|
+
fnEndTime = performance.now();
|
|
97
101
|
return result;
|
|
98
102
|
} catch (err) {
|
|
103
|
+
fnEndTime = performance.now();
|
|
99
104
|
safeEmit(prefix + 'err', [args, originalThis, err], ctx, bubble);
|
|
100
|
-
|
|
101
105
|
// rethrow error so we don't effect execution by observing.
|
|
102
|
-
|
|
106
|
+
thrownError = err;
|
|
107
|
+
throw thrownError;
|
|
103
108
|
} finally {
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
const duration = fnEndTime - fnStartTime;
|
|
110
|
+
const task = {
|
|
111
|
+
duration,
|
|
112
|
+
isLongTask: duration >= 50,
|
|
113
|
+
methodName,
|
|
114
|
+
thrownError
|
|
115
|
+
// could add more properties here later if needed by downstream features
|
|
116
|
+
};
|
|
117
|
+
// standalone long task message
|
|
118
|
+
if (task.isLongTask) safeEmit('long-task', [task], ctx, bubble);
|
|
119
|
+
// -end message also includes the task execution info
|
|
120
|
+
safeEmit(prefix + 'end', [args, originalThis, result, task], ctx, bubble);
|
|
106
121
|
}
|
|
107
122
|
}
|
|
108
123
|
}
|
|
@@ -81,7 +81,7 @@ class DT {
|
|
|
81
81
|
// return true if DT is enabled and the origin is allowed, either by being
|
|
82
82
|
// same-origin, or included in the allowed list
|
|
83
83
|
shouldGenerateTrace(parsedOrigin) {
|
|
84
|
-
return this.agentRef.init?.distributed_tracing && this.isAllowedOrigin(parsedOrigin);
|
|
84
|
+
return this.agentRef.init?.distributed_tracing?.enabled && this.isAllowedOrigin(parsedOrigin);
|
|
85
85
|
}
|
|
86
86
|
isAllowedOrigin(parsedOrigin) {
|
|
87
87
|
var allowed = false;
|
|
@@ -167,9 +167,17 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
167
167
|
return;
|
|
168
168
|
}
|
|
169
169
|
try {
|
|
170
|
+
const wasReady = this.agentRef.runtime.timeKeeper.ready;
|
|
171
|
+
|
|
170
172
|
// will do nothing if already done
|
|
171
173
|
this.agentRef.runtime.timeKeeper.processRumRequest(xhr, this.rumStartTime, rumEndTime, app.nrServerTime);
|
|
172
174
|
if (!this.agentRef.runtime.timeKeeper.ready) throw new Error('TimeKeeper not ready');
|
|
175
|
+
|
|
176
|
+
// If timeKeeper's origin time is ahead of nrServerTime, then the timestamp is invalid. Report a supportability metric.
|
|
177
|
+
const timeDiff = this.agentRef.runtime.timeKeeper.correctedOriginTime - app.nrServerTime;
|
|
178
|
+
if (wasReady && timeDiff > 0) {
|
|
179
|
+
this.reportSupportabilityMetric('Generic/TimeKeeper/InvalidTimestamp/Seen', timeDiff);
|
|
180
|
+
}
|
|
173
181
|
} catch (error) {
|
|
174
182
|
this.ee.abort();
|
|
175
183
|
(0, _console.warn)(17, error);
|
|
@@ -71,6 +71,7 @@ export function createWrapperWithEmitter(emitter, always) {
|
|
|
71
71
|
var originalThis;
|
|
72
72
|
var ctx;
|
|
73
73
|
var result;
|
|
74
|
+
let thrownError;
|
|
74
75
|
try {
|
|
75
76
|
originalThis = this;
|
|
76
77
|
args = [...arguments];
|
|
@@ -85,17 +86,31 @@ export function createWrapperWithEmitter(emitter, always) {
|
|
|
85
86
|
|
|
86
87
|
// Warning: start events may mutate args!
|
|
87
88
|
safeEmit(prefix + 'start', [args, originalThis, methodName], ctx, bubble);
|
|
89
|
+
const fnStartTime = performance.now();
|
|
90
|
+
let fnEndTime = fnStartTime;
|
|
88
91
|
try {
|
|
89
92
|
result = fn.apply(originalThis, args);
|
|
93
|
+
fnEndTime = performance.now();
|
|
90
94
|
return result;
|
|
91
95
|
} catch (err) {
|
|
96
|
+
fnEndTime = performance.now();
|
|
92
97
|
safeEmit(prefix + 'err', [args, originalThis, err], ctx, bubble);
|
|
93
|
-
|
|
94
98
|
// rethrow error so we don't effect execution by observing.
|
|
95
|
-
|
|
99
|
+
thrownError = err;
|
|
100
|
+
throw thrownError;
|
|
96
101
|
} finally {
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
const duration = fnEndTime - fnStartTime;
|
|
103
|
+
const task = {
|
|
104
|
+
duration,
|
|
105
|
+
isLongTask: duration >= 50,
|
|
106
|
+
methodName,
|
|
107
|
+
thrownError
|
|
108
|
+
// could add more properties here later if needed by downstream features
|
|
109
|
+
};
|
|
110
|
+
// standalone long task message
|
|
111
|
+
if (task.isLongTask) safeEmit('long-task', [task], ctx, bubble);
|
|
112
|
+
// -end message also includes the task execution info
|
|
113
|
+
safeEmit(prefix + 'end', [args, originalThis, result, task], ctx, bubble);
|
|
99
114
|
}
|
|
100
115
|
}
|
|
101
116
|
}
|
|
@@ -74,7 +74,7 @@ export class DT {
|
|
|
74
74
|
// return true if DT is enabled and the origin is allowed, either by being
|
|
75
75
|
// same-origin, or included in the allowed list
|
|
76
76
|
shouldGenerateTrace(parsedOrigin) {
|
|
77
|
-
return this.agentRef.init?.distributed_tracing && this.isAllowedOrigin(parsedOrigin);
|
|
77
|
+
return this.agentRef.init?.distributed_tracing?.enabled && this.isAllowedOrigin(parsedOrigin);
|
|
78
78
|
}
|
|
79
79
|
isAllowedOrigin(parsedOrigin) {
|
|
80
80
|
var allowed = false;
|
|
@@ -158,9 +158,17 @@ export class Aggregate extends AggregateBase {
|
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
160
|
try {
|
|
161
|
+
const wasReady = this.agentRef.runtime.timeKeeper.ready;
|
|
162
|
+
|
|
161
163
|
// will do nothing if already done
|
|
162
164
|
this.agentRef.runtime.timeKeeper.processRumRequest(xhr, this.rumStartTime, rumEndTime, app.nrServerTime);
|
|
163
165
|
if (!this.agentRef.runtime.timeKeeper.ready) throw new Error('TimeKeeper not ready');
|
|
166
|
+
|
|
167
|
+
// If timeKeeper's origin time is ahead of nrServerTime, then the timestamp is invalid. Report a supportability metric.
|
|
168
|
+
const timeDiff = this.agentRef.runtime.timeKeeper.correctedOriginTime - app.nrServerTime;
|
|
169
|
+
if (wasReady && timeDiff > 0) {
|
|
170
|
+
this.reportSupportabilityMetric('Generic/TimeKeeper/InvalidTimestamp/Seen', timeDiff);
|
|
171
|
+
}
|
|
164
172
|
} catch (error) {
|
|
165
173
|
this.ee.abort();
|
|
166
174
|
warn(17, error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap-function.d.ts","sourceRoot":"","sources":["../../../../src/common/wrap/wrap-function.js"],"names":[],"mappings":"AA6BA;;;;;GAKG;AACH,mDAJW,MAAM,UACN,OAAO,
|
|
1
|
+
{"version":3,"file":"wrap-function.d.ts","sourceRoot":"","sources":["../../../../src/common/wrap/wrap-function.js"],"names":[],"mappings":"AA6BA;;;;;GAKG;AACH,mDAJW,MAAM,UACN,OAAO,YA+IjB;AAgBD;;;;;;;;GAQG;AACH,2BANW,MAAM,MACN,MAAM,YACN,MAAM,GAEJ,MAAM,CA2BlB;AArND,0BAA6C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_event/aggregate/index.js"],"names":[],"mappings":"AAsBA;IACE,2BAA2C;IAC3C,2BA8BC;IA3BC,wBAAwB;IACxB,8BAA8B;IAC9B,8BAA8B;IA2BhC;;;;;OAKG;IACH,2BAHW,GAAC,WACD,GAAC,QAsEX;IAVC,iCAAyB;IAY3B;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_event/aggregate/index.js"],"names":[],"mappings":"AAsBA;IACE,2BAA2C;IAC3C,2BA8BC;IA3BC,wBAAwB;IACxB,8BAA8B;IAC9B,8BAA8B;IA2BhC;;;;;OAKG;IACH,2BAHW,GAAC,WACD,GAAC,QAsEX;IAVC,iCAAyB;IAY3B;;;;;aA6CC;IAED,qDAaC;CACF;8BArL6B,4BAA4B"}
|
package/package.json
CHANGED
|
@@ -76,6 +76,7 @@ export function createWrapperWithEmitter (emitter, always) {
|
|
|
76
76
|
var originalThis
|
|
77
77
|
var ctx
|
|
78
78
|
var result
|
|
79
|
+
let thrownError
|
|
79
80
|
|
|
80
81
|
try {
|
|
81
82
|
originalThis = this
|
|
@@ -93,17 +94,31 @@ export function createWrapperWithEmitter (emitter, always) {
|
|
|
93
94
|
// Warning: start events may mutate args!
|
|
94
95
|
safeEmit(prefix + 'start', [args, originalThis, methodName], ctx, bubble)
|
|
95
96
|
|
|
97
|
+
const fnStartTime = performance.now()
|
|
98
|
+
let fnEndTime = fnStartTime
|
|
96
99
|
try {
|
|
97
100
|
result = fn.apply(originalThis, args)
|
|
101
|
+
fnEndTime = performance.now()
|
|
98
102
|
return result
|
|
99
103
|
} catch (err) {
|
|
104
|
+
fnEndTime = performance.now()
|
|
100
105
|
safeEmit(prefix + 'err', [args, originalThis, err], ctx, bubble)
|
|
101
|
-
|
|
102
106
|
// rethrow error so we don't effect execution by observing.
|
|
103
|
-
|
|
107
|
+
thrownError = err
|
|
108
|
+
throw thrownError
|
|
104
109
|
} finally {
|
|
105
|
-
|
|
106
|
-
|
|
110
|
+
const duration = fnEndTime - fnStartTime
|
|
111
|
+
const task = {
|
|
112
|
+
duration,
|
|
113
|
+
isLongTask: duration >= 50,
|
|
114
|
+
methodName,
|
|
115
|
+
thrownError
|
|
116
|
+
// could add more properties here later if needed by downstream features
|
|
117
|
+
}
|
|
118
|
+
// standalone long task message
|
|
119
|
+
if (task.isLongTask) safeEmit('long-task', [task], ctx, bubble)
|
|
120
|
+
// -end message also includes the task execution info
|
|
121
|
+
safeEmit(prefix + 'end', [args, originalThis, result, task], ctx, bubble)
|
|
107
122
|
}
|
|
108
123
|
}
|
|
109
124
|
}
|
|
@@ -94,7 +94,7 @@ export class DT {
|
|
|
94
94
|
// return true if DT is enabled and the origin is allowed, either by being
|
|
95
95
|
// same-origin, or included in the allowed list
|
|
96
96
|
shouldGenerateTrace (parsedOrigin) {
|
|
97
|
-
return this.agentRef.init?.distributed_tracing && this.isAllowedOrigin(parsedOrigin)
|
|
97
|
+
return this.agentRef.init?.distributed_tracing?.enabled && this.isAllowedOrigin(parsedOrigin)
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
isAllowedOrigin (parsedOrigin) {
|
|
@@ -152,9 +152,17 @@ export class Aggregate extends AggregateBase {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
try {
|
|
155
|
+
const wasReady = this.agentRef.runtime.timeKeeper.ready
|
|
156
|
+
|
|
155
157
|
// will do nothing if already done
|
|
156
158
|
this.agentRef.runtime.timeKeeper.processRumRequest(xhr, this.rumStartTime, rumEndTime, app.nrServerTime)
|
|
157
159
|
if (!this.agentRef.runtime.timeKeeper.ready) throw new Error('TimeKeeper not ready')
|
|
160
|
+
|
|
161
|
+
// If timeKeeper's origin time is ahead of nrServerTime, then the timestamp is invalid. Report a supportability metric.
|
|
162
|
+
const timeDiff = this.agentRef.runtime.timeKeeper.correctedOriginTime - app.nrServerTime
|
|
163
|
+
if (wasReady && timeDiff > 0) {
|
|
164
|
+
this.reportSupportabilityMetric('Generic/TimeKeeper/InvalidTimestamp/Seen', timeDiff)
|
|
165
|
+
}
|
|
158
166
|
} catch (error) {
|
|
159
167
|
this.ee.abort()
|
|
160
168
|
warn(17, error)
|