@newrelic/browser-agent 1.262.0 → 1.264.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 +21 -0
- package/README.md +2 -2
- package/dist/cjs/cdn/experimental.js +3 -7
- package/dist/cjs/cdn/pro.js +2 -2
- package/dist/cjs/cdn/spa.js +2 -2
- package/dist/cjs/common/aggregate/aggregator.js +3 -3
- package/dist/cjs/common/config/state/configurable.js +4 -4
- package/dist/cjs/common/config/state/init.js +11 -6
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/constants/runtime.js +1 -3
- package/dist/cjs/common/context/shared-context.js +2 -2
- package/dist/cjs/common/drain/drain.js +5 -5
- package/dist/cjs/common/harvest/harvest.js +3 -3
- package/dist/cjs/common/serialize/bel-serializer.js +2 -2
- package/dist/cjs/common/session/session-entity.js +3 -3
- package/dist/cjs/common/timing/time-keeper.js +13 -2
- package/dist/cjs/common/url/encode.js +3 -5
- package/dist/cjs/common/util/console.js +3 -4
- package/dist/cjs/common/util/obfuscate.js +3 -3
- package/dist/cjs/common/util/submit-data.js +0 -1
- package/dist/cjs/common/vitals/vital-metric.js +1 -1
- package/dist/cjs/common/wrap/wrap-logger.js +1 -2
- package/dist/cjs/common/wrap/wrap-xhr.js +1 -1
- package/dist/cjs/features/ajax/aggregate/index.js +1 -1
- package/dist/cjs/features/ajax/instrument/index.js +1 -1
- package/dist/cjs/features/generic_events/aggregate/index.js +137 -0
- package/dist/cjs/features/generic_events/constants.js +8 -0
- package/dist/cjs/features/generic_events/index.js +12 -0
- package/dist/cjs/features/generic_events/instrument/index.js +27 -0
- package/dist/cjs/features/jserrors/aggregate/index.js +13 -12
- package/dist/cjs/features/jserrors/instrument/index.js +1 -1
- package/dist/cjs/features/logging/aggregate/index.js +6 -6
- package/dist/cjs/features/logging/constants.js +2 -5
- package/dist/cjs/features/logging/instrument/index.js +1 -1
- package/dist/cjs/features/metrics/aggregate/index.js +17 -1
- package/dist/cjs/features/metrics/instrument/index.js +1 -1
- package/dist/cjs/features/page_action/instrument/index.js +6 -6
- package/dist/cjs/features/page_view_event/aggregate/index.js +21 -5
- package/dist/cjs/features/page_view_event/aggregate/initialized-features.js +1 -1
- package/dist/cjs/features/page_view_event/instrument/index.js +1 -1
- package/dist/cjs/features/page_view_timing/aggregate/index.js +3 -3
- package/dist/cjs/features/page_view_timing/instrument/index.js +1 -1
- package/dist/cjs/features/session_replay/aggregate/index.js +3 -3
- package/dist/cjs/features/session_replay/instrument/index.js +1 -1
- package/dist/cjs/features/session_replay/shared/recorder.js +1 -1
- package/dist/cjs/features/session_replay/shared/stylesheet-evaluator.js +1 -1
- package/dist/cjs/features/session_trace/aggregate/index.js +1 -1
- package/dist/cjs/features/session_trace/aggregate/trace/storage.js +2 -2
- package/dist/cjs/features/session_trace/instrument/index.js +1 -1
- package/dist/cjs/features/soft_navigations/aggregate/bel-node.js +1 -1
- package/dist/cjs/features/soft_navigations/aggregate/index.js +1 -1
- package/dist/cjs/features/soft_navigations/aggregate/interaction.js +5 -5
- package/dist/cjs/features/soft_navigations/instrument/index.js +1 -1
- package/dist/cjs/features/spa/aggregate/index.js +3 -4
- package/dist/cjs/features/spa/aggregate/interaction.js +2 -2
- package/dist/cjs/features/spa/aggregate/serializer.js +1 -2
- package/dist/cjs/features/spa/instrument/index.js +1 -1
- package/dist/cjs/features/utils/aggregate-base.js +6 -3
- package/dist/cjs/features/utils/instrument-base.js +2 -2
- package/dist/cjs/features/utils/lazy-feature-loader.js +2 -2
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/loaders/agent-base.js +1 -5
- package/dist/cjs/loaders/agent.js +3 -4
- package/dist/cjs/loaders/api/api.js +10 -8
- package/dist/cjs/loaders/api/apiAsync.js +1 -1
- package/dist/cjs/loaders/browser-agent.js +4 -3
- package/dist/cjs/loaders/configure/configure.js +4 -3
- package/dist/cjs/loaders/features/features.js +8 -4
- package/dist/cjs/loaders/micro-agent.js +6 -6
- package/dist/esm/cdn/experimental.js +2 -5
- package/dist/esm/cdn/pro.js +2 -2
- package/dist/esm/cdn/spa.js +2 -2
- package/dist/esm/common/aggregate/aggregator.js +3 -3
- package/dist/esm/common/config/state/configurable.js +4 -4
- package/dist/esm/common/config/state/init.js +11 -6
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/constants/runtime.js +0 -2
- package/dist/esm/common/context/shared-context.js +2 -2
- package/dist/esm/common/drain/drain.js +5 -5
- package/dist/esm/common/harvest/harvest.js +4 -4
- package/dist/esm/common/serialize/bel-serializer.js +2 -2
- package/dist/esm/common/session/session-entity.js +4 -4
- package/dist/esm/common/timing/time-keeper.js +12 -2
- package/dist/esm/common/url/encode.js +3 -5
- package/dist/esm/common/util/console.js +3 -4
- package/dist/esm/common/util/obfuscate.js +3 -3
- package/dist/esm/common/util/submit-data.js +0 -1
- package/dist/esm/common/vitals/vital-metric.js +1 -1
- package/dist/esm/common/wrap/wrap-logger.js +1 -2
- package/dist/esm/common/wrap/wrap-xhr.js +1 -1
- package/dist/esm/features/ajax/aggregate/index.js +1 -1
- package/dist/esm/features/ajax/instrument/index.js +1 -1
- package/dist/esm/features/generic_events/aggregate/index.js +129 -0
- package/dist/esm/features/generic_events/constants.js +2 -0
- package/dist/esm/features/generic_events/index.js +1 -0
- package/dist/esm/features/generic_events/instrument/index.js +20 -0
- package/dist/esm/features/jserrors/aggregate/index.js +13 -12
- package/dist/esm/features/jserrors/instrument/index.js +1 -1
- package/dist/esm/features/logging/aggregate/index.js +7 -7
- package/dist/esm/features/logging/constants.js +1 -4
- package/dist/esm/features/logging/instrument/index.js +1 -1
- package/dist/esm/features/metrics/aggregate/index.js +17 -1
- package/dist/esm/features/metrics/instrument/index.js +1 -1
- package/dist/esm/features/page_action/instrument/index.js +7 -6
- package/dist/esm/features/page_view_event/aggregate/index.js +22 -6
- package/dist/esm/features/page_view_event/aggregate/initialized-features.js +1 -1
- package/dist/esm/features/page_view_event/instrument/index.js +1 -1
- package/dist/esm/features/page_view_timing/aggregate/index.js +3 -3
- package/dist/esm/features/page_view_timing/instrument/index.js +1 -1
- package/dist/esm/features/session_replay/aggregate/index.js +3 -3
- package/dist/esm/features/session_replay/instrument/index.js +1 -1
- package/dist/esm/features/session_replay/shared/recorder.js +1 -1
- package/dist/esm/features/session_replay/shared/stylesheet-evaluator.js +1 -1
- package/dist/esm/features/session_trace/aggregate/index.js +1 -1
- package/dist/esm/features/session_trace/aggregate/trace/storage.js +2 -2
- package/dist/esm/features/session_trace/instrument/index.js +1 -1
- package/dist/esm/features/soft_navigations/aggregate/bel-node.js +1 -1
- package/dist/esm/features/soft_navigations/aggregate/index.js +1 -1
- package/dist/esm/features/soft_navigations/aggregate/interaction.js +5 -5
- package/dist/esm/features/soft_navigations/instrument/index.js +1 -1
- package/dist/esm/features/spa/aggregate/index.js +3 -4
- package/dist/esm/features/spa/aggregate/interaction.js +2 -2
- package/dist/esm/features/spa/aggregate/serializer.js +1 -2
- package/dist/esm/features/spa/instrument/index.js +1 -1
- package/dist/esm/features/utils/aggregate-base.js +7 -4
- package/dist/esm/features/utils/instrument-base.js +2 -2
- package/dist/esm/features/utils/lazy-feature-loader.js +2 -2
- package/dist/esm/index.js +3 -0
- package/dist/esm/loaders/agent-base.js +1 -5
- package/dist/esm/loaders/agent.js +3 -4
- package/dist/esm/loaders/api/api.js +10 -8
- package/dist/esm/loaders/api/apiAsync.js +1 -1
- package/dist/esm/loaders/browser-agent.js +3 -2
- package/dist/esm/loaders/configure/configure.js +4 -3
- package/dist/esm/loaders/features/features.js +8 -4
- package/dist/esm/loaders/micro-agent.js +6 -6
- package/dist/types/common/aggregate/aggregator.d.ts.map +1 -1
- package/dist/types/common/config/state/init.d.ts.map +1 -1
- package/dist/types/common/constants/runtime.d.ts +0 -1
- package/dist/types/common/constants/runtime.d.ts.map +1 -1
- package/dist/types/common/drain/drain.d.ts.map +1 -1
- package/dist/types/common/serialize/bel-serializer.d.ts.map +1 -1
- package/dist/types/common/timing/time-keeper.d.ts +2 -1
- package/dist/types/common/timing/time-keeper.d.ts.map +1 -1
- package/dist/types/common/url/encode.d.ts.map +1 -1
- package/dist/types/common/util/console.d.ts +1 -1
- package/dist/types/common/util/console.d.ts.map +1 -1
- package/dist/types/common/util/submit-data.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-logger.d.ts.map +1 -1
- package/dist/types/features/{page_action → generic_events}/aggregate/index.d.ts +7 -5
- package/dist/types/features/generic_events/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/generic_events/constants.d.ts +2 -0
- package/dist/types/features/generic_events/constants.d.ts.map +1 -0
- package/dist/types/features/generic_events/index.d.ts +2 -0
- package/dist/types/features/generic_events/index.d.ts.map +1 -0
- package/dist/types/features/generic_events/instrument/index.d.ts +6 -0
- package/dist/types/features/generic_events/instrument/index.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/logging/constants.d.ts +0 -3
- package/dist/types/features/logging/constants.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_action/instrument/index.d.ts +5 -4
- package/dist/types/features/page_action/instrument/index.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/types/features/session_replay/shared/recorder.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/interaction.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/serializer.d.ts.map +1 -1
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/loaders/agent-base.d.ts +0 -1
- package/dist/types/loaders/agent-base.d.ts.map +1 -1
- package/dist/types/loaders/agent.d.ts.map +1 -1
- package/dist/types/loaders/api/api.d.ts.map +1 -1
- package/dist/types/loaders/browser-agent.d.ts.map +1 -1
- package/dist/types/loaders/configure/configure.d.ts.map +1 -1
- package/dist/types/loaders/features/features.d.ts +1 -0
- package/dist/types/loaders/features/features.d.ts.map +1 -1
- package/package.json +25 -6
- package/src/cdn/experimental.js +2 -4
- package/src/cdn/pro.js +2 -2
- package/src/cdn/spa.js +2 -2
- package/src/common/aggregate/aggregator.js +2 -3
- package/src/common/config/state/configurable.js +4 -4
- package/src/common/config/state/init.js +6 -4
- package/src/common/constants/runtime.js +0 -2
- package/src/common/context/shared-context.js +2 -2
- package/src/common/drain/drain.js +4 -5
- package/src/common/harvest/harvest.js +4 -4
- package/src/common/serialize/bel-serializer.js +1 -2
- package/src/common/session/session-entity.js +4 -4
- package/src/common/timing/time-keeper.js +14 -2
- package/src/common/url/encode.js +2 -3
- package/src/common/util/console.js +3 -4
- package/src/common/util/obfuscate.js +3 -3
- package/src/common/util/submit-data.js +0 -1
- package/src/common/wrap/wrap-logger.js +1 -2
- package/src/common/wrap/wrap-xhr.js +1 -1
- package/src/features/generic_events/aggregate/index.js +133 -0
- package/src/features/generic_events/constants.js +3 -0
- package/src/features/generic_events/index.js +1 -0
- package/src/features/generic_events/instrument/index.js +22 -0
- package/src/features/jserrors/aggregate/index.js +4 -5
- package/src/features/logging/aggregate/index.js +6 -6
- package/src/features/logging/constants.js +0 -4
- package/src/features/metrics/aggregate/index.js +12 -0
- package/src/features/page_action/instrument/index.js +6 -6
- package/src/features/page_view_event/aggregate/index.js +22 -5
- package/src/features/page_view_event/aggregate/initialized-features.js +1 -1
- package/src/features/page_view_timing/aggregate/index.js +1 -2
- package/src/features/session_replay/aggregate/index.js +1 -1
- package/src/features/session_replay/shared/recorder.js +1 -1
- package/src/features/spa/aggregate/index.js +2 -3
- package/src/features/spa/aggregate/interaction.js +1 -2
- package/src/features/spa/aggregate/serializer.js +1 -2
- package/src/features/utils/aggregate-base.js +7 -4
- package/src/features/utils/instrument-base.js +2 -2
- package/src/features/utils/lazy-feature-loader.js +2 -2
- package/src/index.js +3 -0
- package/src/loaders/agent-base.js +1 -5
- package/src/loaders/agent.js +3 -4
- package/src/loaders/api/api.js +10 -8
- package/src/loaders/api/apiAsync.js +1 -1
- package/src/loaders/browser-agent.js +5 -3
- package/src/loaders/configure/configure.js +5 -1
- package/src/loaders/features/features.js +8 -4
- package/src/loaders/micro-agent.js +6 -6
- package/dist/cjs/cdn/polyfills/lite.js +0 -16
- package/dist/cjs/cdn/polyfills/pro.js +0 -21
- package/dist/cjs/cdn/polyfills/spa.js +0 -22
- package/dist/cjs/cdn/polyfills.js +0 -24
- package/dist/cjs/common/util/map-own.js +0 -31
- package/dist/cjs/features/page_action/aggregate/index.js +0 -121
- package/dist/esm/cdn/polyfills/lite.js +0 -14
- package/dist/esm/cdn/polyfills/pro.js +0 -19
- package/dist/esm/cdn/polyfills/spa.js +0 -20
- package/dist/esm/cdn/polyfills.js +0 -27
- package/dist/esm/common/util/map-own.js +0 -24
- package/dist/esm/features/page_action/aggregate/index.js +0 -114
- package/dist/types/cdn/polyfills/lite.d.ts +0 -2
- package/dist/types/cdn/polyfills/lite.d.ts.map +0 -1
- package/dist/types/cdn/polyfills/pro.d.ts +0 -2
- package/dist/types/cdn/polyfills/pro.d.ts.map +0 -1
- package/dist/types/cdn/polyfills/spa.d.ts +0 -2
- package/dist/types/cdn/polyfills/spa.d.ts.map +0 -1
- package/dist/types/cdn/polyfills.d.ts +0 -2
- package/dist/types/cdn/polyfills.d.ts.map +0 -1
- package/dist/types/common/util/map-own.d.ts +0 -3
- package/dist/types/common/util/map-own.d.ts.map +0 -1
- package/dist/types/features/page_action/aggregate/index.d.ts.map +0 -1
- package/src/cdn/polyfills/lite.js +0 -20
- package/src/cdn/polyfills/pro.js +0 -30
- package/src/cdn/polyfills/spa.js +0 -32
- package/src/cdn/polyfills.js +0 -27
- package/src/common/util/map-own.js +0 -22
- package/src/features/page_action/aggregate/index.js +0 -114
|
@@ -12,7 +12,7 @@ import { now } from '../../../common/timing/now';
|
|
|
12
12
|
import { SR_EVENT_EMITTER_TYPES } from '../../session_replay/constants';
|
|
13
13
|
import { castError, castErrorEvent, castPromiseRejectionEvent } from '../shared/cast-error';
|
|
14
14
|
export class Instrument extends InstrumentBase {
|
|
15
|
-
static featureName = FEATURE_NAME;
|
|
15
|
+
static featureName = (() => FEATURE_NAME)();
|
|
16
16
|
#replayRunning = false;
|
|
17
17
|
constructor(agentIdentifier, aggregator) {
|
|
18
18
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -6,11 +6,11 @@ import { warn } from '../../../common/util/console';
|
|
|
6
6
|
import { stringify } from '../../../common/util/stringify';
|
|
7
7
|
import { SUPPORTABILITY_METRIC_CHANNEL } from '../../metrics/constants';
|
|
8
8
|
import { AggregateBase } from '../../utils/aggregate-base';
|
|
9
|
-
import { FEATURE_NAME, LOGGING_EVENT_EMITTER_CHANNEL,
|
|
9
|
+
import { FEATURE_NAME, LOGGING_EVENT_EMITTER_CHANNEL, LOG_LEVELS, MAX_PAYLOAD_SIZE } from '../constants';
|
|
10
10
|
import { Log } from '../shared/log';
|
|
11
11
|
import { isValidLogLevel } from '../shared/utils';
|
|
12
12
|
export class Aggregate extends AggregateBase {
|
|
13
|
-
static featureName = FEATURE_NAME;
|
|
13
|
+
static featureName = (() => FEATURE_NAME)();
|
|
14
14
|
#agentRuntime;
|
|
15
15
|
#agentInfo;
|
|
16
16
|
constructor(agentIdentifier, aggregator) {
|
|
@@ -45,7 +45,7 @@ export class Aggregate extends AggregateBase {
|
|
|
45
45
|
if (this.blocked) return;
|
|
46
46
|
if (!attributes || typeof attributes !== 'object') attributes = {};
|
|
47
47
|
if (typeof level === 'string') level = level.toUpperCase();
|
|
48
|
-
if (!isValidLogLevel(level)) return warn(
|
|
48
|
+
if (!isValidLogLevel(level)) return warn(30, level);
|
|
49
49
|
try {
|
|
50
50
|
if (typeof message !== 'string') {
|
|
51
51
|
const stringified = stringify(message);
|
|
@@ -57,19 +57,19 @@ export class Aggregate extends AggregateBase {
|
|
|
57
57
|
if (!!stringified && stringified !== '{}') message = stringified;else message = String(message);
|
|
58
58
|
}
|
|
59
59
|
} catch (err) {
|
|
60
|
-
warn(
|
|
60
|
+
warn(16, message);
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
|
-
if (typeof message !== 'string' || !message) return warn(
|
|
63
|
+
if (typeof message !== 'string' || !message) return warn(32);
|
|
64
64
|
if (message.length > MAX_PAYLOAD_SIZE) {
|
|
65
65
|
handle(SUPPORTABILITY_METRIC_CHANNEL, ['Logging/Harvest/Failed/Seen', message.length]);
|
|
66
|
-
return warn(
|
|
66
|
+
return warn(31, message.slice(0, 25) + '...');
|
|
67
67
|
}
|
|
68
68
|
const log = new Log(this.#agentRuntime.timeKeeper.convertRelativeTimestamp(timestamp), message, attributes, level);
|
|
69
69
|
const logBytes = log.message.length + stringify(log.attributes).length + log.level.length + 10; // timestamp == 10 chars
|
|
70
70
|
if (logBytes > MAX_PAYLOAD_SIZE) {
|
|
71
71
|
handle(SUPPORTABILITY_METRIC_CHANNEL, ['Logging/Harvest/Failed/Seen', logBytes]);
|
|
72
|
-
return warn(
|
|
72
|
+
return warn(31, log.message.slice(0, 25) + '...');
|
|
73
73
|
}
|
|
74
74
|
if (this.estimatedBytes + logBytes >= MAX_PAYLOAD_SIZE) {
|
|
75
75
|
handle(SUPPORTABILITY_METRIC_CHANNEL, ['Logging/Harvest/Early/Seen', this.estimatedBytes + logBytes]);
|
|
@@ -8,7 +8,4 @@ export const LOG_LEVELS = {
|
|
|
8
8
|
};
|
|
9
9
|
export const LOGGING_EVENT_EMITTER_CHANNEL = 'log';
|
|
10
10
|
export const FEATURE_NAME = FEATURE_NAMES.logging;
|
|
11
|
-
export const MAX_PAYLOAD_SIZE = 1000000;
|
|
12
|
-
export const LOGGING_FAILURE_MESSAGE = 'failed to wrap logger: ';
|
|
13
|
-
export const LOGGING_LEVEL_FAILURE_MESSAGE = 'invalid log level: ';
|
|
14
|
-
export const LOGGING_IGNORED = 'ignored log: ';
|
|
11
|
+
export const MAX_PAYLOAD_SIZE = 1000000;
|
|
@@ -2,7 +2,7 @@ import { InstrumentBase } from '../../utils/instrument-base';
|
|
|
2
2
|
import { FEATURE_NAME } from '../constants';
|
|
3
3
|
import { bufferLog } from '../shared/utils';
|
|
4
4
|
export class Instrument extends InstrumentBase {
|
|
5
|
-
static featureName = FEATURE_NAME;
|
|
5
|
+
static featureName = (() => FEATURE_NAME)();
|
|
6
6
|
constructor(agentIdentifier, aggregator) {
|
|
7
7
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
8
8
|
super(agentIdentifier, aggregator, FEATURE_NAME, auto);
|
|
@@ -11,7 +11,7 @@ import { isBrowserScope, isWorkerScope } from '../../../common/constants/runtime
|
|
|
11
11
|
import { AggregateBase } from '../../utils/aggregate-base';
|
|
12
12
|
import { deregisterDrain } from '../../../common/drain/drain';
|
|
13
13
|
export class Aggregate extends AggregateBase {
|
|
14
|
-
static featureName = FEATURE_NAME;
|
|
14
|
+
static featureName = (() => FEATURE_NAME)();
|
|
15
15
|
constructor(agentIdentifier, aggregator) {
|
|
16
16
|
super(agentIdentifier, aggregator, FEATURE_NAME);
|
|
17
17
|
this.waitForFlags(['err']).then(_ref => {
|
|
@@ -102,6 +102,22 @@ export class Aggregate extends AggregateBase {
|
|
|
102
102
|
// Check if proxy for either chunks or beacon is being used
|
|
103
103
|
if (proxy.assets) this.storeSupportabilityMetrics('Config/AssetsUrl/Changed');
|
|
104
104
|
if (proxy.beacon) this.storeSupportabilityMetrics('Config/BeaconUrl/Changed');
|
|
105
|
+
if (isBrowserScope && window.MutationObserver) {
|
|
106
|
+
this.storeSupportabilityMetrics('Generic/VideoElement/Added', window.document.querySelectorAll('video').length);
|
|
107
|
+
const mo = new MutationObserver(records => {
|
|
108
|
+
records.forEach(record => {
|
|
109
|
+
record.addedNodes.forEach(addedNode => {
|
|
110
|
+
if (addedNode instanceof HTMLVideoElement) {
|
|
111
|
+
this.storeSupportabilityMetrics('Generic/VideoElement/Added', 1);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
mo.observe(window.document.body, {
|
|
117
|
+
childList: true,
|
|
118
|
+
subtree: true
|
|
119
|
+
});
|
|
120
|
+
}
|
|
105
121
|
}
|
|
106
122
|
eachSessionChecks() {
|
|
107
123
|
if (!isBrowserScope) return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InstrumentBase } from '../../utils/instrument-base';
|
|
2
2
|
import { FEATURE_NAME } from '../constants';
|
|
3
3
|
export class Instrument extends InstrumentBase {
|
|
4
|
-
static featureName = FEATURE_NAME;
|
|
4
|
+
static featureName = (() => FEATURE_NAME)();
|
|
5
5
|
constructor(agentIdentifier, aggregator) {
|
|
6
6
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
7
7
|
super(agentIdentifier, aggregator, FEATURE_NAME, auto);
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import { GenericEvents } from '../../generic_events';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated This feature has been replaced by Generic Events. Use/Import `GenericEvents` instead. This wrapper will be removed in a future release
|
|
10
|
+
*/
|
|
11
|
+
export class Instrument extends GenericEvents {
|
|
10
12
|
constructor(agentIdentifier, aggregator) {
|
|
11
13
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
12
|
-
super(agentIdentifier, aggregator,
|
|
13
|
-
this.importAggregator();
|
|
14
|
+
super(agentIdentifier, aggregator, auto);
|
|
14
15
|
}
|
|
15
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { globalScope, isBrowserScope, originTime } from '../../../common/constants/runtime';
|
|
2
2
|
import { addPT, addPN } from '../../../common/timing/nav-timing';
|
|
3
3
|
import { stringify } from '../../../common/util/stringify';
|
|
4
|
-
import { getInfo, getRuntime } from '../../../common/config/config';
|
|
4
|
+
import { getInfo, getRuntime, isConfigured } from '../../../common/config/config';
|
|
5
5
|
import { Harvest } from '../../../common/harvest/harvest';
|
|
6
6
|
import * as CONSTANTS from '../constants';
|
|
7
7
|
import { getActivatedFeaturesFlags } from './initialized-features';
|
|
@@ -18,13 +18,17 @@ import { SUPPORTABILITY_METRIC_CHANNEL } from '../../metrics/constants';
|
|
|
18
18
|
import { now } from '../../../common/timing/now';
|
|
19
19
|
import { TimeKeeper } from '../../../common/timing/time-keeper';
|
|
20
20
|
export class Aggregate extends AggregateBase {
|
|
21
|
-
static featureName = CONSTANTS.FEATURE_NAME;
|
|
21
|
+
static featureName = (() => CONSTANTS.FEATURE_NAME)();
|
|
22
22
|
constructor(agentIdentifier, aggregator) {
|
|
23
23
|
super(agentIdentifier, aggregator, CONSTANTS.FEATURE_NAME);
|
|
24
24
|
this.timeToFirstByte = 0;
|
|
25
25
|
this.firstByteToWindowLoad = 0; // our "frontend" duration
|
|
26
26
|
this.firstByteToDomContent = 0; // our "dom processing" duration
|
|
27
27
|
this.timeKeeper = new TimeKeeper(this.agentIdentifier);
|
|
28
|
+
if (!isConfigured(agentIdentifier)) {
|
|
29
|
+
this.ee.abort();
|
|
30
|
+
return warn(43);
|
|
31
|
+
}
|
|
28
32
|
if (isBrowserScope) {
|
|
29
33
|
timeToFirstByte.subscribe(_ref => {
|
|
30
34
|
let {
|
|
@@ -47,7 +51,6 @@ export class Aggregate extends AggregateBase {
|
|
|
47
51
|
const info = getInfo(this.agentIdentifier);
|
|
48
52
|
const agentRuntime = getRuntime(this.agentIdentifier);
|
|
49
53
|
const harvester = new Harvest(this);
|
|
50
|
-
if (!info.beacon) return;
|
|
51
54
|
if (info.queueTime) this.aggregator.store('measures', 'qt', {
|
|
52
55
|
value: info.queueTime
|
|
53
56
|
});
|
|
@@ -140,11 +143,24 @@ export class Aggregate extends AggregateBase {
|
|
|
140
143
|
this.timeKeeper.processRumRequest(xhr, rumStartTime, rumEndTime);
|
|
141
144
|
if (!this.timeKeeper.ready) throw new Error('TimeKeeper not ready');
|
|
142
145
|
agentRuntime.timeKeeper = this.timeKeeper;
|
|
146
|
+
|
|
147
|
+
// Check if the time diff is such that we need to capture a supportability metric
|
|
148
|
+
if (this.timeKeeper.localTimeDiff >= 12 * 60 * 60 * 1000) {
|
|
149
|
+
handle(SUPPORTABILITY_METRIC_CHANNEL, ['PVE/NRTime/Calculation/DiffExceed12Hrs'], undefined, FEATURE_NAMES.metrics, this.ee);
|
|
150
|
+
} else if (this.timeKeeper.localTimeDiff >= 6 * 60 * 60 * 1000) {
|
|
151
|
+
handle(SUPPORTABILITY_METRIC_CHANNEL, ['PVE/NRTime/Calculation/DiffExceed6Hrs'], undefined, FEATURE_NAMES.metrics, this.ee);
|
|
152
|
+
} else if (this.timeKeeper.localTimeDiff >= 60 * 60 * 1000) {
|
|
153
|
+
handle(SUPPORTABILITY_METRIC_CHANNEL, ['PVE/NRTime/Calculation/DiffExceed1Hrs'], undefined, FEATURE_NAMES.metrics, this.ee);
|
|
154
|
+
}
|
|
143
155
|
} catch (error) {
|
|
144
|
-
|
|
156
|
+
if (error?.message?.indexOf('invalid format') > 0) {
|
|
157
|
+
handle(SUPPORTABILITY_METRIC_CHANNEL, ['PVE/NRTime/Calculation/InvalidFormat'], undefined, FEATURE_NAMES.metrics, this.ee);
|
|
158
|
+
} else {
|
|
159
|
+
handle(SUPPORTABILITY_METRIC_CHANNEL, ['PVE/NRTime/Calculation/Failed'], undefined, FEATURE_NAMES.metrics, this.ee);
|
|
160
|
+
}
|
|
145
161
|
drain(this.agentIdentifier, FEATURE_NAMES.metrics, true);
|
|
146
162
|
this.ee.abort();
|
|
147
|
-
warn(
|
|
163
|
+
warn(17, error);
|
|
148
164
|
return;
|
|
149
165
|
}
|
|
150
166
|
try {
|
|
@@ -157,7 +173,7 @@ export class Aggregate extends AggregateBase {
|
|
|
157
173
|
this.drain();
|
|
158
174
|
} catch (err) {
|
|
159
175
|
this.ee.abort();
|
|
160
|
-
warn(
|
|
176
|
+
warn(18, err);
|
|
161
177
|
}
|
|
162
178
|
}
|
|
163
179
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InstrumentBase } from '../../utils/instrument-base';
|
|
2
2
|
import * as CONSTANTS from '../constants';
|
|
3
3
|
export class Instrument extends InstrumentBase {
|
|
4
|
-
static featureName = CONSTANTS.FEATURE_NAME;
|
|
4
|
+
static featureName = (() => CONSTANTS.FEATURE_NAME)();
|
|
5
5
|
constructor(agentIdentifier, aggregator) {
|
|
6
6
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
7
7
|
super(agentIdentifier, aggregator, CONSTANTS.FEATURE_NAME, auto);
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { nullable, numeric, getAddStringContext, addCustomAttributes } from '../../../common/serialize/bel-serializer';
|
|
7
|
-
import { mapOwn } from '../../../common/util/map-own';
|
|
8
7
|
import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler';
|
|
9
8
|
import { registerHandler } from '../../../common/event-emitter/register-handler';
|
|
10
9
|
import { handle } from '../../../common/event-emitter/handle';
|
|
@@ -23,7 +22,7 @@ import { longTask } from '../../../common/vitals/long-task';
|
|
|
23
22
|
import { subscribeToVisibilityChange } from '../../../common/window/page-visibility';
|
|
24
23
|
import { VITAL_NAMES } from '../../../common/vitals/constants';
|
|
25
24
|
export class Aggregate extends AggregateBase {
|
|
26
|
-
static featureName = FEATURE_NAME;
|
|
25
|
+
static featureName = (() => FEATURE_NAME)();
|
|
27
26
|
#handleVitalMetric = _ref => {
|
|
28
27
|
let {
|
|
29
28
|
name,
|
|
@@ -141,7 +140,8 @@ export class Aggregate extends AggregateBase {
|
|
|
141
140
|
var timingAttributes = timing.attrs || {};
|
|
142
141
|
var customAttributes = getInfo(this.agentIdentifier).jsAttributes || {};
|
|
143
142
|
var reservedAttributes = ['size', 'eid', 'cls', 'type', 'fid', 'elTag', 'elUrl', 'net-type', 'net-etype', 'net-rtt', 'net-dlink'];
|
|
144
|
-
|
|
143
|
+
Object.entries(customAttributes || {}).forEach(_ref3 => {
|
|
144
|
+
let [key, val] = _ref3;
|
|
145
145
|
if (reservedAttributes.indexOf(key) < 0) {
|
|
146
146
|
timingAttributes[key] = val;
|
|
147
147
|
}
|
|
@@ -10,7 +10,7 @@ import { FEATURE_NAME } from '../constants';
|
|
|
10
10
|
import { isBrowserScope } from '../../../common/constants/runtime';
|
|
11
11
|
import { now } from '../../../common/timing/now';
|
|
12
12
|
export class Instrument extends InstrumentBase {
|
|
13
|
-
static featureName = FEATURE_NAME;
|
|
13
|
+
static featureName = (() => FEATURE_NAME)();
|
|
14
14
|
constructor(agentIdentifier, aggregator) {
|
|
15
15
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
16
16
|
super(agentIdentifier, aggregator, FEATURE_NAME, auto);
|
|
@@ -30,8 +30,8 @@ import { deregisterDrain } from '../../../common/drain/drain';
|
|
|
30
30
|
import { now } from '../../../common/timing/now';
|
|
31
31
|
import { buildNRMetaNode } from '../shared/utils';
|
|
32
32
|
export class Aggregate extends AggregateBase {
|
|
33
|
-
static featureName = FEATURE_NAME;
|
|
34
|
-
mode = MODE.OFF;
|
|
33
|
+
static featureName = (() => FEATURE_NAME)();
|
|
34
|
+
mode = (() => MODE.OFF)();
|
|
35
35
|
|
|
36
36
|
// pass the recorder into the aggregator
|
|
37
37
|
constructor(agentIdentifier, aggregator, args) {
|
|
@@ -416,7 +416,7 @@ export class Aggregate extends AggregateBase {
|
|
|
416
416
|
abort() {
|
|
417
417
|
let reason = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
418
418
|
let data = arguments.length > 1 ? arguments[1] : undefined;
|
|
419
|
-
warn(
|
|
419
|
+
warn(33, reason.message);
|
|
420
420
|
handle(SUPPORTABILITY_METRIC_CHANNEL, ["SessionReplay/Abort/".concat(reason.sm), data], undefined, FEATURE_NAMES.metrics, this.ee);
|
|
421
421
|
this.blocked = true;
|
|
422
422
|
this.mode = MODE.OFF;
|
|
@@ -15,7 +15,7 @@ import { InstrumentBase } from '../../utils/instrument-base';
|
|
|
15
15
|
import { hasReplayPrerequisite, isPreloadAllowed } from '../shared/utils';
|
|
16
16
|
import { FEATURE_NAME, SR_EVENT_EMITTER_TYPES, TRIGGERS } from '../constants';
|
|
17
17
|
export class Instrument extends InstrumentBase {
|
|
18
|
-
static featureName = FEATURE_NAME;
|
|
18
|
+
static featureName = (() => FEATURE_NAME)();
|
|
19
19
|
#mode;
|
|
20
20
|
constructor(agentIdentifier, aggregator) {
|
|
21
21
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -33,7 +33,7 @@ export class Recorder {
|
|
|
33
33
|
/** Config to inform to inline stylesheet contents (true default) */
|
|
34
34
|
this.shouldInlineStylesheets = getConfigurationValue(this.parent.agentIdentifier, 'session_replay.inline_stylesheet');
|
|
35
35
|
/** A flag that can be set to false by failing conversions to stop the fetching process */
|
|
36
|
-
this.shouldFix = this.shouldInlineStylesheets;
|
|
36
|
+
this.shouldFix = this.shouldInlineStylesheets && getConfigurationValue(this.parent.agentIdentifier, 'session_replay.fix_stylesheets');
|
|
37
37
|
/** The method to stop recording. This defaults to a noop, but is overwritten once the recording library is imported and initialized */
|
|
38
38
|
this.stopRecording = () => {/* no-op until set by rrweb initializer */};
|
|
39
39
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { originals } from '../../../common/config/config';
|
|
2
2
|
import { isBrowserScope } from '../../../common/constants/runtime';
|
|
3
3
|
class StylesheetEvaluator {
|
|
4
|
-
#evaluated = new WeakSet();
|
|
4
|
+
#evaluated = (() => new WeakSet())();
|
|
5
5
|
#fetchProms = [];
|
|
6
6
|
/**
|
|
7
7
|
* Flipped to true if stylesheets that cannot be natively inlined are detected by the stylesheetEvaluator class
|
|
@@ -12,7 +12,7 @@ const ERROR_MODE_SECONDS_WINDOW = 30 * 1000; // sliding window of nodes to track
|
|
|
12
12
|
/** Reserved room for query param attrs */
|
|
13
13
|
const QUERY_PARAM_PADDING = 5000;
|
|
14
14
|
export class Aggregate extends AggregateBase {
|
|
15
|
-
static featureName = FEATURE_NAME;
|
|
15
|
+
static featureName = (() => FEATURE_NAME)();
|
|
16
16
|
constructor(agentIdentifier, aggregator) {
|
|
17
17
|
super(agentIdentifier, aggregator, FEATURE_NAME);
|
|
18
18
|
this.agentRuntime = getRuntime(agentIdentifier);
|
|
@@ -33,10 +33,10 @@ const toAggregate = {
|
|
|
33
33
|
export class TraceStorage {
|
|
34
34
|
nodeCount = 0;
|
|
35
35
|
trace = {};
|
|
36
|
-
earliestTimeStamp = Infinity;
|
|
36
|
+
earliestTimeStamp = (() => Infinity)();
|
|
37
37
|
latestTimeStamp = 0;
|
|
38
38
|
tempStorage = [];
|
|
39
|
-
prevStoredEvents = new Set();
|
|
39
|
+
prevStoredEvents = (() => new Set())();
|
|
40
40
|
constructor(parent) {
|
|
41
41
|
this.parent = parent;
|
|
42
42
|
}
|
|
@@ -21,7 +21,7 @@ const {
|
|
|
21
21
|
PUSH_STATE
|
|
22
22
|
} = CONSTANTS;
|
|
23
23
|
export class Instrument extends InstrumentBase {
|
|
24
|
-
static featureName = FEATURE_NAME;
|
|
24
|
+
static featureName = (() => FEATURE_NAME)();
|
|
25
25
|
constructor(agentIdentifier, aggregator) {
|
|
26
26
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
27
27
|
super(agentIdentifier, aggregator, FEATURE_NAME, auto);
|
|
@@ -7,7 +7,7 @@ export class BelNode {
|
|
|
7
7
|
end;
|
|
8
8
|
callbackEnd = 0;
|
|
9
9
|
callbackDuration = 0;
|
|
10
|
-
nodeId = ++nodesSeen;
|
|
10
|
+
nodeId = (() => ++nodesSeen)();
|
|
11
11
|
constructor(agentIdentifier) {
|
|
12
12
|
if (!agentIdentifier) throw new Error('Interaction is missing core attributes');
|
|
13
13
|
this.agentIdentifier = agentIdentifier;
|
|
@@ -13,7 +13,7 @@ import { AjaxNode } from './ajax-node';
|
|
|
13
13
|
import { InitialPageLoadInteraction } from './initial-page-load-interaction';
|
|
14
14
|
import { Interaction } from './interaction';
|
|
15
15
|
export class Aggregate extends AggregateBase {
|
|
16
|
-
static featureName = FEATURE_NAME;
|
|
16
|
+
static featureName = (() => FEATURE_NAME)();
|
|
17
17
|
constructor(agentIdentifier, aggregator, _ref) {
|
|
18
18
|
let {
|
|
19
19
|
domObserver
|
|
@@ -11,10 +11,10 @@ import { BelNode } from './bel-node';
|
|
|
11
11
|
* link https://github.com/newrelic/nr-querypack/blob/main/schemas/bel/7.qpschema
|
|
12
12
|
**/
|
|
13
13
|
export class Interaction extends BelNode {
|
|
14
|
-
id = generateUuid(); // unique id that is serialized and used to link interactions with errors
|
|
15
|
-
initialPageURL = initialLocation;
|
|
16
|
-
oldURL = '' + globalScope?.location;
|
|
17
|
-
newURL = '' + globalScope?.location;
|
|
14
|
+
id = (() => generateUuid())(); // unique id that is serialized and used to link interactions with errors
|
|
15
|
+
initialPageURL = (() => initialLocation)();
|
|
16
|
+
oldURL = (() => '' + globalScope?.location)();
|
|
17
|
+
newURL = (() => '' + globalScope?.location)();
|
|
18
18
|
customName;
|
|
19
19
|
customAttributes = {};
|
|
20
20
|
customDataByApi = {};
|
|
@@ -22,7 +22,7 @@ export class Interaction extends BelNode {
|
|
|
22
22
|
appTime; // only used by initialPageLoad interactions
|
|
23
23
|
newRoute;
|
|
24
24
|
/** Internal state of this interaction: in-progress, finished, or cancelled. */
|
|
25
|
-
status = INTERACTION_STATUS.IP;
|
|
25
|
+
status = (() => INTERACTION_STATUS.IP)();
|
|
26
26
|
domTimestamp = 0;
|
|
27
27
|
historyTimestamp = 0;
|
|
28
28
|
createdByApi = false;
|
|
@@ -15,7 +15,7 @@ import { now } from '../../../common/timing/now';
|
|
|
15
15
|
const UI_WAIT_INTERVAL = 1 / 10 * 1000; // assume 10 fps
|
|
16
16
|
|
|
17
17
|
export class Instrument extends InstrumentBase {
|
|
18
|
-
static featureName = FEATURE_NAME;
|
|
18
|
+
static featureName = (() => FEATURE_NAME)();
|
|
19
19
|
constructor(agentIdentifier, aggregator) {
|
|
20
20
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
21
21
|
super(agentIdentifier, aggregator, FEATURE_NAME, auto);
|
|
@@ -6,7 +6,6 @@
|
|
|
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';
|
|
9
|
-
import { mapOwn } from '../../../common/util/map-own';
|
|
10
9
|
import { navTimingValues as navTiming } from '../../../common/timing/nav-timing';
|
|
11
10
|
import { generateUuid } from '../../../common/ids/unique-id';
|
|
12
11
|
import { Interaction } from './interaction';
|
|
@@ -45,7 +44,7 @@ const {
|
|
|
45
44
|
originalSetTimeout
|
|
46
45
|
} = CONSTANTS;
|
|
47
46
|
export class Aggregate extends AggregateBase {
|
|
48
|
-
static featureName = FEATURE_NAME;
|
|
47
|
+
static featureName = (() => FEATURE_NAME)();
|
|
49
48
|
constructor(agentIdentifier, aggregator) {
|
|
50
49
|
super(agentIdentifier, aggregator, FEATURE_NAME);
|
|
51
50
|
const agentRuntime = getRuntime(agentIdentifier);
|
|
@@ -613,7 +612,7 @@ export class Aggregate extends AggregateBase {
|
|
|
613
612
|
|
|
614
613
|
// make sure that newrelic[INTERACTION]() works in end handler
|
|
615
614
|
state.currentNode = root;
|
|
616
|
-
|
|
615
|
+
Object.values(interaction.handlers || {}).forEach(function (cb) {
|
|
617
616
|
cb(attrs.store);
|
|
618
617
|
});
|
|
619
618
|
setCurrentNode(null);
|
|
@@ -693,7 +692,7 @@ export class Aggregate extends AggregateBase {
|
|
|
693
692
|
if (interaction.root?.attrs?.trigger === 'initialPageLoad') smCategory = 'InitialPageLoad';else if (interaction.routeChange) smCategory = 'RouteChange';else smCategory = 'Custom';
|
|
694
693
|
handle(SUPPORTABILITY_METRIC_CHANNEL, ["Spa/Interaction/".concat(smCategory, "/Duration/Ms"), Math.max((interaction.root?.end || 0) - (interaction.root?.start || 0), 0)], undefined, FEATURE_NAMES.metrics, baseEE);
|
|
695
694
|
scheduler?.scheduleHarvest(0);
|
|
696
|
-
if (!scheduler) warn(
|
|
695
|
+
if (!scheduler) warn(19);
|
|
697
696
|
}
|
|
698
697
|
function isEnabled() {
|
|
699
698
|
var enabled = getConfigurationValue(agentIdentifier, 'spa.enabled');
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { getInfo, getRuntime, originals } from '../../../common/config/config';
|
|
7
|
-
import { mapOwn } from '../../../common/util/map-own';
|
|
8
7
|
import { ee } from '../../../common/event-emitter/contextual-ee';
|
|
9
8
|
import { InteractionNode } from './interaction-node';
|
|
10
9
|
var originalSetTimeout = originals.ST;
|
|
@@ -82,7 +81,8 @@ InteractionPrototype.finish = function finishInteraction() {
|
|
|
82
81
|
if (this.onFinished) {
|
|
83
82
|
this.onFinished(this);
|
|
84
83
|
}
|
|
85
|
-
|
|
84
|
+
Object.entries(getInfo(interaction.agentIdentifier).jsAttributes || {}).forEach(_ref => {
|
|
85
|
+
let [attr, value] = _ref;
|
|
86
86
|
if (!(attr in customAttrs)) customAttrs[attr] = value;
|
|
87
87
|
});
|
|
88
88
|
root.end = endTimestamp;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { cleanURL } from '../../../common/url/clean-url';
|
|
6
|
-
import { mapOwn } from '../../../common/util/map-own';
|
|
7
6
|
import { nullable, numeric, getAddStringContext, addCustomAttributes } from '../../../common/serialize/bel-serializer';
|
|
8
7
|
import { SharedContext } from '../../../common/context/shared-context';
|
|
9
8
|
import { getInfo } from '../../../common/config/config';
|
|
@@ -125,7 +124,7 @@ export class Serializer extends SharedContext {
|
|
|
125
124
|
// get all navTiming values except navigationStart
|
|
126
125
|
// (since its the same as interaction.start)
|
|
127
126
|
// and limit to just the first 20 values we know about
|
|
128
|
-
|
|
127
|
+
Object.values(navTiming.slice(1, 21) || {}).forEach(v => {
|
|
129
128
|
if (v !== undefined) {
|
|
130
129
|
navTimingNode += seperator + numeric(v - prev);
|
|
131
130
|
seperator = ',';
|
|
@@ -22,7 +22,7 @@ const {
|
|
|
22
22
|
FN_END
|
|
23
23
|
} = CONSTANTS;
|
|
24
24
|
export class Instrument extends InstrumentBase {
|
|
25
|
-
static featureName = FEATURE_NAME;
|
|
25
|
+
static featureName = (() => FEATURE_NAME)();
|
|
26
26
|
constructor(agentIdentifier, aggregator) {
|
|
27
27
|
var _this;
|
|
28
28
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -2,7 +2,7 @@ import { FeatureBase } from './feature-base';
|
|
|
2
2
|
import { getInfo, isConfigured, getRuntime } from '../../common/config/config';
|
|
3
3
|
import { configure } from '../../loaders/configure/configure';
|
|
4
4
|
import { gosCDN } from '../../common/window/nreum';
|
|
5
|
-
import { drain } from '../../common/drain/drain';
|
|
5
|
+
import { deregisterDrain, drain } from '../../common/drain/drain';
|
|
6
6
|
import { activatedFeatures } from '../../common/util/feature-flags';
|
|
7
7
|
export class AggregateBase extends FeatureBase {
|
|
8
8
|
constructor() {
|
|
@@ -35,6 +35,8 @@ export class AggregateBase extends FeatureBase {
|
|
|
35
35
|
});
|
|
36
36
|
return flagsPromise.catch(err => {
|
|
37
37
|
this.ee.emit('internal-error', [err]);
|
|
38
|
+
this.blocked = true;
|
|
39
|
+
deregisterDrain(this.agentIdentifier, this.featureName);
|
|
38
40
|
});
|
|
39
41
|
}
|
|
40
42
|
drain() {
|
|
@@ -49,8 +51,9 @@ export class AggregateBase extends FeatureBase {
|
|
|
49
51
|
checkConfiguration() {
|
|
50
52
|
// NOTE: This check has to happen at aggregator load time
|
|
51
53
|
if (!isConfigured(this.agentIdentifier)) {
|
|
54
|
+
const cdn = gosCDN();
|
|
52
55
|
let jsAttributes = {
|
|
53
|
-
...
|
|
56
|
+
...cdn.info?.jsAttributes
|
|
54
57
|
};
|
|
55
58
|
try {
|
|
56
59
|
jsAttributes = {
|
|
@@ -63,9 +66,9 @@ export class AggregateBase extends FeatureBase {
|
|
|
63
66
|
configure({
|
|
64
67
|
agentIdentifier: this.agentIdentifier
|
|
65
68
|
}, {
|
|
66
|
-
...
|
|
69
|
+
...cdn,
|
|
67
70
|
info: {
|
|
68
|
-
...
|
|
71
|
+
...cdn.info,
|
|
69
72
|
jsAttributes
|
|
70
73
|
},
|
|
71
74
|
runtime: getRuntime(this.agentIdentifier)
|
|
@@ -87,7 +87,7 @@ export class InstrumentBase extends FeatureBase {
|
|
|
87
87
|
session = setupAgentSession(this.agentIdentifier);
|
|
88
88
|
}
|
|
89
89
|
} catch (e) {
|
|
90
|
-
warn(
|
|
90
|
+
warn(20, e);
|
|
91
91
|
this.ee.emit('internal-error', [e]);
|
|
92
92
|
if (this.featureName === FEATURE_NAMES.sessionReplay) this.abortHandler?.(); // SR should stop recording if session DNE
|
|
93
93
|
}
|
|
@@ -111,7 +111,7 @@ export class InstrumentBase extends FeatureBase {
|
|
|
111
111
|
this.featAggregate = new Aggregate(this.agentIdentifier, this.aggregator, argsObjFromInstrument);
|
|
112
112
|
loadedSuccessfully(true);
|
|
113
113
|
} catch (e) {
|
|
114
|
-
warn(
|
|
114
|
+
warn(34, e);
|
|
115
115
|
this.abortHandler?.(); // undo any important alterations made to the page
|
|
116
116
|
// not supported yet but nice to do: "abort" this agent's EE for this feature specifically
|
|
117
117
|
drain(this.agentIdentifier, this.featureName, true);
|
|
@@ -18,12 +18,12 @@ export function lazyFeatureLoader(featureName, featurePart) {
|
|
|
18
18
|
return import( /* webpackChunkName: "ajax-aggregate" */'../ajax/aggregate');
|
|
19
19
|
case FEATURE_NAMES.jserrors:
|
|
20
20
|
return import( /* webpackChunkName: "jserrors-aggregate" */'../jserrors/aggregate');
|
|
21
|
+
case FEATURE_NAMES.genericEvents:
|
|
22
|
+
return import( /* webpackChunkName: "generic_events-aggregate" */'../generic_events/aggregate');
|
|
21
23
|
case FEATURE_NAMES.logging:
|
|
22
24
|
return import( /* webpackChunkName: "logging-aggregate" */'../logging/aggregate');
|
|
23
25
|
case FEATURE_NAMES.metrics:
|
|
24
26
|
return import( /* webpackChunkName: "metrics-aggregate" */'../metrics/aggregate');
|
|
25
|
-
case FEATURE_NAMES.pageAction:
|
|
26
|
-
return import( /* webpackChunkName: "page_action-aggregate" */'../page_action/aggregate');
|
|
27
27
|
case FEATURE_NAMES.pageViewEvent:
|
|
28
28
|
return import( /* webpackChunkName: "page_view_event-aggregate" */'../page_view_event/aggregate');
|
|
29
29
|
case FEATURE_NAMES.pageViewTiming:
|
package/dist/esm/index.js
CHANGED
|
@@ -3,9 +3,12 @@ export { BrowserAgent } from './loaders/browser-agent';
|
|
|
3
3
|
export { MicroAgent } from './loaders/micro-agent';
|
|
4
4
|
export { Ajax } from './features/ajax';
|
|
5
5
|
export { JSErrors } from './features/jserrors';
|
|
6
|
+
export { GenericEvents } from './features/generic_events';
|
|
7
|
+
export { Logging } from './features/logging';
|
|
6
8
|
export { Metrics } from './features/metrics';
|
|
7
9
|
export { PageAction } from './features/page_action';
|
|
8
10
|
export { PageViewEvent } from './features/page_view_event';
|
|
9
11
|
export { PageViewTiming } from './features/page_view_timing';
|
|
10
12
|
export { SessionTrace } from './features/session_trace';
|
|
13
|
+
export { SessionReplay } from './features/session_replay';
|
|
11
14
|
export { Spa } from './features/spa';
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { warn } from '../common/util/console';
|
|
4
4
|
import { SR_EVENT_EMITTER_TYPES } from '../features/session_replay/constants';
|
|
5
5
|
import { generateRandomHexString } from '../common/ids/unique-id';
|
|
6
|
-
import { ee } from '../common/event-emitter/contextual-ee';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* @typedef {import('./api/interaction-types').InteractionInstance} InteractionInstance
|
|
@@ -14,9 +13,6 @@ export class AgentBase {
|
|
|
14
13
|
constructor() {
|
|
15
14
|
let agentIdentifier = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : generateRandomHexString(16);
|
|
16
15
|
this.agentIdentifier = agentIdentifier;
|
|
17
|
-
|
|
18
|
-
// Assign the observation context to the event emitter, so it knows how to create observation contexts
|
|
19
|
-
this.ee = ee.get(agentIdentifier);
|
|
20
16
|
}
|
|
21
17
|
|
|
22
18
|
/**
|
|
@@ -28,7 +24,7 @@ export class AgentBase {
|
|
|
28
24
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
29
25
|
args[_key - 1] = arguments[_key];
|
|
30
26
|
}
|
|
31
|
-
if (typeof this.api?.[methodName] !== 'function') warn(
|
|
27
|
+
if (typeof this.api?.[methodName] !== 'function') warn(35, methodName);else return this.api[methodName](...args);
|
|
32
28
|
}
|
|
33
29
|
|
|
34
30
|
/**
|