@newrelic/browser-agent 0.1.231 → 1.232.1
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/README.md +2 -2
- package/dist/cjs/common/config/state/configurable.js +27 -21
- package/dist/cjs/common/config/state/init.js +8 -0
- package/dist/cjs/common/config/state/runtime.js +24 -26
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/context/shared-context.js +2 -1
- package/dist/cjs/common/event-emitter/contextual-ee.test.js +2 -2
- package/dist/cjs/common/event-emitter/register-handler.test.js +1 -1
- package/dist/cjs/common/event-listener/event-listener-opts.js +4 -2
- package/dist/cjs/common/harvest/harvest-scheduler.js +14 -11
- package/dist/cjs/common/harvest/harvest.js +3 -1
- package/dist/cjs/common/session/constants.js +12 -0
- package/dist/cjs/common/session/session-entity.js +278 -0
- package/dist/cjs/common/session/session-entity.test.js +436 -0
- package/dist/cjs/common/storage/first-party-cookies.js +35 -0
- package/dist/cjs/common/storage/local-memory.js +35 -0
- package/dist/cjs/common/storage/local-memory.test.js +20 -0
- package/dist/cjs/common/storage/local-storage.js +33 -0
- package/dist/cjs/common/storage/local-storage.test.js +14 -0
- package/dist/cjs/common/timer/interaction-timer.js +78 -0
- package/dist/cjs/common/timer/interaction-timer.test.js +216 -0
- package/dist/cjs/common/timer/timer.js +32 -0
- package/dist/cjs/common/timer/timer.test.js +105 -0
- package/dist/cjs/common/unload/eol.js +2 -2
- package/dist/cjs/common/url/canonicalize-url.js +32 -0
- package/dist/cjs/common/url/canonicalize-url.test.js +42 -0
- package/dist/cjs/common/url/clean-url.js +10 -3
- package/dist/cjs/common/util/data-size.js +6 -0
- package/dist/cjs/common/util/data-size.test.js +47 -0
- package/dist/cjs/common/util/global-scope.js +4 -2
- package/dist/cjs/common/util/invoke.js +73 -0
- package/dist/cjs/common/util/invoke.test.js +49 -0
- package/dist/cjs/common/util/obfuscate.js +0 -4
- package/dist/cjs/common/window/page-visibility.js +3 -1
- package/dist/cjs/common/wrap/wrap-fetch.js +1 -3
- package/dist/cjs/common/wrap/wrap-function.js +1 -3
- package/dist/cjs/common/wrap/wrap-timer.js +1 -1
- package/dist/cjs/features/ajax/aggregate/index.js +2 -2
- package/dist/cjs/features/ajax/instrument/index.js +1 -1
- package/dist/cjs/features/jserrors/aggregate/canonical-function-name.js +12 -4
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.js +93 -10
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.test.js +164 -38
- package/dist/cjs/features/jserrors/aggregate/index.js +25 -46
- package/dist/cjs/features/jserrors/instrument/index.js +0 -2
- package/dist/cjs/features/metrics/aggregate/index.js +13 -2
- package/dist/cjs/features/page_action/aggregate/index.js +2 -2
- package/dist/cjs/features/page_view_event/aggregate/index.js +6 -3
- package/dist/cjs/features/page_view_timing/aggregate/index.js +6 -6
- package/dist/cjs/features/session_trace/aggregate/index.js +3 -5
- package/dist/cjs/features/spa/aggregate/index.js +6 -5
- package/dist/cjs/features/utils/agent-session.js +73 -0
- package/dist/cjs/features/utils/feature-base.js +1 -1
- package/dist/cjs/features/utils/instrument-base.js +7 -2
- package/dist/cjs/features/utils/lazy-loader.js +1 -1
- package/dist/cjs/loaders/agent.js +1 -1
- package/dist/cjs/loaders/api/api.js +1 -4
- package/dist/cjs/loaders/api/apiAsync.js +3 -2
- package/dist/cjs/loaders/configure/configure.js +0 -6
- package/dist/esm/common/config/state/configurable.js +26 -20
- package/dist/esm/common/config/state/init.js +8 -0
- package/dist/esm/common/config/state/runtime.js +24 -26
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/context/shared-context.js +2 -1
- package/dist/esm/common/event-emitter/contextual-ee.test.js +2 -2
- package/dist/esm/common/event-emitter/register-handler.test.js +1 -1
- package/dist/esm/common/event-listener/event-listener-opts.js +4 -2
- package/dist/esm/common/harvest/harvest-scheduler.js +14 -11
- package/dist/esm/common/harvest/harvest.js +3 -1
- package/dist/esm/common/session/constants.js +3 -0
- package/dist/esm/common/session/session-entity.js +271 -0
- package/dist/esm/common/session/session-entity.test.js +434 -0
- package/dist/esm/common/storage/first-party-cookies.js +28 -0
- package/dist/esm/common/storage/local-memory.js +28 -0
- package/dist/esm/common/storage/local-memory.test.js +18 -0
- package/dist/esm/common/storage/local-storage.js +26 -0
- package/dist/esm/common/storage/local-storage.test.js +12 -0
- package/dist/esm/common/timer/interaction-timer.js +71 -0
- package/dist/esm/common/timer/interaction-timer.test.js +214 -0
- package/dist/esm/common/timer/timer.js +25 -0
- package/dist/esm/common/timer/timer.test.js +103 -0
- package/dist/esm/common/unload/eol.js +1 -1
- package/dist/esm/common/url/canonicalize-url.js +27 -0
- package/dist/esm/common/url/canonicalize-url.test.js +38 -0
- package/dist/esm/common/url/clean-url.js +10 -3
- package/dist/esm/common/util/data-size.js +7 -0
- package/dist/esm/common/util/data-size.test.js +45 -0
- package/dist/esm/common/util/global-scope.js +1 -0
- package/dist/esm/common/util/invoke.js +66 -0
- package/dist/esm/common/util/invoke.test.js +47 -0
- package/dist/esm/common/util/obfuscate.js +0 -4
- package/dist/esm/common/window/page-visibility.js +3 -1
- package/dist/esm/common/wrap/wrap-fetch.js +1 -2
- package/dist/esm/common/wrap/wrap-function.js +1 -2
- package/dist/esm/common/wrap/wrap-timer.js +1 -1
- package/dist/esm/features/ajax/aggregate/index.js +2 -2
- package/dist/esm/features/ajax/instrument/index.js +1 -1
- package/dist/esm/features/jserrors/aggregate/canonical-function-name.js +12 -4
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.js +93 -10
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.test.js +149 -25
- package/dist/esm/features/jserrors/aggregate/index.js +26 -46
- package/dist/esm/features/jserrors/instrument/index.js +0 -1
- package/dist/esm/features/metrics/aggregate/index.js +14 -3
- package/dist/esm/features/page_action/aggregate/index.js +2 -2
- package/dist/esm/features/page_view_event/aggregate/index.js +6 -3
- package/dist/esm/features/page_view_timing/aggregate/index.js +6 -6
- package/dist/esm/features/session_trace/aggregate/index.js +3 -4
- package/dist/esm/features/spa/aggregate/index.js +6 -5
- package/dist/esm/features/utils/agent-session.js +67 -0
- package/dist/esm/features/utils/feature-base.js +1 -1
- package/dist/esm/features/utils/instrument-base.js +7 -2
- package/dist/esm/features/utils/lazy-loader.js +1 -1
- package/dist/esm/loaders/agent.js +1 -1
- package/dist/esm/loaders/api/api.js +2 -5
- package/dist/esm/loaders/api/apiAsync.js +2 -1
- package/dist/esm/loaders/configure/configure.js +2 -8
- package/dist/types/common/config/state/configurable.d.ts.map +1 -1
- package/dist/types/common/config/state/init.d.ts.map +1 -1
- package/dist/types/common/config/state/runtime.d.ts.map +1 -1
- package/dist/types/common/context/shared-context.d.ts.map +1 -1
- package/dist/types/common/event-listener/event-listener-opts.d.ts +2 -2
- package/dist/types/common/event-listener/event-listener-opts.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest-scheduler.d.ts +1 -0
- package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest.d.ts.map +1 -1
- package/dist/types/common/session/constants.d.ts +4 -0
- package/dist/types/common/session/constants.d.ts.map +1 -0
- package/dist/types/common/session/session-entity.d.ts +72 -0
- package/dist/types/common/session/session-entity.d.ts.map +1 -0
- package/dist/types/common/storage/first-party-cookies.d.ts +8 -0
- package/dist/types/common/storage/first-party-cookies.d.ts.map +1 -0
- package/dist/types/common/storage/local-memory.d.ts +8 -0
- package/dist/types/common/storage/local-memory.d.ts.map +1 -0
- package/dist/types/common/storage/local-storage.d.ts +6 -0
- package/dist/types/common/storage/local-storage.d.ts.map +1 -0
- package/dist/types/common/timer/interaction-timer.d.ts +11 -0
- package/dist/types/common/timer/interaction-timer.d.ts.map +1 -0
- package/dist/types/common/timer/timer.d.ts +12 -0
- package/dist/types/common/timer/timer.d.ts.map +1 -0
- package/dist/types/common/url/canonicalize-url.d.ts +9 -0
- package/dist/types/common/url/canonicalize-url.d.ts.map +1 -0
- package/dist/types/common/url/clean-url.d.ts +7 -1
- package/dist/types/common/url/clean-url.d.ts.map +1 -1
- package/dist/types/common/util/data-size.d.ts +7 -1
- package/dist/types/common/util/data-size.d.ts.map +1 -1
- package/dist/types/common/util/global-scope.d.ts +1 -0
- package/dist/types/common/util/global-scope.d.ts.map +1 -1
- package/dist/types/common/util/invoke.d.ts +35 -0
- package/dist/types/common/util/invoke.d.ts.map +1 -0
- package/dist/types/common/util/obfuscate.d.ts.map +1 -1
- package/dist/types/common/window/page-visibility.d.ts +1 -1
- package/dist/types/common/window/page-visibility.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-fetch.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-function.d.ts.map +1 -1
- package/dist/types/features/ajax/aggregate/index.d.ts +2 -2
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts +8 -1
- package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts +48 -19
- package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts +14 -5
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/instrument/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/index.d.ts +2 -2
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_action/aggregate/index.d.ts +3 -3
- package/dist/types/features/page_action/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/index.d.ts +2 -2
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_timing/aggregate/index.d.ts +2 -2
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_trace/aggregate/index.d.ts +2 -2
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/index.d.ts +2 -2
- package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/utils/agent-session.d.ts +2 -0
- package/dist/types/features/utils/agent-session.d.ts.map +1 -0
- package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
- package/dist/types/features/utils/lazy-loader.d.ts +2 -2
- package/dist/types/features/utils/lazy-loader.d.ts.map +1 -1
- package/dist/types/loaders/api/api.d.ts.map +1 -1
- package/dist/types/loaders/api/apiAsync.d.ts.map +1 -1
- package/dist/types/loaders/configure/configure.d.ts.map +1 -1
- package/package.json +9 -8
- package/src/common/config/state/configurable.js +26 -19
- package/src/common/config/state/init.js +7 -0
- package/src/common/config/state/runtime.js +22 -27
- package/src/common/context/shared-context.js +2 -1
- package/src/common/event-emitter/contextual-ee.test.js +2 -2
- package/src/common/event-emitter/register-handler.test.js +1 -1
- package/src/common/event-listener/event-listener-opts.js +4 -4
- package/src/common/harvest/harvest-scheduler.js +12 -8
- package/src/common/harvest/harvest.js +3 -1
- package/src/common/session/constants.js +3 -0
- package/src/common/session/session-entity.js +271 -0
- package/src/common/session/session-entity.test.js +317 -0
- package/src/common/storage/first-party-cookies.js +31 -0
- package/src/common/storage/local-memory.js +30 -0
- package/src/common/storage/local-memory.test.js +19 -0
- package/src/common/storage/local-storage.js +28 -0
- package/src/common/storage/local-storage.test.js +17 -0
- package/src/common/timer/interaction-timer.js +75 -0
- package/src/common/timer/interaction-timer.test.js +167 -0
- package/src/common/timer/timer.js +31 -0
- package/src/common/timer/timer.test.js +100 -0
- package/src/common/unload/eol.js +1 -1
- package/src/common/url/canonicalize-url.js +28 -0
- package/src/common/url/canonicalize-url.test.js +34 -0
- package/src/common/url/clean-url.js +10 -3
- package/src/common/util/data-size.js +6 -0
- package/src/common/util/data-size.test.js +50 -0
- package/src/common/util/global-scope.js +2 -0
- package/src/common/util/invoke.js +55 -0
- package/src/common/util/invoke.test.js +65 -0
- package/src/common/util/obfuscate.js +0 -4
- package/src/common/window/page-visibility.js +2 -2
- package/src/common/wrap/wrap-fetch.js +1 -2
- package/src/common/wrap/wrap-function.js +1 -2
- package/src/common/wrap/wrap-timer.js +1 -1
- package/src/features/ajax/aggregate/index.js +2 -2
- package/src/features/ajax/instrument/index.js +1 -1
- package/src/features/jserrors/aggregate/canonical-function-name.js +12 -4
- package/src/features/jserrors/aggregate/compute-stack-trace.js +85 -11
- package/src/features/jserrors/aggregate/compute-stack-trace.test.js +141 -24
- package/src/features/jserrors/aggregate/index.js +24 -50
- package/src/features/jserrors/instrument/index.js +0 -1
- package/src/features/metrics/aggregate/index.js +18 -3
- package/src/features/page_action/aggregate/index.js +2 -2
- package/src/features/page_view_event/aggregate/index.js +6 -3
- package/src/features/page_view_timing/aggregate/index.js +6 -6
- package/src/features/session_trace/aggregate/index.js +3 -4
- package/src/features/spa/aggregate/index.js +5 -5
- package/src/features/utils/agent-session.js +68 -0
- package/src/features/utils/feature-base.js +1 -1
- package/src/features/utils/instrument-base.js +5 -2
- package/src/features/utils/lazy-loader.js +1 -1
- package/src/loaders/agent.js +1 -1
- package/src/loaders/api/api.js +2 -5
- package/src/loaders/api/apiAsync.js +2 -1
- package/src/loaders/configure/configure.js +2 -7
- package/dist/cjs/common/util/single.js +0 -23
- package/dist/cjs/common/window/session-storage.js +0 -87
- package/dist/cjs/features/utils/aggregate-base.js +0 -13
- package/dist/esm/common/util/single.js +0 -16
- package/dist/esm/common/window/session-storage.js +0 -77
- package/dist/esm/features/utils/aggregate-base.js +0 -6
- package/dist/types/common/util/single.d.ts +0 -2
- package/dist/types/common/util/single.d.ts.map +0 -1
- package/dist/types/common/window/session-storage.d.ts +0 -18
- package/dist/types/common/window/session-storage.d.ts.map +0 -1
- package/dist/types/features/utils/aggregate-base.d.ts +0 -4
- package/dist/types/features/utils/aggregate-base.d.ts.map +0 -1
- package/src/common/util/single.js +0 -18
- package/src/common/window/session-storage.js +0 -75
- package/src/features/utils/aggregate-base.js +0 -7
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { canonicalFunctionName } from './canonical-function-name';
|
|
7
|
-
import { cleanURL } from '../../../common/url/clean-url';
|
|
8
7
|
import { computeStackTrace } from './compute-stack-trace';
|
|
9
8
|
import { stringHashCode } from './string-hash-code';
|
|
10
9
|
import { truncateSize } from './format-stack-trace';
|
|
@@ -16,11 +15,16 @@ import { mapOwn } from '../../../common/util/map-own';
|
|
|
16
15
|
import { getInfo, getConfigurationValue, getRuntime } from '../../../common/config/config';
|
|
17
16
|
import { now } from '../../../common/timing/now';
|
|
18
17
|
import { globalScope } from '../../../common/util/global-scope';
|
|
19
|
-
import { AggregateBase } from '../../utils/aggregate-base';
|
|
20
18
|
import { FEATURE_NAME } from '../constants';
|
|
21
19
|
import { drain } from '../../../common/drain/drain';
|
|
22
20
|
import { FEATURE_NAMES } from '../../../loaders/features/features';
|
|
23
|
-
|
|
21
|
+
import { FeatureBase } from '../../utils/feature-base';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {import('./compute-stack-trace.js').StackInfo} StackInfo
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export class Aggregate extends FeatureBase {
|
|
24
28
|
static featureName = FEATURE_NAME;
|
|
25
29
|
constructor(agentIdentifier, aggregator) {
|
|
26
30
|
var _this;
|
|
@@ -103,49 +107,25 @@ export class Aggregate extends AggregateBase {
|
|
|
103
107
|
getBucketName(params, customParams) {
|
|
104
108
|
return this.nameHash(params) + ':' + stringHashCode(stringify(customParams));
|
|
105
109
|
}
|
|
106
|
-
canonicalizeURL(url, cleanedOrigin) {
|
|
107
|
-
if (typeof url !== 'string') return '';
|
|
108
|
-
var cleanedURL = cleanURL(url);
|
|
109
|
-
if (cleanedURL === cleanedOrigin) {
|
|
110
|
-
return '<inline>';
|
|
111
|
-
} else {
|
|
112
|
-
return cleanedURL;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
buildCanonicalStackString(stackInfo, cleanedOrigin) {
|
|
116
|
-
var canonicalStack = '';
|
|
117
|
-
for (var i = 0; i < stackInfo.frames.length; i++) {
|
|
118
|
-
var frame = stackInfo.frames[i];
|
|
119
|
-
var func = canonicalFunctionName(frame.func);
|
|
120
|
-
if (canonicalStack) canonicalStack += '\n';
|
|
121
|
-
if (func) canonicalStack += func + '@';
|
|
122
|
-
if (typeof frame.url === 'string') canonicalStack += frame.url;
|
|
123
|
-
if (frame.line) canonicalStack += ':' + frame.line;
|
|
124
|
-
}
|
|
125
|
-
return canonicalStack;
|
|
126
|
-
}
|
|
127
110
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
// for comparing with frame URLs.
|
|
138
|
-
var cleanedOrigin = cleanURL(getRuntime(this.agentIdentifier).origin);
|
|
111
|
+
/**
|
|
112
|
+
* Builds a standardized stack trace string from the frames in the given `stackInfo` object, with each frame separated
|
|
113
|
+
* by a newline character. Lines take the form `<functionName>@<url>:<lineNumber>`.
|
|
114
|
+
*
|
|
115
|
+
* @param {StackInfo} stackInfo - An object specifying a stack string and individual frames.
|
|
116
|
+
* @returns {string} A canonical stack string built from the URLs and function names in the given `stackInfo` object.
|
|
117
|
+
*/
|
|
118
|
+
buildCanonicalStackString(stackInfo) {
|
|
119
|
+
var canonicalStackString = '';
|
|
139
120
|
for (var i = 0; i < stackInfo.frames.length; i++) {
|
|
140
121
|
var frame = stackInfo.frames[i];
|
|
141
|
-
var
|
|
142
|
-
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
122
|
+
var func = canonicalFunctionName(frame.func);
|
|
123
|
+
if (canonicalStackString) canonicalStackString += '\n';
|
|
124
|
+
if (func) canonicalStackString += func + '@';
|
|
125
|
+
if (typeof frame.url === 'string') canonicalStackString += frame.url;
|
|
126
|
+
if (frame.line) canonicalStackString += ':' + frame.line;
|
|
147
127
|
}
|
|
148
|
-
return
|
|
128
|
+
return canonicalStackString;
|
|
149
129
|
}
|
|
150
130
|
storeError(err, time, internal, customAttributes) {
|
|
151
131
|
// are we in an interaction
|
|
@@ -162,10 +142,10 @@ export class Aggregate extends AggregateBase {
|
|
|
162
142
|
// Again as with previous usage, all falsey values would include the error.
|
|
163
143
|
}
|
|
164
144
|
|
|
165
|
-
var stackInfo =
|
|
166
|
-
var
|
|
145
|
+
var stackInfo = computeStackTrace(err);
|
|
146
|
+
var canonicalStackString = this.buildCanonicalStackString(stackInfo);
|
|
167
147
|
const params = {
|
|
168
|
-
stackHash: stringHashCode(
|
|
148
|
+
stackHash: stringHashCode(canonicalStackString),
|
|
169
149
|
exceptionClass: stackInfo.name,
|
|
170
150
|
request_uri: globalScope?.location.pathname
|
|
171
151
|
};
|
|
@@ -210,6 +190,7 @@ export class Aggregate extends AggregateBase {
|
|
|
210
190
|
|
|
211
191
|
// still send EE events for other features such as above, but stop this one from aggregating internal data
|
|
212
192
|
if (this.blocked) return;
|
|
193
|
+
var att = getInfo(this.agentIdentifier).jsAttributes;
|
|
213
194
|
if (params._interactionId != null) {
|
|
214
195
|
// hold on to the error until the interaction finishes
|
|
215
196
|
this.errorCache[params._interactionId] = this.errorCache[params._interactionId] || [];
|
|
@@ -217,7 +198,6 @@ export class Aggregate extends AggregateBase {
|
|
|
217
198
|
} else {
|
|
218
199
|
// store custom attributes
|
|
219
200
|
var customParams = {};
|
|
220
|
-
var att = getInfo(this.agentIdentifier).jsAttributes;
|
|
221
201
|
mapOwn(att, setCustom);
|
|
222
202
|
if (customAttributes) {
|
|
223
203
|
mapOwn(customAttributes, setCustom);
|
|
@@ -7,7 +7,6 @@ import { handle } from '../../../common/event-emitter/handle';
|
|
|
7
7
|
import { now } from '../../../common/timing/now';
|
|
8
8
|
import { getOrSet } from '../../../common/util/get-or-set';
|
|
9
9
|
import { wrapRaf, wrapTimer, wrapEvents, wrapXhr } from '../../../common/wrap';
|
|
10
|
-
import slice from 'lodash._slice';
|
|
11
10
|
import './debug';
|
|
12
11
|
import { InstrumentBase } from '../../utils/instrument-base';
|
|
13
12
|
import { FEATURE_NAME, NR_ERR_PROP } from '../constants';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { getRuntime } from '../../../common/config/config';
|
|
1
|
+
import { getRuntime, getInfo } from '../../../common/config/config';
|
|
2
2
|
import { registerHandler } from '../../../common/event-emitter/register-handler';
|
|
3
3
|
import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler';
|
|
4
|
-
import { AggregateBase } from '../../utils/aggregate-base';
|
|
5
4
|
import { FEATURE_NAME, SUPPORTABILITY_METRIC, CUSTOM_METRIC, SUPPORTABILITY_METRIC_CHANNEL, CUSTOM_METRIC_CHANNEL } from '../constants';
|
|
6
5
|
import { drain } from '../../../common/drain/drain';
|
|
7
6
|
import { getFrameworks } from '../../../common/metrics/framework-detection';
|
|
@@ -11,7 +10,9 @@ import { VERSION } from "../../../common/constants/env.npm";
|
|
|
11
10
|
import { onDOMContentLoaded } from '../../../common/window/load';
|
|
12
11
|
import { windowAddEventListener } from '../../../common/event-listener/event-listener-opts';
|
|
13
12
|
import { isBrowserScope } from '../../../common/util/global-scope';
|
|
14
|
-
|
|
13
|
+
import { FeatureBase } from '../../utils/feature-base';
|
|
14
|
+
import { stringify } from '../../../common/util/stringify';
|
|
15
|
+
export class Aggregate extends FeatureBase {
|
|
15
16
|
static featureName = FEATURE_NAME;
|
|
16
17
|
constructor(agentIdentifier, aggregator) {
|
|
17
18
|
super(agentIdentifier, aggregator, FEATURE_NAME);
|
|
@@ -103,6 +104,7 @@ export class Aggregate extends AggregateBase {
|
|
|
103
104
|
try {
|
|
104
105
|
if (this.resourcesSent) return;
|
|
105
106
|
const agentRuntime = getRuntime(this.agentIdentifier);
|
|
107
|
+
const info = getInfo(this.agentIdentifier);
|
|
106
108
|
// make sure this only gets sent once
|
|
107
109
|
this.resourcesSent = true;
|
|
108
110
|
// differentiate between internal+external and ajax+non-ajax
|
|
@@ -128,10 +130,19 @@ export class Aggregate extends AggregateBase {
|
|
|
128
130
|
this.storeSupportabilityMetrics("PageSession/Endpoint/".concat(endpoint.charAt(0).toUpperCase() + endpoint.slice(1), "/BytesSent"), agentRuntime.bytesSent[endpoint]);
|
|
129
131
|
});
|
|
130
132
|
|
|
133
|
+
// Capture per-agent query bytes sent for each endpoint (see harvest) and RUM call (see page_view_event aggregator).
|
|
134
|
+
Object.keys(agentRuntime.bytesSent).forEach(endpoint => {
|
|
135
|
+
this.storeSupportabilityMetrics("PageSession/Endpoint/".concat(endpoint.charAt(0).toUpperCase() + endpoint.slice(1), "/QueryBytesSent"), agentRuntime.queryBytesSent[endpoint]);
|
|
136
|
+
});
|
|
137
|
+
|
|
131
138
|
// Capture metrics for session trace if active (`ptid` is set when returned by replay ingest).
|
|
132
139
|
if (agentRuntime.ptid) {
|
|
133
140
|
this.storeSupportabilityMetrics('PageSession/Feature/SessionTrace/DurationMs', Math.round(performance.now()));
|
|
134
141
|
}
|
|
142
|
+
|
|
143
|
+
// Capture metrics for size of custom attributes
|
|
144
|
+
const jsAttributes = stringify(info.jsAttributes);
|
|
145
|
+
this.storeSupportabilityMetrics('PageSession/Feature/CustomData/Bytes', jsAttributes === '{}' ? 0 : jsAttributes.length);
|
|
135
146
|
} catch (e) {
|
|
136
147
|
// do nothing
|
|
137
148
|
}
|
|
@@ -9,11 +9,11 @@ import { registerHandler as register } from '../../../common/event-emitter/regis
|
|
|
9
9
|
import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler';
|
|
10
10
|
import { cleanURL } from '../../../common/url/clean-url';
|
|
11
11
|
import { getConfigurationValue, getInfo, getRuntime } from '../../../common/config/config';
|
|
12
|
-
import { AggregateBase } from '../../utils/aggregate-base';
|
|
13
12
|
import { FEATURE_NAME } from '../constants';
|
|
14
13
|
import { drain } from '../../../common/drain/drain';
|
|
15
14
|
import { isBrowserScope } from '../../../common/util/global-scope';
|
|
16
|
-
|
|
15
|
+
import { FeatureBase } from '../../utils/feature-base';
|
|
16
|
+
export class Aggregate extends FeatureBase {
|
|
17
17
|
static featureName = FEATURE_NAME;
|
|
18
18
|
constructor(agentIdentifier, aggregator) {
|
|
19
19
|
var _this;
|
|
@@ -10,13 +10,13 @@ import { paintMetrics } from '../../../common/metrics/paint-metrics';
|
|
|
10
10
|
import { submitData } from '../../../common/util/submit-data';
|
|
11
11
|
import { getConfigurationValue, getInfo, getRuntime } from '../../../common/config/config';
|
|
12
12
|
import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler';
|
|
13
|
-
import { AggregateBase } from '../../utils/aggregate-base';
|
|
14
13
|
import * as CONSTANTS from '../constants';
|
|
15
14
|
import { getActivatedFeaturesFlags } from './initialized-features';
|
|
16
15
|
import { globalScope, isBrowserScope } from '../../../common/util/global-scope';
|
|
17
16
|
import { drain } from '../../../common/drain/drain';
|
|
17
|
+
import { FeatureBase } from '../../utils/feature-base';
|
|
18
18
|
const jsonp = 'NREUM.setToken';
|
|
19
|
-
export class Aggregate extends
|
|
19
|
+
export class Aggregate extends FeatureBase {
|
|
20
20
|
static featureName = CONSTANTS.FEATURE_NAME;
|
|
21
21
|
constructor(agentIdentifier, aggregator) {
|
|
22
22
|
super(agentIdentifier, aggregator, CONSTANTS.FEATURE_NAME);
|
|
@@ -130,7 +130,10 @@ export class Aggregate extends AggregateBase {
|
|
|
130
130
|
var queryString = fromArray(chunksForQueryString, agentRuntime.maxBytes);
|
|
131
131
|
|
|
132
132
|
// Capture bytes sent to RUM call endpoint (currently `1`) as a supportability metric. See metrics aggregator (on unload).
|
|
133
|
-
agentRuntime.bytesSent[protocol] =
|
|
133
|
+
agentRuntime.bytesSent[protocol] = 0; // Set to zero for now until RUM is moved to POST
|
|
134
|
+
|
|
135
|
+
// Capture query bytes sent to RUM call endpoint (currently `1`) as a supportability metric. See metrics aggregator (on unload).
|
|
136
|
+
agentRuntime.queryBytesSent[protocol] = (agentRuntime.queryBytesSent[protocol] || 0) + queryString?.length || 0;
|
|
134
137
|
const isValidJsonp = submitData.jsonp(this.getScheme() + '://' + info.beacon + '/' + protocol + '/' + info.licenseKey + queryString, jsonp);
|
|
135
138
|
// Usually `drain` is invoked automatically after processing feature flags contained in the JSONP callback from
|
|
136
139
|
// ingest (see `activateFeatures`), so when JSONP cannot execute (as with module workers), we drain manually.
|
|
@@ -14,11 +14,11 @@ import { registerHandler } from '../../../common/event-emitter/register-handler'
|
|
|
14
14
|
import { cleanURL } from '../../../common/url/clean-url';
|
|
15
15
|
import { handle } from '../../../common/event-emitter/handle';
|
|
16
16
|
import { getInfo, getConfigurationValue, getRuntime } from '../../../common/config/config';
|
|
17
|
-
import { AggregateBase } from '../../utils/aggregate-base';
|
|
18
17
|
import { FEATURE_NAME } from '../constants';
|
|
19
18
|
import { drain } from '../../../common/drain/drain';
|
|
20
19
|
import { FEATURE_NAMES } from '../../../loaders/features/features';
|
|
21
|
-
|
|
20
|
+
import { FeatureBase } from '../../utils/feature-base';
|
|
21
|
+
export class Aggregate extends FeatureBase {
|
|
22
22
|
static featureName = FEATURE_NAME;
|
|
23
23
|
constructor(agentIdentifier, aggregator) {
|
|
24
24
|
var _this;
|
|
@@ -29,7 +29,7 @@ export class Aggregate extends AggregateBase {
|
|
|
29
29
|
this.curSessEndRecorded = false;
|
|
30
30
|
this.cls = null; // this should be null unless set to a numeric value by web-vitals so that we differentiate if CLS is supported
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
/* ! This is the section that used to be in the loader portion: ! */
|
|
33
33
|
/* ------------------------------------------------------------ */
|
|
34
34
|
const pageStartedHidden = getRuntime(agentIdentifier).initHidden; // our attempt at recapturing initial vis state since this code runs post-load time
|
|
35
35
|
this.alreadySent = new Set(); // since we don't support timings on BFCache restores, this tracks and helps cap metrics that web-vitals report more than once
|
|
@@ -105,10 +105,10 @@ export class Aggregate extends AggregateBase {
|
|
|
105
105
|
attributes.size = lcpEntry.size;
|
|
106
106
|
attributes.eid = lcpEntry.id;
|
|
107
107
|
if (lcpEntry.url) {
|
|
108
|
-
attributes
|
|
108
|
+
attributes.elUrl = cleanURL(lcpEntry.url);
|
|
109
109
|
}
|
|
110
110
|
if (lcpEntry.element?.tagName) {
|
|
111
|
-
attributes
|
|
111
|
+
attributes.elTag = lcpEntry.element.tagName;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
this.addConnectionAttributes(attributes);
|
|
@@ -221,7 +221,7 @@ export class Aggregate extends AggregateBase {
|
|
|
221
221
|
Future: onCLS value changes should be reported directly & CLS separated into its own timing node so it's not beholden to 'pageHide' firing. It'd also be possible to report the real final CLS.
|
|
222
222
|
*/
|
|
223
223
|
if (this.cls !== null) {
|
|
224
|
-
attrs
|
|
224
|
+
attrs.cls = this.cls;
|
|
225
225
|
}
|
|
226
226
|
this.timings.push({
|
|
227
227
|
name: name,
|
|
@@ -8,14 +8,13 @@ import { mapOwn } from '../../../common/util/map-own';
|
|
|
8
8
|
import { stringify } from '../../../common/util/stringify';
|
|
9
9
|
import { parseUrl } from '../../../common/url/parse-url';
|
|
10
10
|
import { supportsPerformanceObserver } from '../../../common/window/supports-performance-observer';
|
|
11
|
-
import slice from 'lodash._slice';
|
|
12
11
|
import { getConfigurationValue, getInfo, getRuntime } from '../../../common/config/config';
|
|
13
12
|
import { now } from '../../../common/timing/now';
|
|
14
|
-
import { AggregateBase } from '../../utils/aggregate-base';
|
|
15
13
|
import { FEATURE_NAME } from '../constants';
|
|
16
14
|
import { drain } from '../../../common/drain/drain';
|
|
17
15
|
import { HandlerCache } from '../../utils/handler-cache';
|
|
18
|
-
|
|
16
|
+
import { FeatureBase } from '../../utils/feature-base';
|
|
17
|
+
export class Aggregate extends FeatureBase {
|
|
19
18
|
static featureName = FEATURE_NAME;
|
|
20
19
|
constructor(agentIdentifier, aggregator) {
|
|
21
20
|
var _this;
|
|
@@ -252,7 +251,7 @@ export class Aggregate extends AggregateBase {
|
|
|
252
251
|
} else if (t && typeof t.tagName === 'string') {
|
|
253
252
|
origin = t.tagName.toLowerCase();
|
|
254
253
|
if (t.id) origin += '#' + t.id;
|
|
255
|
-
if (t.className) origin += '.' +
|
|
254
|
+
if (t.className) origin += '.' + Array.from(t.classList).join('.');
|
|
256
255
|
}
|
|
257
256
|
if (origin === 'unknown') {
|
|
258
257
|
if (typeof target === 'string') origin = target;else if (target === document) origin = 'document';else if (target === window) origin = 'window';else if (target instanceof FileReader) origin = 'FileReader';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
/*eslint no-undef: "error"*/
|
|
5
|
+
/* eslint no-undef: "error" */
|
|
6
6
|
import { registerHandler as register } from '../../../common/event-emitter/register-handler';
|
|
7
7
|
import { parseUrl } from '../../../common/url/parse-url';
|
|
8
8
|
import { shouldCollectEvent } from '../../../common/deny-list/deny-list';
|
|
@@ -13,13 +13,13 @@ import { paintMetrics } from '../../../common/metrics/paint-metrics';
|
|
|
13
13
|
import { Interaction } from './interaction';
|
|
14
14
|
import { getConfigurationValue, getRuntime } from '../../../common/config/config';
|
|
15
15
|
import { eventListenerOpts } from '../../../common/event-listener/event-listener-opts';
|
|
16
|
-
import { AggregateBase } from '../../utils/aggregate-base';
|
|
17
16
|
import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler';
|
|
18
17
|
import { Serializer } from './serializer';
|
|
19
18
|
import { ee } from '../../../common/event-emitter/contextual-ee';
|
|
20
19
|
import * as CONSTANTS from '../constants';
|
|
21
20
|
import { drain } from '../../../common/drain/drain';
|
|
22
21
|
import { FEATURE_NAMES } from '../../../loaders/features/features';
|
|
22
|
+
import { FeatureBase } from '../../utils/feature-base';
|
|
23
23
|
const {
|
|
24
24
|
FEATURE_NAME,
|
|
25
25
|
INTERACTION_EVENTS,
|
|
@@ -38,7 +38,7 @@ const {
|
|
|
38
38
|
JSONP_END,
|
|
39
39
|
originalSetTimeout
|
|
40
40
|
} = CONSTANTS;
|
|
41
|
-
export class Aggregate extends
|
|
41
|
+
export class Aggregate extends FeatureBase {
|
|
42
42
|
static featureName = FEATURE_NAME;
|
|
43
43
|
constructor(agentIdentifier, aggregator) {
|
|
44
44
|
super(agentIdentifier, aggregator, FEATURE_NAME);
|
|
@@ -81,7 +81,8 @@ export class Aggregate extends AggregateBase {
|
|
|
81
81
|
onFinished: onHarvestFinished,
|
|
82
82
|
retryDelay: state.harvestTimeSeconds
|
|
83
83
|
}, {
|
|
84
|
-
agentIdentifier
|
|
84
|
+
agentIdentifier,
|
|
85
|
+
ee: baseEE
|
|
85
86
|
});
|
|
86
87
|
scheduler.harvest.on('events', onHarvestStarted);
|
|
87
88
|
|
|
@@ -213,7 +214,7 @@ export class Aggregate extends AggregateBase {
|
|
|
213
214
|
if (evName === 'click') {
|
|
214
215
|
var value = getActionText(ev.target);
|
|
215
216
|
if (value) {
|
|
216
|
-
state.currentNode.attrs.custom
|
|
217
|
+
state.currentNode.attrs.custom.actionText = value;
|
|
217
218
|
}
|
|
218
219
|
}
|
|
219
220
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { getConfigurationValue, getInfo, getRuntime, setInfo } from '../../common/config/config';
|
|
2
|
+
import { drain } from '../../common/drain/drain';
|
|
3
|
+
import { ee } from '../../common/event-emitter/contextual-ee';
|
|
4
|
+
import { registerHandler } from '../../common/event-emitter/register-handler';
|
|
5
|
+
import { isBrowserScope } from '../../common/util/global-scope';
|
|
6
|
+
import { SessionEntity } from '../../common/session/session-entity';
|
|
7
|
+
import { LocalStorage } from '../../common/storage/local-storage.js';
|
|
8
|
+
import { FirstPartyCookies } from '../../common/storage/first-party-cookies';
|
|
9
|
+
import { LocalMemory } from '../../common/storage/local-memory';
|
|
10
|
+
let ranOnce = 0;
|
|
11
|
+
export function setupAgentSession(agentIdentifier) {
|
|
12
|
+
const agentRuntime = getRuntime(agentIdentifier);
|
|
13
|
+
if (ranOnce++) return agentRuntime.session;
|
|
14
|
+
const sharedEE = ee.get(agentIdentifier);
|
|
15
|
+
|
|
16
|
+
// domain is a string that can be specified by customer.
|
|
17
|
+
// only way to keep the session object across subdomains is using first party cookies
|
|
18
|
+
// This determines which storage wrapper the session manager will use to keep state
|
|
19
|
+
let storageAPI;
|
|
20
|
+
const cookiesEnabled = getConfigurationValue(agentIdentifier, 'privacy.cookies_enabled') === true;
|
|
21
|
+
if (cookiesEnabled && isBrowserScope) {
|
|
22
|
+
storageAPI = getConfigurationValue(agentIdentifier, 'session.domain') ? new FirstPartyCookies(getConfigurationValue(agentIdentifier, 'session.domain')) : new LocalStorage();
|
|
23
|
+
}
|
|
24
|
+
if (cookiesEnabled) {
|
|
25
|
+
// defaults to "LocalMemory" if storageAPI is undefined, such as in Worker build
|
|
26
|
+
agentRuntime.session = new SessionEntity({
|
|
27
|
+
agentIdentifier,
|
|
28
|
+
key: 'SESSION',
|
|
29
|
+
storageAPI,
|
|
30
|
+
expiresMs: getConfigurationValue(agentIdentifier, 'session.expiresMs'),
|
|
31
|
+
inactiveMs: getConfigurationValue(agentIdentifier, 'session.inactiveMs')
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// The first time the agent runs on a page, it should put everything
|
|
36
|
+
// that's currently stored in the storage API into the local info.jsAttributes object
|
|
37
|
+
if (isBrowserScope) {
|
|
38
|
+
// retrieve & re-add all of the persisted setCustomAttribute|setUserId k-v from previous page load(s)
|
|
39
|
+
const customSessionData = agentRuntime.session?.read?.()?.custom;
|
|
40
|
+
const agentInfo = getInfo(agentIdentifier);
|
|
41
|
+
if (customSessionData) {
|
|
42
|
+
setInfo(agentIdentifier, {
|
|
43
|
+
...agentInfo,
|
|
44
|
+
jsAttributes: {
|
|
45
|
+
...agentInfo.jsAttributes,
|
|
46
|
+
...customSessionData
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// any calls to newrelic.setCustomAttribute(<persisted>) will need to be added to:
|
|
53
|
+
// local info.jsAttributes {}
|
|
54
|
+
// the session's storage API
|
|
55
|
+
registerHandler('api-setCustomAttribute', (time, key, value) => {
|
|
56
|
+
agentRuntime.session.syncCustomAttribute(key, value);
|
|
57
|
+
}, 'session', sharedEE);
|
|
58
|
+
|
|
59
|
+
// any calls to newrelic.setUserId(...) will need to be added to:
|
|
60
|
+
// local info.jsAttributes {}
|
|
61
|
+
// the session's storage API
|
|
62
|
+
registerHandler('api-setUserId', (time, key, value) => {
|
|
63
|
+
agentRuntime.session.syncCustomAttribute(key, value);
|
|
64
|
+
}, 'session', sharedEE);
|
|
65
|
+
drain(agentIdentifier, 'session');
|
|
66
|
+
return agentRuntime.session;
|
|
67
|
+
}
|
|
@@ -26,7 +26,7 @@ export class FeatureBase {
|
|
|
26
26
|
* loader configurations may appear after the loader code is executed.
|
|
27
27
|
*/
|
|
28
28
|
checkConfiguration() {
|
|
29
|
-
// NOTE: This check has to happen at aggregator load time
|
|
29
|
+
// NOTE: This check has to happen at aggregator load time
|
|
30
30
|
if (!isConfigured(this.agentIdentifier)) {
|
|
31
31
|
let jsAttributes = {
|
|
32
32
|
...gosCDN().info?.jsAttributes
|
|
@@ -48,6 +48,12 @@ export class InstrumentBase extends FeatureBase {
|
|
|
48
48
|
* it's only responsible for aborting its one specific feature, rather than all.
|
|
49
49
|
*/
|
|
50
50
|
try {
|
|
51
|
+
// The session entity needs to be attached to the config internals before the aggregator chunk runs
|
|
52
|
+
const {
|
|
53
|
+
setupAgentSession
|
|
54
|
+
} = await import( /* webpackChunkName: "session-manager" */'./agent-session');
|
|
55
|
+
setupAgentSession(this.agentIdentifier);
|
|
56
|
+
// import and instantiate the aggregator chunk
|
|
51
57
|
const {
|
|
52
58
|
lazyLoader
|
|
53
59
|
} = await import( /* webpackChunkName: "lazy-loader" */'./lazy-loader');
|
|
@@ -56,9 +62,8 @@ export class InstrumentBase extends FeatureBase {
|
|
|
56
62
|
} = await lazyLoader(this.featureName, 'aggregate');
|
|
57
63
|
new Aggregate(this.agentIdentifier, this.aggregator);
|
|
58
64
|
} catch (e) {
|
|
59
|
-
warn("Downloading ".concat(this.featureName, " failed..."));
|
|
65
|
+
warn("Downloading ".concat(this.featureName, " failed..."), e);
|
|
60
66
|
this.abortHandler?.(); // undo any important alterations made to the page
|
|
61
|
-
|
|
62
67
|
// not supported yet but nice to do: "abort" this agent's EE for this feature specifically
|
|
63
68
|
}
|
|
64
69
|
};
|
|
@@ -9,7 +9,7 @@ import { FEATURE_NAMES } from '../../loaders/features/features';
|
|
|
9
9
|
* should be.
|
|
10
10
|
* @param featureName Name of the feature to import such as ajax or session_trace
|
|
11
11
|
* @param featurePart Name of the feature part to load; should be either instrument or aggregate
|
|
12
|
-
* @returns {Promise<InstrumentBase|
|
|
12
|
+
* @returns {Promise<InstrumentBase|FeatureBase|null>}
|
|
13
13
|
*/
|
|
14
14
|
export function lazyLoader(featureName, featurePart) {
|
|
15
15
|
if (featurePart === 'aggregate') {
|
|
@@ -66,7 +66,7 @@ export class Agent {
|
|
|
66
66
|
this.features[featName].abortHandler?.();
|
|
67
67
|
}
|
|
68
68
|
const newrelic = gosNREUM();
|
|
69
|
-
delete newrelic.initializedAgents[this.agentIdentifier]?.
|
|
69
|
+
delete newrelic.initializedAgents[this.agentIdentifier]?.api; // prevent further calls to agent-specific APIs (see "configure.js")
|
|
70
70
|
delete newrelic.initializedAgents[this.agentIdentifier]?.[NR_FEATURES_REF_NAME]; // GC mem used internally by features
|
|
71
71
|
delete this.sharedAggregator;
|
|
72
72
|
// Keep the initialized agent object with its configs for troubleshooting purposes.
|
|
@@ -9,11 +9,10 @@ import { ee } from '../../common/event-emitter/contextual-ee';
|
|
|
9
9
|
import { now } from '../../common/timing/now';
|
|
10
10
|
import { drain, registerDrain } from '../../common/drain/drain';
|
|
11
11
|
import { onWindowLoad } from '../../common/window/load';
|
|
12
|
-
import {
|
|
12
|
+
import { isWorkerScope } from '../../common/util/global-scope';
|
|
13
13
|
import { warn } from '../../common/util/console';
|
|
14
14
|
import { SUPPORTABILITY_METRIC_CHANNEL } from '../../features/metrics/constants';
|
|
15
15
|
import { gosCDN } from '../../common/window/nreum';
|
|
16
|
-
import { putInBrowserStorage, removeFromBrowserStorage } from '../../common/window/session-storage';
|
|
17
16
|
export const CUSTOM_ATTR_GROUP = 'CUSTOM/'; // the subgroup items should be stored under in storage API
|
|
18
17
|
|
|
19
18
|
export function setTopLevelCallers() {
|
|
@@ -72,7 +71,6 @@ export function setAPI(agentIdentifier, forceDrain) {
|
|
|
72
71
|
const currentInfo = getInfo(agentIdentifier);
|
|
73
72
|
if (value === null) {
|
|
74
73
|
delete currentInfo.jsAttributes[key];
|
|
75
|
-
if (isBrowserScope) removeFromBrowserStorage(key, CUSTOM_ATTR_GROUP); // addToBrowserStorage flag isn't needed to unset keys from storage
|
|
76
74
|
} else {
|
|
77
75
|
setInfo(agentIdentifier, {
|
|
78
76
|
...currentInfo,
|
|
@@ -81,9 +79,8 @@ export function setAPI(agentIdentifier, forceDrain) {
|
|
|
81
79
|
[key]: value
|
|
82
80
|
}
|
|
83
81
|
});
|
|
84
|
-
if (isBrowserScope && addToBrowserStorage) putInBrowserStorage(key, value, CUSTOM_ATTR_GROUP);
|
|
85
82
|
}
|
|
86
|
-
return apiCall(prefix, apiName, true)();
|
|
83
|
+
return apiCall(prefix, apiName, true, !!addToBrowserStorage || value === null ? 'session' : undefined)(key, value);
|
|
87
84
|
}
|
|
88
85
|
apiInterface.setCustomAttribute = function (name, value) {
|
|
89
86
|
let persistAttribute = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
@@ -3,7 +3,7 @@ import { getConfigurationValue, getInfo, getRuntime } from '../../common/config/
|
|
|
3
3
|
import { ee } from '../../common/event-emitter/contextual-ee';
|
|
4
4
|
import { handle } from '../../common/event-emitter/handle';
|
|
5
5
|
import { registerHandler } from '../../common/event-emitter/register-handler';
|
|
6
|
-
import { single } from '../../common/util/
|
|
6
|
+
import { single } from '../../common/util/invoke';
|
|
7
7
|
import { submitData } from '../../common/util/submit-data';
|
|
8
8
|
import { isBrowserScope } from '../../common/util/global-scope';
|
|
9
9
|
import { CUSTOM_METRIC_CHANNEL } from '../../features/metrics/constants';
|
|
@@ -65,6 +65,7 @@ export function setAPI(agentIdentifier) {
|
|
|
65
65
|
request_name = window.encodeURIComponent(request_name);
|
|
66
66
|
cycle += 1;
|
|
67
67
|
const agentInfo = getInfo(agentIdentifier);
|
|
68
|
+
const agentRuntime = getRuntime(agentIdentifier);
|
|
68
69
|
if (!agentInfo.beacon) return;
|
|
69
70
|
var url = scheme + '://' + agentInfo.beacon + '/1/' + agentInfo.licenseKey;
|
|
70
71
|
url += '?a=' + agentInfo.applicationID + '&';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { setAPI, setTopLevelCallers
|
|
1
|
+
import { setAPI, setTopLevelCallers } from '../api/api';
|
|
2
2
|
import { addToNREUM, gosCDN, gosNREUMInitializedAgents } from '../../common/window/nreum';
|
|
3
3
|
import { setConfiguration, setInfo, setLoaderConfig, setRuntime } from '../../common/config/config';
|
|
4
4
|
import { activateFeatures, activatedFeatures } from '../../common/util/feature-flags';
|
|
5
|
-
import {
|
|
6
|
-
import { getAllStorageItemsOfGroup } from '../../common/window/session-storage';
|
|
5
|
+
import { isWorkerScope } from '../../common/util/global-scope';
|
|
7
6
|
export function configure(agentIdentifier) {
|
|
8
7
|
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9
8
|
let loaderType = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -28,11 +27,6 @@ export function configure(agentIdentifier) {
|
|
|
28
27
|
// add a default attr to all worker payloads
|
|
29
28
|
info.jsAttributes.isWorker = true;
|
|
30
29
|
}
|
|
31
|
-
if (isBrowserScope) {
|
|
32
|
-
// retrieve & re-add all of the persisted setCustomAttribute|setUserId k-v from previous page load(s)
|
|
33
|
-
let prevPageSessionJsAttrs = getAllStorageItemsOfGroup(CUSTOM_ATTR_GROUP);
|
|
34
|
-
Object.assign(info.jsAttributes, prevPageSessionJsAttrs);
|
|
35
|
-
}
|
|
36
30
|
setInfo(agentIdentifier, info);
|
|
37
31
|
setConfiguration(agentIdentifier, init || {});
|
|
38
32
|
setLoaderConfig(agentIdentifier, loader_config || {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurable.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/configurable.js"],"names":[],"mappings":"AAGA;IACE,
|
|
1
|
+
{"version":3,"file":"configurable.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/configurable.js"],"names":[],"mappings":"AAGA;IACE,kCAEC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/init.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/init.js"],"names":[],"mappings":"AAmCA,+CAIC;AAED,0DAIC;AAED,+DAYC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/runtime.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/runtime.js"],"names":[],"mappings":"AA+BA,yCAIC;AAED,oDAIC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-context.d.ts","sourceRoot":"","sources":["../../../../src/common/context/shared-context.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared-context.d.ts","sourceRoot":"","sources":["../../../../src/common/context/shared-context.js"],"names":[],"mappings":"AAQA;IACE,0BAWC;IARG,8BAAuB;CAS5B"}
|
|
@@ -4,7 +4,7 @@ export function eventListenerOpts(useCapture: any, abortSignal: any): boolean |
|
|
|
4
4
|
signal: any;
|
|
5
5
|
};
|
|
6
6
|
/** Do not use this within the worker context. */
|
|
7
|
-
export function windowAddEventListener(event: any, listener: any, capture
|
|
7
|
+
export function windowAddEventListener(event: any, listener: any, capture: boolean | undefined, abortSignal: any): void;
|
|
8
8
|
/** Do not use this within the worker context. */
|
|
9
|
-
export function documentAddEventListener(event: any, listener: any, capture
|
|
9
|
+
export function documentAddEventListener(event: any, listener: any, capture: boolean | undefined, abortSignal: any): void;
|
|
10
10
|
//# sourceMappingURL=event-listener-opts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-listener-opts.d.ts","sourceRoot":"","sources":["../../../../src/common/event-listener/event-listener-opts.js"],"names":[],"mappings":"AAuBA;;;;EAQC;AAED,iDAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"event-listener-opts.d.ts","sourceRoot":"","sources":["../../../../src/common/event-listener/event-listener-opts.js"],"names":[],"mappings":"AAuBA;;;;EAQC;AAED,iDAAiD;AACjD,wHAEC;AACD,iDAAiD;AACjD,0HAEC"}
|
|
@@ -9,6 +9,7 @@ export class HarvestScheduler extends SharedContext {
|
|
|
9
9
|
timeoutHandle: NodeJS.Timeout | null;
|
|
10
10
|
aborted: boolean;
|
|
11
11
|
harvest: Harvest;
|
|
12
|
+
unload(): void;
|
|
12
13
|
startTimer(interval: any, initialDelay: any): void;
|
|
13
14
|
interval: any;
|
|
14
15
|
stopTimer(permanently?: boolean): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harvest-scheduler.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest-scheduler.js"],"names":[],"mappings":"AAWA;;GAEG;AACH;IACE,
|
|
1
|
+
{"version":3,"file":"harvest-scheduler.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest-scheduler.js"],"names":[],"mappings":"AAWA;;GAEG;AACH;IACE,mDAeC;IAbC,cAAwB;IACxB,UAAsB;IACtB,iBAAoB;IACpB,qCAAyB;IACzB,iBAAoB;IAEpB,iBAA8C;IAShD,eAKC;IAED,mDAIC;IAHC,cAAwB;IAK1B,uCAMC;IAED,6CAWC;IAED,yCA6BC;IAED,gDAiBC;CACF;8BA7G6B,2BAA2B;wBAChB,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harvest.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"harvest.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest.js"],"names":[],"mappings":"AA6MA;;;EAsBC;AA7MD;IAII,0BAA2H;IAC3H,uBAAoD;IACpD,kCAAsH;IAEtH,YAAiB;IAGnB;;;;;;;;;OASG;IACH,gBANW,MAAM;QAGK,YAAY;QACZ,MAAM;6BAS3B;IAED;;;;;;;;;;;;;;KAcC;IACD,eAZS,MAAM;QAIgB,EAAE,EAAxB,MAAM;QACgB,IAAI,EAA1B,MAAM;;QAIK,YAAY;QACZ,MAAM;gDAYzB;IAED,kGAGC;IAED,uFAqEC;IAGD,0BAmBC;IAED;;;MAYC;IAED,mCAGC;IAED,uBAIC;CACF;8BAzL6B,2BAA2B;2BAF9B,mBAAmB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/common/session/constants.js"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,0CAA0C;AAC1C,0CAA0C"}
|