@newrelic/browser-agent 1.260.1 → 1.261.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 +19 -0
- package/dist/cjs/cdn/experimental.js +2 -1
- package/dist/cjs/cdn/polyfills/pro.js +2 -1
- package/dist/cjs/cdn/polyfills/spa.js +2 -1
- package/dist/cjs/cdn/pro.js +2 -1
- package/dist/cjs/cdn/spa.js +2 -1
- package/dist/cjs/common/config/state/init.js +31 -24
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/deny-list/deny-list.js +1 -1
- package/dist/cjs/common/harvest/harvest-scheduler.js +1 -1
- package/dist/cjs/common/harvest/harvest.js +1 -1
- package/dist/cjs/common/session/session-entity.js +7 -1
- package/dist/cjs/common/wrap/wrap-logger.js +54 -0
- package/dist/cjs/features/ajax/aggregate/index.js +1 -1
- package/dist/cjs/features/logging/aggregate/index.js +102 -0
- package/dist/cjs/features/logging/constants.js +20 -0
- package/dist/cjs/features/logging/index.js +12 -0
- package/dist/cjs/features/logging/instrument/index.js +28 -0
- package/dist/cjs/features/logging/shared/log.js +39 -0
- package/dist/cjs/features/logging/shared/utils.js +50 -0
- package/dist/cjs/features/page_view_event/aggregate/index.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 +1 -2
- package/dist/cjs/features/session_replay/aggregate/index.js +4 -3
- package/dist/cjs/features/session_replay/instrument/index.js +1 -1
- package/dist/cjs/features/session_trace/aggregate/index.js +15 -8
- package/dist/cjs/features/session_trace/instrument/index.js +1 -1
- package/dist/cjs/features/spa/aggregate/index.js +2 -2
- package/dist/cjs/features/spa/instrument/index.js +1 -1
- package/dist/cjs/features/utils/instrument-base.js +1 -1
- package/dist/cjs/features/utils/lazy-feature-loader.js +3 -1
- package/dist/cjs/loaders/agent-base.js +23 -2
- package/dist/cjs/loaders/api/api-methods.js +1 -1
- package/dist/cjs/loaders/api/api.js +29 -2
- package/dist/cjs/loaders/features/features.js +7 -5
- package/dist/cjs/loaders/micro-agent.js +1 -1
- package/dist/esm/cdn/experimental.js +2 -1
- package/dist/esm/cdn/polyfills/pro.js +2 -1
- package/dist/esm/cdn/polyfills/spa.js +2 -1
- package/dist/esm/cdn/pro.js +2 -1
- package/dist/esm/cdn/spa.js +2 -1
- package/dist/esm/common/config/state/init.js +30 -23
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/deny-list/deny-list.js +1 -1
- package/dist/esm/common/session/session-entity.js +8 -2
- package/dist/esm/common/wrap/wrap-logger.js +48 -0
- package/dist/esm/features/logging/aggregate/index.js +95 -0
- package/dist/esm/features/logging/constants.js +14 -0
- package/dist/esm/features/logging/index.js +1 -0
- package/dist/esm/features/logging/instrument/index.js +21 -0
- package/dist/esm/features/logging/shared/log.js +32 -0
- package/dist/esm/features/logging/shared/utils.js +44 -0
- package/dist/esm/features/page_view_timing/aggregate/index.js +1 -2
- package/dist/esm/features/session_replay/aggregate/index.js +3 -2
- package/dist/esm/features/session_trace/aggregate/index.js +15 -8
- package/dist/esm/features/spa/aggregate/index.js +1 -1
- package/dist/esm/features/utils/lazy-feature-loader.js +2 -0
- package/dist/esm/loaders/agent-base.js +23 -2
- package/dist/esm/loaders/api/api-methods.js +1 -1
- package/dist/esm/loaders/api/api.js +28 -1
- package/dist/esm/loaders/features/features.js +7 -5
- package/dist/types/common/config/state/init.d.ts.map +1 -1
- package/dist/types/common/drain/drain.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest.d.ts +5 -5
- package/dist/types/common/harvest/types.d.ts +2 -2
- package/dist/types/common/harvest/types.d.ts.map +1 -1
- package/dist/types/common/ids/id.d.ts.map +1 -1
- package/dist/types/common/ids/unique-id.d.ts.map +1 -1
- package/dist/types/common/session/session-entity.d.ts.map +1 -1
- package/dist/types/common/util/console.d.ts.map +1 -1
- package/dist/types/common/util/data-size.d.ts.map +1 -1
- package/dist/types/common/util/feature-flags.d.ts.map +1 -1
- package/dist/types/common/util/get-or-set.d.ts.map +1 -1
- package/dist/types/common/util/invoke.d.ts.map +1 -1
- package/dist/types/common/util/stringify.d.ts.map +1 -1
- package/dist/types/common/util/submit-data.d.ts.map +1 -1
- package/dist/types/common/util/type-check.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-logger.d.ts +17 -0
- package/dist/types/common/wrap/wrap-logger.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts +1 -1
- package/dist/types/features/logging/aggregate/index.d.ts +40 -0
- package/dist/types/features/logging/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/logging/constants.d.ts +14 -0
- package/dist/types/features/logging/constants.d.ts.map +1 -0
- package/dist/types/features/logging/index.d.ts +2 -0
- package/dist/types/features/logging/index.d.ts.map +1 -0
- package/dist/types/features/logging/instrument/index.d.ts +6 -0
- package/dist/types/features/logging/instrument/index.d.ts.map +1 -0
- package/dist/types/features/logging/shared/log.d.ts +18 -0
- package/dist/types/features/logging/shared/log.d.ts.map +1 -0
- package/dist/types/features/logging/shared/utils.d.ts +16 -0
- package/dist/types/features/logging/shared/utils.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts +1 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/shared/recorder.d.ts.map +1 -1
- package/dist/types/features/session_trace/aggregate/index.d.ts +7 -4
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/utils/feature-base.d.ts +1 -1
- package/dist/types/features/utils/feature-base.d.ts.map +1 -1
- package/dist/types/features/utils/instrument-base.d.ts +2 -2
- package/dist/types/features/utils/lazy-feature-loader.d.ts.map +1 -1
- package/dist/types/loaders/agent-base.d.ts +25 -4
- package/dist/types/loaders/agent-base.d.ts.map +1 -1
- package/dist/types/loaders/api/api.d.ts +8 -0
- package/dist/types/loaders/api/api.d.ts.map +1 -1
- package/dist/types/loaders/api/interaction-types.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/dist/types/loaders/micro-agent.d.ts.map +1 -1
- package/package.json +15 -28
- package/src/cdn/experimental.js +2 -0
- package/src/cdn/polyfills/pro.js +3 -1
- package/src/cdn/polyfills/spa.js +2 -0
- package/src/cdn/pro.js +3 -1
- package/src/cdn/spa.js +2 -0
- package/src/common/config/state/init.js +17 -15
- package/src/common/deny-list/deny-list.js +1 -1
- package/src/common/session/session-entity.js +7 -2
- package/src/common/wrap/wrap-logger.js +49 -0
- package/src/features/logging/aggregate/index.js +101 -0
- package/src/features/logging/constants.js +19 -0
- package/src/features/logging/index.js +1 -0
- package/src/features/logging/instrument/index.js +18 -0
- package/src/features/logging/shared/log.js +28 -0
- package/src/features/logging/shared/utils.js +43 -0
- package/src/features/page_view_timing/aggregate/index.js +1 -2
- package/src/features/session_replay/aggregate/index.js +3 -3
- package/src/features/session_trace/aggregate/index.js +14 -8
- package/src/features/spa/aggregate/index.js +1 -1
- package/src/features/utils/lazy-feature-loader.js +2 -0
- package/src/loaders/agent-base.js +23 -2
- package/src/loaders/api/api-methods.js +1 -1
- package/src/loaders/api/api.js +19 -1
- package/src/loaders/features/features.js +7 -5
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @file Wraps native timeout and interval methods for instrumentation.
|
|
7
|
+
* This module is used by: jserrors, spa.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { ee as baseEE, contextId } from '../event-emitter/contextual-ee';
|
|
11
|
+
import { EventContext } from '../event-emitter/event-context';
|
|
12
|
+
import { createWrapperWithEmitter as wfn } from './wrap-function';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Wraps a supplied function and adds emitter events under the `-wrap-logger-` prefix
|
|
16
|
+
* @param {Object} sharedEE - The shared event emitter on which a new scoped event emitter will be based.
|
|
17
|
+
* @param {Object} parent - The parent object housing the logger function
|
|
18
|
+
* @param {string} loggerFn - The name of the function in the parent object to wrap
|
|
19
|
+
* @returns {Object} Scoped event emitter with a debug ID of `logger`.
|
|
20
|
+
*/
|
|
21
|
+
// eslint-disable-next-line
|
|
22
|
+
export function wrapLogger(sharedEE, parent, loggerFn, context) {
|
|
23
|
+
const ee = scopedEE(sharedEE);
|
|
24
|
+
const wrapFn = wfn(ee);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* This section contains the context that will be shared across all invoked calls of the wrapped function,
|
|
28
|
+
* which will be used to decorate the log data later at agg time
|
|
29
|
+
*/
|
|
30
|
+
const ctx = new EventContext(contextId);
|
|
31
|
+
ctx.level = context.level;
|
|
32
|
+
ctx.customAttributes = context.customAttributes;
|
|
33
|
+
|
|
34
|
+
/** observe calls to <loggerFn> and emit events prefixed with `wrap-logger-` */
|
|
35
|
+
wrapFn.inPlace(parent, [loggerFn], 'wrap-logger-', ctx);
|
|
36
|
+
return ee;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Returns an event emitter scoped specifically for the `logger` context. This scoping is a remnant from when all the
|
|
41
|
+
* features shared the same group in the event, to isolate events between features. It will likely be revisited.
|
|
42
|
+
* @param {Object} sharedEE - Optional event emitter on which to base the scoped emitter.
|
|
43
|
+
* Uses `ee` on the global scope if undefined).
|
|
44
|
+
* @returns {Object} Scoped event emitter with a debug ID of 'logger'.
|
|
45
|
+
*/
|
|
46
|
+
export function scopedEE(sharedEE) {
|
|
47
|
+
return (sharedEE || baseEE).get('logger');
|
|
48
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { getConfigurationValue, getInfo, getRuntime } from '../../../common/config/config';
|
|
2
|
+
import { handle } from '../../../common/event-emitter/handle';
|
|
3
|
+
import { registerHandler } from '../../../common/event-emitter/register-handler';
|
|
4
|
+
import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler';
|
|
5
|
+
import { warn } from '../../../common/util/console';
|
|
6
|
+
import { stringify } from '../../../common/util/stringify';
|
|
7
|
+
import { SUPPORTABILITY_METRIC_CHANNEL } from '../../metrics/constants';
|
|
8
|
+
import { AggregateBase } from '../../utils/aggregate-base';
|
|
9
|
+
import { FEATURE_NAME, LOGGING_EVENT_EMITTER_CHANNEL, LOGGING_IGNORED, MAX_PAYLOAD_SIZE } from '../constants';
|
|
10
|
+
import { Log } from '../shared/log';
|
|
11
|
+
export class Aggregate extends AggregateBase {
|
|
12
|
+
static featureName = FEATURE_NAME;
|
|
13
|
+
#agentRuntime;
|
|
14
|
+
#agentInfo;
|
|
15
|
+
constructor(agentIdentifier, aggregator) {
|
|
16
|
+
super(agentIdentifier, aggregator, FEATURE_NAME);
|
|
17
|
+
|
|
18
|
+
/** held logs before sending */
|
|
19
|
+
this.bufferedLogs = [];
|
|
20
|
+
/** held logs during sending, for retries */
|
|
21
|
+
this.outgoingLogs = [];
|
|
22
|
+
/** the estimated bytes of log data waiting to be sent -- triggers a harvest if adding a new log will exceed limit */
|
|
23
|
+
this.estimatedBytes = 0;
|
|
24
|
+
this.#agentRuntime = getRuntime(this.agentIdentifier);
|
|
25
|
+
this.#agentInfo = getInfo(this.agentIdentifier);
|
|
26
|
+
this.harvestTimeSeconds = getConfigurationValue(this.agentIdentifier, 'logging.harvestTimeSeconds');
|
|
27
|
+
this.waitForFlags([]).then(() => {
|
|
28
|
+
this.scheduler = new HarvestScheduler('browser/logs', {
|
|
29
|
+
onFinished: this.onHarvestFinished.bind(this),
|
|
30
|
+
retryDelay: this.harvestTimeSeconds,
|
|
31
|
+
getPayload: this.prepareHarvest.bind(this),
|
|
32
|
+
raw: true
|
|
33
|
+
}, this);
|
|
34
|
+
/** harvest immediately once started to purge pre-load logs collected */
|
|
35
|
+
this.scheduler.startTimer(this.harvestTimeSeconds, 0);
|
|
36
|
+
/** emitted by instrument class (wrapped loggers) or the api methods directly */
|
|
37
|
+
registerHandler(LOGGING_EVENT_EMITTER_CHANNEL, this.handleLog.bind(this), this.featureName, this.ee);
|
|
38
|
+
this.drain();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
handleLog(timestamp, message, attributes, level) {
|
|
42
|
+
if (this.blocked) return;
|
|
43
|
+
const log = new Log(this.#agentRuntime.timeKeeper.convertRelativeTimestamp(timestamp), message, attributes, level);
|
|
44
|
+
const logBytes = log.message.length + stringify(log.attributes).length + log.level.length + 10; // timestamp == 10 chars
|
|
45
|
+
if (logBytes > MAX_PAYLOAD_SIZE) {
|
|
46
|
+
handle(SUPPORTABILITY_METRIC_CHANNEL, ['Logging/Harvest/Failed/Seen', logBytes]);
|
|
47
|
+
return warn(LOGGING_IGNORED + '> ' + MAX_PAYLOAD_SIZE + ' bytes', log.message.slice(0, 25) + '...');
|
|
48
|
+
}
|
|
49
|
+
if (this.estimatedBytes + logBytes >= MAX_PAYLOAD_SIZE) {
|
|
50
|
+
handle(SUPPORTABILITY_METRIC_CHANNEL, ['Logging/Harvest/Early/Seen', this.estimatedBytes + logBytes]);
|
|
51
|
+
this.scheduler.runHarvest({});
|
|
52
|
+
}
|
|
53
|
+
this.estimatedBytes += logBytes;
|
|
54
|
+
this.bufferedLogs.push(log);
|
|
55
|
+
}
|
|
56
|
+
prepareHarvest() {
|
|
57
|
+
if (this.blocked || !(this.bufferedLogs.length || this.outgoingLogs.length)) return;
|
|
58
|
+
/** populate outgoing array while also clearing main buffer */
|
|
59
|
+
this.outgoingLogs.push(...this.bufferedLogs.splice(0));
|
|
60
|
+
this.estimatedBytes = 0;
|
|
61
|
+
/** see https://source.datanerd.us/agents/rum-specs/blob/main/browser/Log for logging spec */
|
|
62
|
+
return {
|
|
63
|
+
qs: {
|
|
64
|
+
browser_monitoring_key: this.#agentInfo.licenseKey
|
|
65
|
+
},
|
|
66
|
+
body: [{
|
|
67
|
+
common: {
|
|
68
|
+
/** Attributes in the `common` section are added to `all` logs generated in the payload */
|
|
69
|
+
attributes: {
|
|
70
|
+
'entity.guid': this.#agentRuntime.appMetadata?.agents?.[0]?.entityGuid,
|
|
71
|
+
// browser entity guid as provided from RUM response
|
|
72
|
+
session: this.#agentRuntime?.session?.state.value || '0',
|
|
73
|
+
// The session ID that we generate and keep across page loads
|
|
74
|
+
hasReplay: this.#agentRuntime?.session?.state.sessionReplayMode === 1,
|
|
75
|
+
// True if a session replay recording is running
|
|
76
|
+
hasTrace: this.#agentRuntime?.session?.state.sessionTraceMode === 1,
|
|
77
|
+
// True if a session trace recording is running
|
|
78
|
+
ptid: this.#agentRuntime.ptid,
|
|
79
|
+
// page trace id
|
|
80
|
+
appId: this.#agentInfo.applicationID,
|
|
81
|
+
// Application ID from info object,
|
|
82
|
+
standalone: Boolean(this.#agentInfo.sa),
|
|
83
|
+
// copy paste (true) vs APM (false)
|
|
84
|
+
agentVersion: this.#agentRuntime.version // browser agent version
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
/** logs section contains individual unique log entries */
|
|
88
|
+
logs: this.outgoingLogs
|
|
89
|
+
}]
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
onHarvestFinished(result) {
|
|
93
|
+
if (!result.retry) this.outgoingLogs = [];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FEATURE_NAMES } from '../../loaders/features/features';
|
|
2
|
+
export const LOG_LEVELS = {
|
|
3
|
+
ERROR: 'ERROR',
|
|
4
|
+
WARN: 'WARN',
|
|
5
|
+
INFO: 'INFO',
|
|
6
|
+
DEBUG: 'DEBUG',
|
|
7
|
+
TRACE: 'TRACE'
|
|
8
|
+
};
|
|
9
|
+
export const LOGGING_EVENT_EMITTER_CHANNEL = 'log';
|
|
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: ';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Instrument as Logging } from './instrument/index';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InstrumentBase } from '../../utils/instrument-base';
|
|
2
|
+
import { FEATURE_NAME } from '../constants';
|
|
3
|
+
import { bufferLog } from '../shared/utils';
|
|
4
|
+
export class Instrument extends InstrumentBase {
|
|
5
|
+
static featureName = FEATURE_NAME;
|
|
6
|
+
constructor(agentIdentifier, aggregator) {
|
|
7
|
+
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
8
|
+
super(agentIdentifier, aggregator, FEATURE_NAME, auto);
|
|
9
|
+
const instanceEE = this.ee;
|
|
10
|
+
/** emitted by wrap-logger function */
|
|
11
|
+
this.ee.on('wrap-logger-end', function handleLog(_ref) {
|
|
12
|
+
let [message] = _ref;
|
|
13
|
+
const {
|
|
14
|
+
level,
|
|
15
|
+
customAttributes
|
|
16
|
+
} = this;
|
|
17
|
+
bufferLog(instanceEE, message, customAttributes, level);
|
|
18
|
+
});
|
|
19
|
+
this.importAggregator();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { globalScope } from '../../../common/constants/runtime';
|
|
2
|
+
import { cleanURL } from '../../../common/url/clean-url';
|
|
3
|
+
import { LOG_LEVELS } from '../constants';
|
|
4
|
+
export class Log {
|
|
5
|
+
/** @type {long} the unix timestamp of the log event */
|
|
6
|
+
timestamp;
|
|
7
|
+
/** @type {string} the log message */
|
|
8
|
+
message;
|
|
9
|
+
/** @type {object} the object of attributes to be parsed by logging ingest into top-level properties */
|
|
10
|
+
attributes;
|
|
11
|
+
/** @type {'ERROR'|'TRACE'|'DEBUG'|'INFO'|'WARN'} the log type of the log */
|
|
12
|
+
level;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {number} timestamp - Unix timestamp
|
|
16
|
+
* @param {string} message - message string
|
|
17
|
+
* @param {object} attributes - other log event attributes
|
|
18
|
+
* @param {enum} level - Log level
|
|
19
|
+
*/
|
|
20
|
+
constructor(timestamp, message) {
|
|
21
|
+
let attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
22
|
+
let level = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : LOG_LEVELS.INFO;
|
|
23
|
+
/** @type {long} */
|
|
24
|
+
this.timestamp = timestamp;
|
|
25
|
+
this.message = message;
|
|
26
|
+
this.attributes = {
|
|
27
|
+
...attributes,
|
|
28
|
+
pageUrl: cleanURL('' + globalScope.location)
|
|
29
|
+
};
|
|
30
|
+
this.level = level.toUpperCase();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { handle } from '../../../common/event-emitter/handle';
|
|
2
|
+
import { now } from '../../../common/timing/now';
|
|
3
|
+
import { warn } from '../../../common/util/console';
|
|
4
|
+
import { stringify } from '../../../common/util/stringify';
|
|
5
|
+
import { FEATURE_NAMES } from '../../../loaders/features/features';
|
|
6
|
+
import { SUPPORTABILITY_METRIC_CHANNEL } from '../../metrics/constants';
|
|
7
|
+
import { LOGGING_EVENT_EMITTER_CHANNEL, LOG_LEVELS } from '../constants';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @param {ContextualEE} ee - The contextual ee tied to the instance
|
|
11
|
+
* @param {string} message - the log message string
|
|
12
|
+
* @param {{[key: string]: *}} customAttributes - The log's custom attributes if any
|
|
13
|
+
* @param {enum} level - the log level enum
|
|
14
|
+
*/
|
|
15
|
+
export function bufferLog(ee, message) {
|
|
16
|
+
let customAttributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
17
|
+
let level = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : LOG_LEVELS.INFO;
|
|
18
|
+
try {
|
|
19
|
+
if (typeof message !== 'string') {
|
|
20
|
+
const stringified = stringify(message);
|
|
21
|
+
/**
|
|
22
|
+
* Error instances convert to `{}` when stringified
|
|
23
|
+
* Symbol converts to '' when stringified
|
|
24
|
+
* other cases tbd
|
|
25
|
+
* */
|
|
26
|
+
if (!!stringified && stringified !== '{}') message = stringified;else message = String(message);
|
|
27
|
+
}
|
|
28
|
+
} catch (err) {
|
|
29
|
+
warn('could not cast log message to string', message);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
handle(SUPPORTABILITY_METRIC_CHANNEL, ["API/logging/".concat(level.toLowerCase(), "/called")], undefined, FEATURE_NAMES.metrics, ee);
|
|
33
|
+
handle(LOGGING_EVENT_EMITTER_CHANNEL, [now(), message, customAttributes, level], undefined, FEATURE_NAMES.logging, ee);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Checks if a supplied log level is acceptable for use in generating a log event
|
|
38
|
+
* @param {string} level
|
|
39
|
+
* @returns {boolean}
|
|
40
|
+
*/
|
|
41
|
+
export function isValidLogLevel(level) {
|
|
42
|
+
if (typeof level !== 'string') return false;
|
|
43
|
+
return Object.values(LOG_LEVELS).some(logLevel => logLevel.toUpperCase() === level.toUpperCase());
|
|
44
|
+
}
|
|
@@ -42,7 +42,6 @@ export class Aggregate extends AggregateBase {
|
|
|
42
42
|
if (getConfigurationValue(this.agentIdentifier, 'page_view_timing.long_task') === true) longTask.subscribe(this.#handleVitalMetric);
|
|
43
43
|
registerHandler('docHidden', msTimestamp => this.endCurrentSession(msTimestamp), this.featureName, this.ee);
|
|
44
44
|
registerHandler('winPagehide', msTimestamp => this.recordPageUnload(msTimestamp), this.featureName, this.ee);
|
|
45
|
-
const initialHarvestSeconds = getConfigurationValue(this.agentIdentifier, 'page_view_timing.initialHarvestSeconds') || 10;
|
|
46
45
|
const harvestTimeSeconds = getConfigurationValue(this.agentIdentifier, 'page_view_timing.harvestTimeSeconds') || 30;
|
|
47
46
|
this.waitForFlags([]).then(() => {
|
|
48
47
|
/* It's important that CWV api, like "onLCP", is called before the **scheduler** is initialized. The reason is because they listen to the same
|
|
@@ -79,7 +78,7 @@ export class Aggregate extends AggregateBase {
|
|
|
79
78
|
return _this.prepareHarvest(...arguments);
|
|
80
79
|
}
|
|
81
80
|
}, this);
|
|
82
|
-
scheduler.startTimer(harvestTimeSeconds
|
|
81
|
+
scheduler.startTimer(harvestTimeSeconds);
|
|
83
82
|
this.drain();
|
|
84
83
|
});
|
|
85
84
|
}
|
|
@@ -298,7 +298,7 @@ export class Aggregate extends AggregateBase {
|
|
|
298
298
|
this.scheduler.opts.gzip = false;
|
|
299
299
|
}
|
|
300
300
|
if (len > MAX_PAYLOAD_SIZE) {
|
|
301
|
-
this.abort(ABORT_REASONS.TOO_BIG);
|
|
301
|
+
this.abort(ABORT_REASONS.TOO_BIG, len);
|
|
302
302
|
return;
|
|
303
303
|
}
|
|
304
304
|
// TODO -- Gracefully handle the buffer for retries.
|
|
@@ -415,8 +415,9 @@ export class Aggregate extends AggregateBase {
|
|
|
415
415
|
/** Abort the feature, once aborted it will not resume */
|
|
416
416
|
abort() {
|
|
417
417
|
let reason = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
418
|
+
let data = arguments.length > 1 ? arguments[1] : undefined;
|
|
418
419
|
warn("SR aborted -- ".concat(reason.message));
|
|
419
|
-
handle(SUPPORTABILITY_METRIC_CHANNEL, ["SessionReplay/Abort/".concat(reason.sm)], undefined, FEATURE_NAMES.metrics, this.ee);
|
|
420
|
+
handle(SUPPORTABILITY_METRIC_CHANNEL, ["SessionReplay/Abort/".concat(reason.sm), data], undefined, FEATURE_NAMES.metrics, this.ee);
|
|
420
421
|
this.blocked = true;
|
|
421
422
|
this.mode = MODE.OFF;
|
|
422
423
|
this.recorder?.stopRecording?.();
|
|
@@ -42,22 +42,30 @@ export class Aggregate extends AggregateBase {
|
|
|
42
42
|
this.entitled ??= stEntitled;
|
|
43
43
|
if (this.blocked || !this.entitled) return deregisterDrain(this.agentIdentifier, this.featureName);
|
|
44
44
|
if (!this.initialized) {
|
|
45
|
+
this.initialized = true;
|
|
46
|
+
/** Store session identifiers at initialization time to be cross-checked later at harvest time for session changes that are subject to race conditions */
|
|
47
|
+
this.ptid = this.agentRuntime.ptid;
|
|
48
|
+
this.sessionId = this.agentRuntime.session?.state.value;
|
|
45
49
|
// The SessionEntity class can emit a message indicating the session was cleared and reset (expiry, inactivity). This feature must abort and never resume if that occurs.
|
|
46
50
|
this.ee.on(SESSION_EVENTS.RESET, () => {
|
|
47
|
-
this.
|
|
51
|
+
if (this.blocked) return;
|
|
52
|
+
this.abort(1);
|
|
48
53
|
});
|
|
49
54
|
// The SessionEntity can have updates (locally or across tabs for SR mode changes), (across tabs for ST mode changes).
|
|
50
55
|
// Those updates should be sync'd here to ensure this page also honors the mode after initialization
|
|
51
56
|
this.ee.on(SESSION_EVENTS.UPDATE, (eventType, sessionState) => {
|
|
57
|
+
if (this.blocked) return;
|
|
52
58
|
// this will only have an effect if ST is NOT already in full mode
|
|
53
59
|
if (this.mode !== MODE.FULL && (sessionState.sessionReplayMode === MODE.FULL || sessionState.sessionTraceMode === MODE.FULL)) this.switchToFull();
|
|
60
|
+
// if another page's session entity has expired, or another page has transitioned to off and this one hasn't... we can just abort straight away here
|
|
61
|
+
if (this.sessionId !== sessionState.value || eventType === 'cross-tab' && this.scheduler?.started && sessionState.sessionTraceMode === MODE.OFF) this.abort(2);
|
|
54
62
|
});
|
|
55
63
|
}
|
|
56
64
|
|
|
57
65
|
/** ST/SR sampling flow in BCS - https://drive.google.com/file/d/19hwt2oft-8Hh4RrjpLqEXfpP_9wYBLcq/view?usp=sharing */
|
|
58
66
|
/** ST will run in the mode provided by BCS if the session IS NEW. If not... it will use the state of the session entity to determine what mode to run in */
|
|
59
67
|
if (!this.agentRuntime.session.isNew && !ignoreSession) this.mode = this.agentRuntime.session.state.sessionTraceMode;else this.mode = stMode;
|
|
60
|
-
|
|
68
|
+
|
|
61
69
|
/** If the mode is off, we do not want to hold up draining for other features, so we deregister the feature for now.
|
|
62
70
|
* If it drains later (due to a mode change), data and handlers will instantly drain instead of waiting for the registry. */
|
|
63
71
|
if (this.mode === MODE.OFF) return deregisterDrain(this.agentIdentifier, this.featureName);
|
|
@@ -122,9 +130,8 @@ export class Aggregate extends AggregateBase {
|
|
|
122
130
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
123
131
|
this.traceStorage.prevStoredEvents.clear(); // release references to past events for GC
|
|
124
132
|
if (!this.timeKeeper?.ready) return; // this should likely never happen, but just to be safe, we should never harvest if we cant correct time
|
|
125
|
-
if (this.mode
|
|
126
|
-
if (this.
|
|
127
|
-
|
|
133
|
+
if (this.blocked || this.mode !== MODE.FULL || this.traceStorage.nodeCount === 0) return;
|
|
134
|
+
if (this.sessionId !== this.agentRuntime.session?.state.value || this.ptid !== this.agentRuntime.ptid) return this.abort(3); // if something unexpected happened and we somehow still got to the point of harvesting after a session identifier changed, we should force-exit instead of harvesting
|
|
128
135
|
/** Get the ST nodes from the traceStorage buffer. This also returns helpful metadata about the payload. */
|
|
129
136
|
const {
|
|
130
137
|
stns,
|
|
@@ -180,8 +187,8 @@ export class Aggregate extends AggregateBase {
|
|
|
180
187
|
...(hasReplay && {
|
|
181
188
|
hasReplay
|
|
182
189
|
}),
|
|
183
|
-
ptid: "".concat(this.
|
|
184
|
-
session: "".concat(this.
|
|
190
|
+
ptid: "".concat(this.ptid),
|
|
191
|
+
session: "".concat(this.sessionId),
|
|
185
192
|
// customer-defined data should go last so that if it exceeds the query param padding limit it will be truncated instead of important attrs
|
|
186
193
|
...(endUserId && {
|
|
187
194
|
'enduser.id': endUserId
|
|
@@ -223,7 +230,7 @@ export class Aggregate extends AggregateBase {
|
|
|
223
230
|
}
|
|
224
231
|
|
|
225
232
|
/** Stop running for the remainder of the page lifecycle */
|
|
226
|
-
abort() {
|
|
233
|
+
abort(reason) {
|
|
227
234
|
this.blocked = true;
|
|
228
235
|
this.mode = MODE.OFF;
|
|
229
236
|
this.agentRuntime.session.write({
|
|
@@ -536,7 +536,7 @@ export class Aggregate extends AggregateBase {
|
|
|
536
536
|
var interaction = this.ixn;
|
|
537
537
|
var node = activeNodeFor(interaction);
|
|
538
538
|
setCurrentNode(null);
|
|
539
|
-
node.child('customEnd', timestamp)
|
|
539
|
+
node.child('customEnd', timestamp)?.finish(timestamp);
|
|
540
540
|
interaction.finish();
|
|
541
541
|
}, this.featureName, baseEE);
|
|
542
542
|
register(INTERACTION_API + 'ignore', function (t) {
|
|
@@ -18,6 +18,8 @@ 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.logging:
|
|
22
|
+
return import( /* webpackChunkName: "logging-aggregate" */'../logging/aggregate');
|
|
21
23
|
case FEATURE_NAMES.metrics:
|
|
22
24
|
return import( /* webpackChunkName: "metrics-aggregate" */'../metrics/aggregate');
|
|
23
25
|
case FEATURE_NAMES.pageAction:
|
|
@@ -55,8 +55,8 @@ export class AgentBase {
|
|
|
55
55
|
* Adds a user-defined attribute name and value to subsequent events on the page.
|
|
56
56
|
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/setcustomattribute/}
|
|
57
57
|
* @param {string} name Name of the attribute. Appears as column in the PageView event. It will also appear as a column in the PageAction event if you are using it.
|
|
58
|
-
* @param {string|number|null} value Value of the attribute. Appears as the value in the named attribute column in the PageView event. It will appear as a column in the PageAction event if you are using it. Custom attribute values cannot be complex objects, only simple types such as Strings and
|
|
59
|
-
* @param {boolean} [persist] Default false.
|
|
58
|
+
* @param {string|number|boolean|null} value Value of the attribute. Appears as the value in the named attribute column in the PageView event. It will appear as a column in the PageAction event if you are using it. Custom attribute values cannot be complex objects, only simple types such as Strings, Integers and Booleans. Passing a null value unsets any existing attribute of the same name.
|
|
59
|
+
* @param {boolean} [persist] Default false. If set to true, the name-value pair will also be set into the browser's storage API. Then on the following instrumented pages that load within the same session, the pair will be re-applied as a custom attribute.
|
|
60
60
|
*/
|
|
61
61
|
setCustomAttribute(name, value, persist) {
|
|
62
62
|
return this.#callMethod('setCustomAttribute', name, value, persist);
|
|
@@ -183,4 +183,25 @@ export class AgentBase {
|
|
|
183
183
|
interaction() {
|
|
184
184
|
return this.#callMethod('interaction');
|
|
185
185
|
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Capture a single log.
|
|
189
|
+
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/loginfo/}
|
|
190
|
+
* @param {string} message String to be captured as log message
|
|
191
|
+
* @param {{customAttributes?: object, level?: 'ERROR'|'TRACE'|'DEBUG'|'INFO'|'WARN'}} [options] customAttributes defaults to `{}` if not assigned, level defaults to `info` if not assigned.
|
|
192
|
+
*/
|
|
193
|
+
log(message, options) {
|
|
194
|
+
return this.#callMethod('logInfo', message, options);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Wrap a logger function to capture a log each time the function is invoked with the message and arguments passed
|
|
199
|
+
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/wraplogger/}
|
|
200
|
+
* @param {object} parent The parent object containing the logger method
|
|
201
|
+
* @param {string} functionName The property name of the function in the parent object to be wrapped
|
|
202
|
+
* @param {{customAttributes?: object, level?: 'ERROR'|'TRACE'|'DEBUG'|'INFO'|'WARN'}} [options] customAttributes defaults to `{}` if not assigned, level defaults to `info` if not assigned.
|
|
203
|
+
*/
|
|
204
|
+
wrapLogger(parent, functionName, options) {
|
|
205
|
+
return this.#callMethod('wrapLogger', parent, functionName, options);
|
|
206
|
+
}
|
|
186
207
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SR_EVENT_EMITTER_TYPES } from '../../features/session_replay/constants';
|
|
2
|
-
export const apiMethods = ['setErrorHandler', 'finished', 'addToTrace', 'addRelease', 'addPageAction', 'setCurrentRouteName', 'setPageViewName', 'setCustomAttribute', 'interaction', 'noticeError', 'setUserId', 'setApplicationVersion', 'start', SR_EVENT_EMITTER_TYPES.RECORD, SR_EVENT_EMITTER_TYPES.PAUSE];
|
|
2
|
+
export const apiMethods = ['setErrorHandler', 'finished', 'addToTrace', 'addRelease', 'addPageAction', 'setCurrentRouteName', 'setPageViewName', 'setCustomAttribute', 'interaction', 'noticeError', 'setUserId', 'setApplicationVersion', 'start', SR_EVENT_EMITTER_TYPES.RECORD, SR_EVENT_EMITTER_TYPES.PAUSE, 'log', 'wrapLogger'];
|
|
3
3
|
export const asyncApiMethods = ['setErrorHandler', 'finished', 'addToTrace', 'addRelease'];
|
|
@@ -16,6 +16,9 @@ import { apiMethods, asyncApiMethods } from './api-methods';
|
|
|
16
16
|
import { SR_EVENT_EMITTER_TYPES } from '../../features/session_replay/constants';
|
|
17
17
|
import { now } from '../../common/timing/now';
|
|
18
18
|
import { MODE } from '../../common/session/constants';
|
|
19
|
+
import { LOGGING_FAILURE_MESSAGE, LOGGING_IGNORED, LOGGING_LEVEL_FAILURE_MESSAGE, LOG_LEVELS, MAX_PAYLOAD_SIZE } from '../../features/logging/constants';
|
|
20
|
+
import { bufferLog, isValidLogLevel } from '../../features/logging/shared/utils';
|
|
21
|
+
import { wrapLogger } from '../../common/wrap/wrap-logger';
|
|
19
22
|
export function setTopLevelCallers() {
|
|
20
23
|
const nr = gosCDN();
|
|
21
24
|
apiMethods.forEach(f => {
|
|
@@ -52,6 +55,30 @@ export function setAPI(agentIdentifier, forceDrain) {
|
|
|
52
55
|
});
|
|
53
56
|
var prefix = 'api-';
|
|
54
57
|
var spaPrefix = prefix + 'ixn-';
|
|
58
|
+
apiInterface.log = function (message) {
|
|
59
|
+
let {
|
|
60
|
+
customAttributes = {},
|
|
61
|
+
level = LOG_LEVELS.INFO
|
|
62
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
63
|
+
if (!customAttributes || typeof customAttributes !== 'object') customAttributes = {};
|
|
64
|
+
if (typeof message !== 'string' || !message) return warn(LOGGING_IGNORED + 'invalid message');
|
|
65
|
+
if (!isValidLogLevel(level)) return warn(LOGGING_LEVEL_FAILURE_MESSAGE + level, LOG_LEVELS);
|
|
66
|
+
if (message.length > MAX_PAYLOAD_SIZE) return warn(LOGGING_IGNORED + '> ' + MAX_PAYLOAD_SIZE + ' bytes: ', message.slice(0, 25) + '...');
|
|
67
|
+
bufferLog(instanceEE, message, customAttributes, level.toUpperCase());
|
|
68
|
+
};
|
|
69
|
+
apiInterface.wrapLogger = function (parent, functionName) {
|
|
70
|
+
let {
|
|
71
|
+
customAttributes = {},
|
|
72
|
+
level = LOG_LEVELS.INFO
|
|
73
|
+
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
74
|
+
if (!customAttributes || typeof customAttributes !== 'object') customAttributes = {};
|
|
75
|
+
if (!(typeof parent === 'object' && !!parent && typeof functionName === 'string' && !!functionName && typeof parent[functionName] === 'function' && typeof customAttributes === 'object')) return warn(LOGGING_FAILURE_MESSAGE + 'invalid argument(s)');
|
|
76
|
+
if (!isValidLogLevel(level)) return warn(LOGGING_FAILURE_MESSAGE + LOGGING_LEVEL_FAILURE_MESSAGE + level, LOG_LEVELS);
|
|
77
|
+
wrapLogger(instanceEE, parent, functionName, {
|
|
78
|
+
customAttributes,
|
|
79
|
+
level: level.toUpperCase()
|
|
80
|
+
});
|
|
81
|
+
};
|
|
55
82
|
|
|
56
83
|
// Setup stub functions that queue calls for later processing.
|
|
57
84
|
asyncApiMethods.forEach(fnName => {
|
|
@@ -68,7 +95,7 @@ export function setAPI(agentIdentifier, forceDrain) {
|
|
|
68
95
|
/**
|
|
69
96
|
* Attach the key-value attribute onto agent payloads. All browser events in NR will be affected.
|
|
70
97
|
* @param {string} key
|
|
71
|
-
* @param {string|number|null} value - null indicates the key should be removed or erased
|
|
98
|
+
* @param {string|number|boolean|null} value - null indicates the key should be removed or erased
|
|
72
99
|
* @param {string} apiName
|
|
73
100
|
* @param {boolean} addToBrowserStorage - whether this attribute should be stored in browser storage API and retrieved by the next agent context or initialization
|
|
74
101
|
* @returns @see apiCall
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const FEATURE_NAMES = {
|
|
2
2
|
ajax: 'ajax',
|
|
3
3
|
jserrors: 'jserrors',
|
|
4
|
+
logging: 'logging',
|
|
4
5
|
metrics: 'metrics',
|
|
5
6
|
pageAction: 'page_action',
|
|
6
7
|
pageViewEvent: 'page_view_event',
|
|
@@ -20,10 +21,11 @@ export const featurePriority = {
|
|
|
20
21
|
[FEATURE_NAMES.pageViewTiming]: 2,
|
|
21
22
|
[FEATURE_NAMES.metrics]: 3,
|
|
22
23
|
[FEATURE_NAMES.jserrors]: 4,
|
|
23
|
-
[FEATURE_NAMES.
|
|
24
|
-
[FEATURE_NAMES.
|
|
25
|
-
[FEATURE_NAMES.
|
|
26
|
-
[FEATURE_NAMES.
|
|
24
|
+
[FEATURE_NAMES.spa]: 5,
|
|
25
|
+
[FEATURE_NAMES.ajax]: 6,
|
|
26
|
+
[FEATURE_NAMES.sessionTrace]: 7,
|
|
27
|
+
[FEATURE_NAMES.pageAction]: 8,
|
|
27
28
|
[FEATURE_NAMES.softNav]: 9,
|
|
28
|
-
[FEATURE_NAMES.sessionReplay]: 10
|
|
29
|
+
[FEATURE_NAMES.sessionReplay]: 10,
|
|
30
|
+
[FEATURE_NAMES.logging]: 11
|
|
29
31
|
};
|
|
@@ -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":"AAgHA,+CAIC;AAED,0DAKC;AAED,+DAYC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drain.d.ts","sourceRoot":"","sources":["../../../../src/common/drain/drain.js"],"names":[],"mappings":"AAYA;;;;;;;GAOG;AACH,+CAHW,MAAM,SACN,MAAM,QAQhB;AAED;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"drain.d.ts","sourceRoot":"","sources":["../../../../src/common/drain/drain.js"],"names":[],"mappings":"AAYA;;;;;;;GAOG;AACH,+CAHW,MAAM,SACN,MAAM,QAQhB;AAED;;;;GAIG;AACH,iDAHW,GAAC,SACD,GAAC,QAMX;AAYD;;;;;;GAMG;AACH,wCAJW,MAAM,gBACN,MAAM,UACN,OAAO,QAajB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harvest-scheduler.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest-scheduler.js"],"names":[],"mappings":"AAWA;;GAEG;AACH;IACE;;;;;;;;;;SAUK;IACL,sBATa,MAAM;
|
|
1
|
+
{"version":3,"file":"harvest-scheduler.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest-scheduler.js"],"names":[],"mappings":"AAWA;;GAEG;AACH;IACE;;;;;;;;;;SAUK;IACL,sBATa,MAAM,QAEd;QAAuB,UAAU;QACV,UAAU;QACZ,UAAU,EAAvB,MAAM;QACQ,GAAG,EAAjB,OAAO;QACM,SAAS,EAAtB,MAAM;KACd,UAAQ,GAAC,EAmBb;IAfC,iBAAwB;IACxB;;;oBARW,MAAM;aACN,OAAO;mBACP,MAAM;MAMK;IACtB,iBAAoB;IACpB,mBAAyB;IACzB,iBAAoB;IACpB,oBAAuB;IACvB,iBAA8C;IAWhD;;;OAGG;IACH,eAKC;IAED,mDAIC;IAHC,cAAwB;IAK1B,uCAMC;IAED,6CAUC;IAED,yCAgEC;IAED,gDAiBC;CACF;8BAhK6B,2BAA2B;wBACjC,WAAW"}
|
|
@@ -61,11 +61,11 @@ export class Harvest extends SharedContext {
|
|
|
61
61
|
*/
|
|
62
62
|
on(endpoint: HarvestEndpointIdentifier, listener: FeatureHarvestCallback): void;
|
|
63
63
|
}
|
|
64
|
-
export type NetworkSendSpec = import(
|
|
65
|
-
export type HarvestEndpointIdentifier = import(
|
|
66
|
-
export type HarvestPayload = import(
|
|
67
|
-
export type FeatureHarvestCallback = import(
|
|
68
|
-
export type FeatureHarvestCallbackOptions = import(
|
|
64
|
+
export type NetworkSendSpec = import("./types.js").NetworkSendSpec;
|
|
65
|
+
export type HarvestEndpointIdentifier = import("./types.js").HarvestEndpointIdentifier;
|
|
66
|
+
export type HarvestPayload = import("./types.js").HarvestPayload;
|
|
67
|
+
export type FeatureHarvestCallback = import("./types.js").FeatureHarvestCallback;
|
|
68
|
+
export type FeatureHarvestCallbackOptions = import("./types.js").FeatureHarvestCallbackOptions;
|
|
69
69
|
import { SharedContext } from '../context/shared-context';
|
|
70
70
|
import { Obfuscator } from '../util/obfuscate';
|
|
71
71
|
//# sourceMappingURL=harvest.d.ts.map
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
* @property {boolean} includeBaseParams Enables the use of base query parameters in the beacon url
|
|
39
39
|
*/
|
|
40
40
|
export const unused: {};
|
|
41
|
-
export type HarvestEndpointIdentifier =
|
|
41
|
+
export type HarvestEndpointIdentifier = "rum" | "jserrors" | "events" | "ins" | "resources" | "blob";
|
|
42
42
|
export type HarvestPayload = {
|
|
43
43
|
/**
|
|
44
44
|
* Map of values that should be sent as part of the request query string.
|
|
@@ -83,7 +83,7 @@ export type NetworkSendSpec = {
|
|
|
83
83
|
/**
|
|
84
84
|
* The network method to use {@link ../util/submit-data.js}
|
|
85
85
|
*/
|
|
86
|
-
submitMethod: import(
|
|
86
|
+
submitMethod: import("../util/submit-data.js").NetworkMethods;
|
|
87
87
|
/**
|
|
88
88
|
* Override the beacon url the data is sent to; must include protocol if defined
|
|
89
89
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/types.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AAEH;;;;;GAKG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;;GAcG;AAGH,wBAAwB;wCAvCX,KAAK,GAAC,UAAU,GAAC,QAAQ,GAAC,KAAK,GAAC,WAAW,GAAC,MAAM;;;;;QAKjD,MAAM
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/types.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AAEH;;;;;GAKG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;;GAcG;AAGH,wBAAwB;wCAvCX,KAAK,GAAC,UAAU,GAAC,QAAQ,GAAC,KAAK,GAAC,WAAW,GAAC,MAAM;;;;;QAKjD,MAAM;;;;UAEjB;QAAwB,CAAC,EAAd,MAAM;KACnB;;;;;;;;;;WAIa,OAAO;;+CAMV,6BAA6B,KAC3B,cAAc;;;;;cAKb,yBAAyB;;;;aACzB,cAAc;;;;UAEzB;QAAyB,YAAY,EAA1B,OAAO;QACO,MAAM,EAApB,OAAO;QACO,aAAa,EAA3B,OAAO;QACO,KAAK,EAAnB,OAAO;KAElB;;;;kBAAW,OAAO,wBAAwB,EAAE,cAAc;;;;eAC/C,MAAM;;;;SACN,OAAO;;;;uBACP,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../../../src/common/ids/id.js"],"names":[],"mappings":"AAaA;;;;;;;;;GASG;AACH,wBAHW,MAAM,
|
|
1
|
+
{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../../../src/common/ids/id.js"],"names":[],"mappings":"AAaA;;;;;;;;;GASG;AACH,wBAHW,MAAM,cAAU,KAAK,GACnB,MAAM,CAUlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unique-id.d.ts","sourceRoot":"","sources":["../../../../src/common/ids/unique-id.js"],"names":[],"mappings":"AAkCA;;;;GAIG;AACH,gCAFa,MAAM,CAwBlB;AAED;;;;;GAKG;AACH,
|
|
1
|
+
{"version":3,"file":"unique-id.d.ts","sourceRoot":"","sources":["../../../../src/common/ids/unique-id.js"],"names":[],"mappings":"AAkCA;;;;GAIG;AACH,gCAFa,MAAM,CAwBlB;AAED;;;;;GAKG;AACH,gDAHW,GAAG,GACD,MAAM,CAiBlB;AAED;;;;;GAKG;AACH,kCAFa,MAAM,CAIlB;AAED;;;;;GAKG;AACH,mCAFa,MAAM,CAIlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-entity.d.ts","sourceRoot":"","sources":["../../../../src/common/session/session-entity.js"],"names":[],"mappings":"AA8BA;IACE;;;;;OAKG;IACH,
|
|
1
|
+
{"version":3,"file":"session-entity.d.ts","sourceRoot":"","sources":["../../../../src/common/session/session-entity.js"],"names":[],"mappings":"AA8BA;IACE;;;;;OAKG;IACH,uBA+BC;IAzBC,qBAAsC;IACtC,aAAsB;IACtB,UAAe;IAGf,SAAc;IAEd,QAAiC;IAoBnC;;;;aA4EC;IAnEC,8BAA0B;IAC1B,+BAA4B;IAc1B,gCAOqC;IAUrC,4CAkBsC;IAexC,iCAAuB;IAKzB,wBAEC;IAED,sBAEC;IAED;;;OAGG;IACH,QAFa,MAAM,CA6BlB;IAED;;;;;;OAMG;IACH,YAHW,MAAM,GACJ,MAAM,CAkBlB;IAED,gBAuBC;IAED;;OAEG;IACH,gBAIC;IAED;;;OAGG;IACH,qBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;OAGG;IACH,gBAHW,MAAM,GACJ,OAAO,CAKnB;IAED,yDAUC;IAED,6DAIC;IAED;;;OAGG;IACH,6BAHW,MAAM,GACJ,MAAM,CAIlB;IAED,gDAaC;IAHG,YAAuD;CAI5D;sBA9SqB,gBAAgB;iCAGL,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../../src/common/util/console.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,8BAJW,MAAM,
|
|
1
|
+
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../../src/common/util/console.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,8BAJW,MAAM,cACN,GAAC,QAOX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-size.d.ts","sourceRoot":"","sources":["../../../../src/common/util/data-size.js"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,
|
|
1
|
+
{"version":3,"file":"data-size.d.ts","sourceRoot":"","sources":["../../../../src/common/util/data-size.js"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,+BAHW,GAAC,GACC,CAAC,MAAM,GAAC,SAAS,CAAC,CAe9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-flags.d.ts","sourceRoot":"","sources":["../../../../src/common/util/feature-flags.js"],"names":[],"mappings":"AAYA;;;;;;GAMG;AACH
|
|
1
|
+
{"version":3,"file":"feature-flags.d.ts","sourceRoot":"","sources":["../../../../src/common/util/feature-flags.js"],"names":[],"mappings":"AAYA;;;;;;GAMG;AACH,wCAJW;IAAC,CAAC,GAAG,EAAC,MAAM,GAAE,MAAM,CAAA;CAAC,mBACrB,MAAM,GACJ,IAAI,CAehB;AAvBD,gGAAgG;AAChG,mCAAmC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-or-set.d.ts","sourceRoot":"","sources":["../../../../src/common/util/get-or-set.js"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,8BALW,MAAM,QACN,MAAM,
|
|
1
|
+
{"version":3,"file":"get-or-set.d.ts","sourceRoot":"","sources":["../../../../src/common/util/get-or-set.js"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,8BALW,MAAM,QACN,MAAM,qBAEJ,GAAC,CA2Bb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../../../../src/common/util/invoke.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,mDATW,MAAM;
|
|
1
|
+
{"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../../../../src/common/util/invoke.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,mDATW,MAAM,YAGd;IAAyB,OAAO,EAAxB,OAAO;CAGf,YAiBF;AAED;;;;;;;GAOG;AACH,iDAQC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../../../../src/common/util/stringify.js"],"names":[],"mappings":"AAyBA;;;;;GAKG;AACH,
|
|
1
|
+
{"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../../../../src/common/util/stringify.js"],"names":[],"mappings":"AAyBA;;;;;GAKG;AACH,+BAHW,GAAC,GACC,MAAM,CAYlB"}
|