@newrelic/browser-agent 1.260.0 → 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 +26 -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/constants/runtime.js +2 -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/timing/time-keeper.js +2 -2
- 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 +16 -8
- package/dist/cjs/features/session_trace/aggregate/trace/storage.js +1 -1
- package/dist/cjs/features/session_trace/instrument/index.js +1 -1
- package/dist/cjs/features/soft_navigations/aggregate/bel-node.js +1 -2
- package/dist/cjs/features/soft_navigations/aggregate/index.js +1 -1
- package/dist/cjs/features/soft_navigations/aggregate/interaction.js +5 -4
- 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/constants/runtime.js +3 -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/timing/time-keeper.js +2 -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 +16 -8
- package/dist/esm/features/session_trace/aggregate/trace/storage.js +1 -1
- package/dist/esm/features/soft_navigations/aggregate/bel-node.js +1 -2
- package/dist/esm/features/soft_navigations/aggregate/index.js +1 -1
- package/dist/esm/features/soft_navigations/aggregate/interaction.js +5 -4
- 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/constants/runtime.d.ts +0 -6
- 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/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 +9 -6
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_trace/aggregate/trace/storage.d.ts.map +1 -1
- package/dist/types/features/soft_navigations/aggregate/ajax-node.d.ts +0 -1
- package/dist/types/features/soft_navigations/aggregate/ajax-node.d.ts.map +1 -1
- package/dist/types/features/soft_navigations/aggregate/bel-node.d.ts +1 -1
- package/dist/types/features/soft_navigations/aggregate/bel-node.d.ts.map +1 -1
- package/dist/types/features/soft_navigations/aggregate/interaction.d.ts +0 -1
- package/dist/types/features/soft_navigations/aggregate/interaction.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 +16 -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/constants/runtime.js +3 -1
- package/src/common/deny-list/deny-list.js +1 -1
- package/src/common/session/session-entity.js +7 -2
- package/src/common/timing/time-keeper.js +2 -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 +15 -8
- package/src/features/session_trace/aggregate/trace/storage.js +1 -2
- package/src/features/soft_navigations/aggregate/bel-node.js +1 -3
- package/src/features/soft_navigations/aggregate/index.js +1 -1
- package/src/features/soft_navigations/aggregate/interaction.js +5 -4
- 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
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,32 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.261.0](https://github.com/newrelic/newrelic-browser-agent/compare/v1.260.1...v1.261.0) (2024-06-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Add Logging API entry points and central handler ([#1052](https://github.com/newrelic/newrelic-browser-agent/issues/1052)) ([face445](https://github.com/newrelic/newrelic-browser-agent/commit/face4457f2ec29699b610cb096864ee3a16aafdc))
|
|
12
|
+
* Add Logging Configurations ([#1058](https://github.com/newrelic/newrelic-browser-agent/issues/1058)) ([3c4ea26](https://github.com/newrelic/newrelic-browser-agent/commit/3c4ea262b30b48afc434f8ccdce867b1a5acb874))
|
|
13
|
+
* Add wrapLogger API method for wrapping 3rd party loggers ([#1054](https://github.com/newrelic/newrelic-browser-agent/issues/1054)) ([3713d73](https://github.com/newrelic/newrelic-browser-agent/commit/3713d73716f24c9bfb4154a664c2696296f7150e))
|
|
14
|
+
* Create logging feature ([#1059](https://github.com/newrelic/newrelic-browser-agent/issues/1059)) ([c573e33](https://github.com/newrelic/newrelic-browser-agent/commit/c573e330ea5e7dd97e7293b0f95785cb738cf3f2))
|
|
15
|
+
* Logging feature harvesting and optimizations ([#1064](https://github.com/newrelic/newrelic-browser-agent/issues/1064)) ([9a9fad5](https://github.com/newrelic/newrelic-browser-agent/commit/9a9fad5fe10536e72d5b55374363f727b6ae0c43))
|
|
16
|
+
* Pass logging API args as object for better extensibility ([#1074](https://github.com/newrelic/newrelic-browser-agent/issues/1074)) ([8fbd25a](https://github.com/newrelic/newrelic-browser-agent/commit/8fbd25a6de3e5c48869f9cae564d86cf36cc364c))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* dedup pre-load ajax requests ([#1081](https://github.com/newrelic/newrelic-browser-agent/issues/1081)) ([9f95b33](https://github.com/newrelic/newrelic-browser-agent/commit/9f95b339248d7597ce489546e9f04d68053fe7d1))
|
|
22
|
+
* Prevent session reset triggers from harvesting session trace data ([#1050](https://github.com/newrelic/newrelic-browser-agent/issues/1050)) ([bec022b](https://github.com/newrelic/newrelic-browser-agent/commit/bec022b57ffa2cb23353272b667727f631e76b63))
|
|
23
|
+
* Reading finish of null in SPA ([#1085](https://github.com/newrelic/newrelic-browser-agent/issues/1085)) ([df874f7](https://github.com/newrelic/newrelic-browser-agent/commit/df874f72c1a7668098c855eea718b1d0ceda7a7c))
|
|
24
|
+
|
|
25
|
+
## [1.260.1](https://github.com/newrelic/newrelic-browser-agent/compare/v1.260.0...v1.260.1) (2024-05-16)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* Undefined stns in blob Trace ([#1039](https://github.com/newrelic/newrelic-browser-agent/issues/1039)) ([1a87991](https://github.com/newrelic/newrelic-browser-agent/commit/1a87991143aa1f220ae29edbf1e8ea89598bcc44))
|
|
31
|
+
|
|
6
32
|
## [1.260.0](https://github.com/newrelic/newrelic-browser-agent/compare/v1.259.0...v1.260.0) (2024-05-13)
|
|
7
33
|
|
|
8
34
|
|
|
@@ -10,6 +10,7 @@ var _instrument6 = require("../features/session_trace/instrument");
|
|
|
10
10
|
var _instrument7 = require("../features/session_replay/instrument");
|
|
11
11
|
var _instrument8 = require("../features/soft_navigations/instrument");
|
|
12
12
|
var _instrument9 = require("../features/page_action/instrument");
|
|
13
|
+
var _instrument10 = require("../features/logging/instrument");
|
|
13
14
|
/*
|
|
14
15
|
* Copyright 2023 New Relic Corporation. All rights reserved.
|
|
15
16
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -24,7 +25,7 @@ var _instrument9 = require("../features/page_action/instrument");
|
|
|
24
25
|
// import { Instrument as InstrumentSpa } from '../features/spa/instrument'
|
|
25
26
|
|
|
26
27
|
new _agent.Agent({
|
|
27
|
-
features: [_instrument5.Instrument, _instrument.Instrument, _instrument2.Instrument, _instrument6.Instrument, _instrument7.Instrument, _instrument3.Instrument, _instrument9.Instrument, _instrument4.Instrument,
|
|
28
|
+
features: [_instrument5.Instrument, _instrument.Instrument, _instrument2.Instrument, _instrument6.Instrument, _instrument7.Instrument, _instrument3.Instrument, _instrument9.Instrument, _instrument4.Instrument, _instrument10.Instrument,
|
|
28
29
|
// InstrumentSpa,
|
|
29
30
|
_instrument8.Instrument],
|
|
30
31
|
loaderType: 'experimental'
|
|
@@ -9,12 +9,13 @@ var _instrument4 = require("../../features/jserrors/instrument");
|
|
|
9
9
|
var _instrument5 = require("../../features/ajax/instrument");
|
|
10
10
|
var _instrument6 = require("../../features/session_trace/instrument");
|
|
11
11
|
var _instrument7 = require("../../features/page_action/instrument");
|
|
12
|
+
var _instrument8 = require("../../features/logging/instrument");
|
|
12
13
|
/**
|
|
13
14
|
* @file Creates a version of the "PRO" agent loader with [core-js]{@link https://github.com/zloirock/core-js}
|
|
14
15
|
* polyfills for pre-ES6 browsers and IE 11.
|
|
15
16
|
*/
|
|
16
17
|
|
|
17
18
|
new _agent.Agent({
|
|
18
|
-
features: [_instrument.Instrument, _instrument2.Instrument, _instrument6.Instrument, _instrument5.Instrument, _instrument3.Instrument, _instrument7.Instrument, _instrument4.Instrument],
|
|
19
|
+
features: [_instrument.Instrument, _instrument2.Instrument, _instrument6.Instrument, _instrument5.Instrument, _instrument3.Instrument, _instrument7.Instrument, _instrument4.Instrument, _instrument8.Instrument],
|
|
19
20
|
loaderType: 'pro-polyfills'
|
|
20
21
|
});
|
|
@@ -10,12 +10,13 @@ var _instrument5 = require("../../features/ajax/instrument");
|
|
|
10
10
|
var _instrument6 = require("../../features/session_trace/instrument");
|
|
11
11
|
var _instrument7 = require("../../features/spa/instrument");
|
|
12
12
|
var _instrument8 = require("../../features/page_action/instrument");
|
|
13
|
+
var _instrument9 = require("../../features/logging/instrument");
|
|
13
14
|
/**
|
|
14
15
|
* @file Creates a version of the "SPA" agent loader with [core-js]{@link https://github.com/zloirock/core-js}
|
|
15
16
|
* polyfills for pre-ES6 browsers and IE 11.
|
|
16
17
|
*/
|
|
17
18
|
|
|
18
19
|
new _agent.Agent({
|
|
19
|
-
features: [_instrument5.Instrument, _instrument.Instrument, _instrument2.Instrument, _instrument6.Instrument, _instrument3.Instrument, _instrument8.Instrument, _instrument4.Instrument, _instrument7.Instrument],
|
|
20
|
+
features: [_instrument5.Instrument, _instrument.Instrument, _instrument2.Instrument, _instrument6.Instrument, _instrument3.Instrument, _instrument8.Instrument, _instrument4.Instrument, _instrument9.Instrument, _instrument7.Instrument],
|
|
20
21
|
loaderType: 'spa-polyfills'
|
|
21
22
|
});
|
package/dist/cjs/cdn/pro.js
CHANGED
|
@@ -9,12 +9,13 @@ var _instrument5 = require("../features/ajax/instrument");
|
|
|
9
9
|
var _instrument6 = require("../features/session_trace/instrument");
|
|
10
10
|
var _instrument7 = require("../features/session_replay/instrument");
|
|
11
11
|
var _instrument8 = require("../features/page_action/instrument");
|
|
12
|
+
var _instrument9 = require("../features/logging/instrument");
|
|
12
13
|
/**
|
|
13
14
|
* @file Creates a "Pro" agent loader bundle composed of the core Agent and all available feature modules except `spa`.
|
|
14
15
|
* This excludes collection of BrowserInteraction and BrowserTiming events.
|
|
15
16
|
*/
|
|
16
17
|
|
|
17
18
|
new _agent.Agent({
|
|
18
|
-
features: [_instrument.Instrument, _instrument2.Instrument, _instrument6.Instrument, _instrument7.Instrument, _instrument5.Instrument, _instrument3.Instrument, _instrument8.Instrument, _instrument4.Instrument],
|
|
19
|
+
features: [_instrument.Instrument, _instrument2.Instrument, _instrument6.Instrument, _instrument7.Instrument, _instrument5.Instrument, _instrument3.Instrument, _instrument8.Instrument, _instrument4.Instrument, _instrument9.Instrument],
|
|
19
20
|
loaderType: 'pro'
|
|
20
21
|
});
|
package/dist/cjs/cdn/spa.js
CHANGED
|
@@ -11,12 +11,13 @@ var _instrument7 = require("../features/session_replay/instrument");
|
|
|
11
11
|
var _instrument8 = require("../features/soft_navigations/instrument");
|
|
12
12
|
var _instrument9 = require("../features/spa/instrument");
|
|
13
13
|
var _instrument10 = require("../features/page_action/instrument");
|
|
14
|
+
var _instrument11 = require("../features/logging/instrument");
|
|
14
15
|
/**
|
|
15
16
|
* @file Creates a "SPA" agent loader bundle composed of the core agent and all available feature modules.
|
|
16
17
|
*/
|
|
17
18
|
|
|
18
19
|
new _agent.Agent({
|
|
19
|
-
features: [_instrument5.Instrument, _instrument.Instrument, _instrument2.Instrument, _instrument6.Instrument, _instrument7.Instrument, _instrument3.Instrument, _instrument10.Instrument, _instrument4.Instrument, _instrument8.Instrument, _instrument9.Instrument // either the softnav or the old spa will be used (not both), but we still need to pack both to avoid dynamic import for instrument files
|
|
20
|
+
features: [_instrument5.Instrument, _instrument.Instrument, _instrument2.Instrument, _instrument6.Instrument, _instrument7.Instrument, _instrument3.Instrument, _instrument10.Instrument, _instrument4.Instrument, _instrument11.Instrument, _instrument8.Instrument, _instrument9.Instrument // either the softnav or the old spa will be used (not both), but we still need to pack both to avoid dynamic import for instrument files
|
|
20
21
|
],
|
|
21
22
|
loaderType: 'spa'
|
|
22
23
|
});
|
|
@@ -6,8 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getConfiguration = getConfiguration;
|
|
7
7
|
exports.getConfigurationValue = getConfigurationValue;
|
|
8
8
|
exports.setConfiguration = setConfiguration;
|
|
9
|
+
var _constants = require("../../../features/logging/constants");
|
|
9
10
|
var _querySelector = require("../../dom/query-selector");
|
|
10
|
-
var
|
|
11
|
+
var _constants2 = require("../../session/constants");
|
|
11
12
|
var _console = require("../../util/console");
|
|
12
13
|
var _nreum = require("../../window/nreum");
|
|
13
14
|
var _configurable = require("./configurable");
|
|
@@ -37,16 +38,6 @@ const model = () => {
|
|
|
37
38
|
}
|
|
38
39
|
};
|
|
39
40
|
return {
|
|
40
|
-
feature_flags: [],
|
|
41
|
-
proxy: {
|
|
42
|
-
assets: undefined,
|
|
43
|
-
// if this value is set, it will be used to overwrite the webpack asset path used to fetch assets
|
|
44
|
-
beacon: undefined // likewise for the url to which we send analytics
|
|
45
|
-
},
|
|
46
|
-
privacy: {
|
|
47
|
-
cookies_enabled: true
|
|
48
|
-
},
|
|
49
|
-
// *cli - per discussion, default should be true
|
|
50
41
|
ajax: {
|
|
51
42
|
deny_list: undefined,
|
|
52
43
|
block_internal: true,
|
|
@@ -61,21 +52,26 @@ const model = () => {
|
|
|
61
52
|
cors_use_tracecontext_headers: undefined,
|
|
62
53
|
allowed_origins: undefined
|
|
63
54
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
feature_flags: [],
|
|
56
|
+
harvest: {
|
|
57
|
+
tooManyRequestsDelay: 60
|
|
67
58
|
},
|
|
68
|
-
ssl: undefined,
|
|
69
|
-
obfuscate: undefined,
|
|
70
59
|
jserrors: {
|
|
71
60
|
enabled: true,
|
|
72
61
|
harvestTimeSeconds: 10,
|
|
73
62
|
autoStart: true
|
|
74
63
|
},
|
|
64
|
+
logging: {
|
|
65
|
+
enabled: true,
|
|
66
|
+
harvestTimeSeconds: 10,
|
|
67
|
+
autoStart: true,
|
|
68
|
+
level: _constants.LOG_LEVELS.INFO
|
|
69
|
+
},
|
|
75
70
|
metrics: {
|
|
76
71
|
enabled: true,
|
|
77
72
|
autoStart: true
|
|
78
73
|
},
|
|
74
|
+
obfuscate: undefined,
|
|
79
75
|
page_action: {
|
|
80
76
|
enabled: true,
|
|
81
77
|
harvestTimeSeconds: 30,
|
|
@@ -91,13 +87,18 @@ const model = () => {
|
|
|
91
87
|
long_task: false,
|
|
92
88
|
autoStart: true
|
|
93
89
|
},
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
harvestTimeSeconds: 10,
|
|
97
|
-
autoStart: true
|
|
90
|
+
privacy: {
|
|
91
|
+
cookies_enabled: true
|
|
98
92
|
},
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
// *cli - per discussion, default should be true
|
|
94
|
+
proxy: {
|
|
95
|
+
assets: undefined,
|
|
96
|
+
// if this value is set, it will be used to overwrite the webpack asset path used to fetch assets
|
|
97
|
+
beacon: undefined // likewise for the url to which we send analytics
|
|
98
|
+
},
|
|
99
|
+
session: {
|
|
100
|
+
expiresMs: _constants2.DEFAULT_EXPIRES_MS,
|
|
101
|
+
inactiveMs: _constants2.DEFAULT_INACTIVE_MS
|
|
101
102
|
},
|
|
102
103
|
session_replay: {
|
|
103
104
|
// feature settings
|
|
@@ -154,7 +155,7 @@ const model = () => {
|
|
|
154
155
|
};else (0, _console.warn)('An invalid session_replay.mask_input_option was provided and will not be used', val);
|
|
155
156
|
}
|
|
156
157
|
},
|
|
157
|
-
|
|
158
|
+
session_trace: {
|
|
158
159
|
enabled: true,
|
|
159
160
|
harvestTimeSeconds: 10,
|
|
160
161
|
autoStart: true
|
|
@@ -163,7 +164,13 @@ const model = () => {
|
|
|
163
164
|
enabled: true,
|
|
164
165
|
harvestTimeSeconds: 10,
|
|
165
166
|
autoStart: true
|
|
166
|
-
}
|
|
167
|
+
},
|
|
168
|
+
spa: {
|
|
169
|
+
enabled: true,
|
|
170
|
+
harvestTimeSeconds: 10,
|
|
171
|
+
autoStart: true
|
|
172
|
+
},
|
|
173
|
+
ssl: undefined
|
|
167
174
|
};
|
|
168
175
|
};
|
|
169
176
|
const _cache = {};
|
|
@@ -12,7 +12,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
|
|
|
12
12
|
/**
|
|
13
13
|
* Exposes the version of the agent
|
|
14
14
|
*/
|
|
15
|
-
const VERSION = exports.VERSION = "1.
|
|
15
|
+
const VERSION = exports.VERSION = "1.261.0";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the build type of the agent
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_ENV = void 0;
|
|
7
7
|
var _package = _interopRequireDefault(require("../../../package.json"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
/**
|
|
10
10
|
* @file This file exposes build time environment variables that will be included in the
|
|
11
11
|
* build output of the agent. This file specifically contains the normal environment variables
|
|
@@ -12,7 +12,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
|
|
|
12
12
|
/**
|
|
13
13
|
* Exposes the version of the agent
|
|
14
14
|
*/
|
|
15
|
-
const VERSION = exports.VERSION = "1.
|
|
15
|
+
const VERSION = exports.VERSION = "1.261.0";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the build type of the agent
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.supportsSendBeacon = exports.originTime = exports.loadedAsDeferredBrowserScript = exports.isiOS = exports.isWorkerScope = exports.isIE = exports.isBrowserScope = exports.initiallyHidden = exports.initialLocation = exports.iOSBelow16 = exports.globalScope = exports.ffVersion = void 0;
|
|
7
|
+
var _now = require("../timing/now");
|
|
7
8
|
/**
|
|
8
9
|
* @file Contains constants about the environment the agent is running
|
|
9
10
|
* within. These values are derived at the time the agent is first loaded.
|
|
@@ -50,4 +51,4 @@ const supportsSendBeacon = exports.supportsSendBeacon = !!globalScope.navigator?
|
|
|
50
51
|
* according to the browser's local clock.
|
|
51
52
|
* @type {number}
|
|
52
53
|
*/
|
|
53
|
-
const originTime = exports.originTime =
|
|
54
|
+
const originTime = exports.originTime = Date.now() - (0, _now.now)();
|
|
@@ -18,7 +18,7 @@ var denyList = [];
|
|
|
18
18
|
* @returns {boolean} `true` if request does not match any entries of {@link denyList|deny list}; else `false`
|
|
19
19
|
*/
|
|
20
20
|
function shouldCollectEvent(params) {
|
|
21
|
-
if (hasUndefinedHostname(params)) return false;
|
|
21
|
+
if (!params || hasUndefinedHostname(params)) return false;
|
|
22
22
|
if (denyList.length === 0) return true;
|
|
23
23
|
for (var i = 0; i < denyList.length; i++) {
|
|
24
24
|
var parsed = denyList[i];
|
|
@@ -10,7 +10,7 @@ var _harvest = require("./harvest");
|
|
|
10
10
|
var _eol = require("../unload/eol");
|
|
11
11
|
var _constants = require("../session/constants");
|
|
12
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
14
|
/*
|
|
15
15
|
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
16
16
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -19,7 +19,7 @@ var _runtime = require("../constants/runtime");
|
|
|
19
19
|
var _console = require("../util/console");
|
|
20
20
|
var _now = require("../timing/now");
|
|
21
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
22
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
22
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
23
|
/*
|
|
24
24
|
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
25
25
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -58,7 +58,13 @@ class SessionEntity {
|
|
|
58
58
|
this.ee = _contextualEe.ee.get(agentIdentifier);
|
|
59
59
|
(0, _wrap.wrapEvents)(this.ee);
|
|
60
60
|
this.setup(opts);
|
|
61
|
-
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Do not emit session storage events for IE11, because IE11 is unable to determine
|
|
64
|
+
* if the event was spawned on the current page or an adjacent page, and the behavior tied
|
|
65
|
+
* to storage events is critical to apply only to cross-tab behavior
|
|
66
|
+
* */
|
|
67
|
+
if (_runtime.isBrowserScope && !_runtime.isIE) {
|
|
62
68
|
(0, _eventListenerOpts.windowAddEventListener)('storage', event => {
|
|
63
69
|
if (event.key === this.lookupKey) {
|
|
64
70
|
const obj = typeof event.newValue === 'string' ? JSON.parse(event.newValue) : event.newValue;
|
|
@@ -62,7 +62,7 @@ class TimeKeeper {
|
|
|
62
62
|
throw new Error('Missing date header on rum response.');
|
|
63
63
|
}
|
|
64
64
|
const medianRumOffset = (endTime - startTime) / 2;
|
|
65
|
-
const serverOffset =
|
|
65
|
+
const serverOffset = startTime + medianRumOffset;
|
|
66
66
|
|
|
67
67
|
// Corrected page origin time
|
|
68
68
|
this.#correctedOriginTime = Math.floor(Date.parse(responseDateHeader) - serverOffset);
|
|
@@ -83,7 +83,7 @@ class TimeKeeper {
|
|
|
83
83
|
* @returns {number} Corrected unix/epoch timestamp
|
|
84
84
|
*/
|
|
85
85
|
convertRelativeTimestamp(relativeTime) {
|
|
86
|
-
return this.#correctedOriginTime + relativeTime;
|
|
86
|
+
return Math.floor(this.#correctedOriginTime + relativeTime);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
/**
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.scopedEE = scopedEE;
|
|
7
|
+
exports.wrapLogger = wrapLogger;
|
|
8
|
+
var _contextualEe = require("../event-emitter/contextual-ee");
|
|
9
|
+
var _eventContext = require("../event-emitter/event-context");
|
|
10
|
+
var _wrapFunction = require("./wrap-function");
|
|
11
|
+
/*
|
|
12
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
13
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @file Wraps native timeout and interval methods for instrumentation.
|
|
17
|
+
* This module is used by: jserrors, spa.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Wraps a supplied function and adds emitter events under the `-wrap-logger-` prefix
|
|
22
|
+
* @param {Object} sharedEE - The shared event emitter on which a new scoped event emitter will be based.
|
|
23
|
+
* @param {Object} parent - The parent object housing the logger function
|
|
24
|
+
* @param {string} loggerFn - The name of the function in the parent object to wrap
|
|
25
|
+
* @returns {Object} Scoped event emitter with a debug ID of `logger`.
|
|
26
|
+
*/
|
|
27
|
+
// eslint-disable-next-line
|
|
28
|
+
function wrapLogger(sharedEE, parent, loggerFn, context) {
|
|
29
|
+
const ee = scopedEE(sharedEE);
|
|
30
|
+
const wrapFn = (0, _wrapFunction.createWrapperWithEmitter)(ee);
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* This section contains the context that will be shared across all invoked calls of the wrapped function,
|
|
34
|
+
* which will be used to decorate the log data later at agg time
|
|
35
|
+
*/
|
|
36
|
+
const ctx = new _eventContext.EventContext(_contextualEe.contextId);
|
|
37
|
+
ctx.level = context.level;
|
|
38
|
+
ctx.customAttributes = context.customAttributes;
|
|
39
|
+
|
|
40
|
+
/** observe calls to <loggerFn> and emit events prefixed with `wrap-logger-` */
|
|
41
|
+
wrapFn.inPlace(parent, [loggerFn], 'wrap-logger-', ctx);
|
|
42
|
+
return ee;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Returns an event emitter scoped specifically for the `logger` context. This scoping is a remnant from when all the
|
|
47
|
+
* features shared the same group in the event, to isolate events between features. It will likely be revisited.
|
|
48
|
+
* @param {Object} sharedEE - Optional event emitter on which to base the scoped emitter.
|
|
49
|
+
* Uses `ee` on the global scope if undefined).
|
|
50
|
+
* @returns {Object} Scoped event emitter with a debug ID of 'logger'.
|
|
51
|
+
*/
|
|
52
|
+
function scopedEE(sharedEE) {
|
|
53
|
+
return (sharedEE || _contextualEe.ee).get('logger');
|
|
54
|
+
}
|
|
@@ -17,7 +17,7 @@ var _aggregateBase = require("../../utils/aggregate-base");
|
|
|
17
17
|
var _gql = require("./gql");
|
|
18
18
|
var _nreum = require("../../../common/window/nreum");
|
|
19
19
|
var _chunk = _interopRequireDefault(require("./chunk"));
|
|
20
|
-
function _interopRequireDefault(
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
21
|
/*
|
|
22
22
|
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
23
23
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Aggregate = void 0;
|
|
7
|
+
var _config = require("../../../common/config/config");
|
|
8
|
+
var _handle = require("../../../common/event-emitter/handle");
|
|
9
|
+
var _registerHandler = require("../../../common/event-emitter/register-handler");
|
|
10
|
+
var _harvestScheduler = require("../../../common/harvest/harvest-scheduler");
|
|
11
|
+
var _console = require("../../../common/util/console");
|
|
12
|
+
var _stringify = require("../../../common/util/stringify");
|
|
13
|
+
var _constants = require("../../metrics/constants");
|
|
14
|
+
var _aggregateBase = require("../../utils/aggregate-base");
|
|
15
|
+
var _constants2 = require("../constants");
|
|
16
|
+
var _log = require("../shared/log");
|
|
17
|
+
class Aggregate extends _aggregateBase.AggregateBase {
|
|
18
|
+
static featureName = _constants2.FEATURE_NAME;
|
|
19
|
+
#agentRuntime;
|
|
20
|
+
#agentInfo;
|
|
21
|
+
constructor(agentIdentifier, aggregator) {
|
|
22
|
+
super(agentIdentifier, aggregator, _constants2.FEATURE_NAME);
|
|
23
|
+
|
|
24
|
+
/** held logs before sending */
|
|
25
|
+
this.bufferedLogs = [];
|
|
26
|
+
/** held logs during sending, for retries */
|
|
27
|
+
this.outgoingLogs = [];
|
|
28
|
+
/** the estimated bytes of log data waiting to be sent -- triggers a harvest if adding a new log will exceed limit */
|
|
29
|
+
this.estimatedBytes = 0;
|
|
30
|
+
this.#agentRuntime = (0, _config.getRuntime)(this.agentIdentifier);
|
|
31
|
+
this.#agentInfo = (0, _config.getInfo)(this.agentIdentifier);
|
|
32
|
+
this.harvestTimeSeconds = (0, _config.getConfigurationValue)(this.agentIdentifier, 'logging.harvestTimeSeconds');
|
|
33
|
+
this.waitForFlags([]).then(() => {
|
|
34
|
+
this.scheduler = new _harvestScheduler.HarvestScheduler('browser/logs', {
|
|
35
|
+
onFinished: this.onHarvestFinished.bind(this),
|
|
36
|
+
retryDelay: this.harvestTimeSeconds,
|
|
37
|
+
getPayload: this.prepareHarvest.bind(this),
|
|
38
|
+
raw: true
|
|
39
|
+
}, this);
|
|
40
|
+
/** harvest immediately once started to purge pre-load logs collected */
|
|
41
|
+
this.scheduler.startTimer(this.harvestTimeSeconds, 0);
|
|
42
|
+
/** emitted by instrument class (wrapped loggers) or the api methods directly */
|
|
43
|
+
(0, _registerHandler.registerHandler)(_constants2.LOGGING_EVENT_EMITTER_CHANNEL, this.handleLog.bind(this), this.featureName, this.ee);
|
|
44
|
+
this.drain();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
handleLog(timestamp, message, attributes, level) {
|
|
48
|
+
if (this.blocked) return;
|
|
49
|
+
const log = new _log.Log(this.#agentRuntime.timeKeeper.convertRelativeTimestamp(timestamp), message, attributes, level);
|
|
50
|
+
const logBytes = log.message.length + (0, _stringify.stringify)(log.attributes).length + log.level.length + 10; // timestamp == 10 chars
|
|
51
|
+
if (logBytes > _constants2.MAX_PAYLOAD_SIZE) {
|
|
52
|
+
(0, _handle.handle)(_constants.SUPPORTABILITY_METRIC_CHANNEL, ['Logging/Harvest/Failed/Seen', logBytes]);
|
|
53
|
+
return (0, _console.warn)(_constants2.LOGGING_IGNORED + '> ' + _constants2.MAX_PAYLOAD_SIZE + ' bytes', log.message.slice(0, 25) + '...');
|
|
54
|
+
}
|
|
55
|
+
if (this.estimatedBytes + logBytes >= _constants2.MAX_PAYLOAD_SIZE) {
|
|
56
|
+
(0, _handle.handle)(_constants.SUPPORTABILITY_METRIC_CHANNEL, ['Logging/Harvest/Early/Seen', this.estimatedBytes + logBytes]);
|
|
57
|
+
this.scheduler.runHarvest({});
|
|
58
|
+
}
|
|
59
|
+
this.estimatedBytes += logBytes;
|
|
60
|
+
this.bufferedLogs.push(log);
|
|
61
|
+
}
|
|
62
|
+
prepareHarvest() {
|
|
63
|
+
if (this.blocked || !(this.bufferedLogs.length || this.outgoingLogs.length)) return;
|
|
64
|
+
/** populate outgoing array while also clearing main buffer */
|
|
65
|
+
this.outgoingLogs.push(...this.bufferedLogs.splice(0));
|
|
66
|
+
this.estimatedBytes = 0;
|
|
67
|
+
/** see https://source.datanerd.us/agents/rum-specs/blob/main/browser/Log for logging spec */
|
|
68
|
+
return {
|
|
69
|
+
qs: {
|
|
70
|
+
browser_monitoring_key: this.#agentInfo.licenseKey
|
|
71
|
+
},
|
|
72
|
+
body: [{
|
|
73
|
+
common: {
|
|
74
|
+
/** Attributes in the `common` section are added to `all` logs generated in the payload */
|
|
75
|
+
attributes: {
|
|
76
|
+
'entity.guid': this.#agentRuntime.appMetadata?.agents?.[0]?.entityGuid,
|
|
77
|
+
// browser entity guid as provided from RUM response
|
|
78
|
+
session: this.#agentRuntime?.session?.state.value || '0',
|
|
79
|
+
// The session ID that we generate and keep across page loads
|
|
80
|
+
hasReplay: this.#agentRuntime?.session?.state.sessionReplayMode === 1,
|
|
81
|
+
// True if a session replay recording is running
|
|
82
|
+
hasTrace: this.#agentRuntime?.session?.state.sessionTraceMode === 1,
|
|
83
|
+
// True if a session trace recording is running
|
|
84
|
+
ptid: this.#agentRuntime.ptid,
|
|
85
|
+
// page trace id
|
|
86
|
+
appId: this.#agentInfo.applicationID,
|
|
87
|
+
// Application ID from info object,
|
|
88
|
+
standalone: Boolean(this.#agentInfo.sa),
|
|
89
|
+
// copy paste (true) vs APM (false)
|
|
90
|
+
agentVersion: this.#agentRuntime.version // browser agent version
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
/** logs section contains individual unique log entries */
|
|
94
|
+
logs: this.outgoingLogs
|
|
95
|
+
}]
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
onHarvestFinished(result) {
|
|
99
|
+
if (!result.retry) this.outgoingLogs = [];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.Aggregate = Aggregate;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MAX_PAYLOAD_SIZE = exports.LOG_LEVELS = exports.LOGGING_LEVEL_FAILURE_MESSAGE = exports.LOGGING_IGNORED = exports.LOGGING_FAILURE_MESSAGE = exports.LOGGING_EVENT_EMITTER_CHANNEL = exports.FEATURE_NAME = void 0;
|
|
7
|
+
var _features = require("../../loaders/features/features");
|
|
8
|
+
const LOG_LEVELS = exports.LOG_LEVELS = {
|
|
9
|
+
ERROR: 'ERROR',
|
|
10
|
+
WARN: 'WARN',
|
|
11
|
+
INFO: 'INFO',
|
|
12
|
+
DEBUG: 'DEBUG',
|
|
13
|
+
TRACE: 'TRACE'
|
|
14
|
+
};
|
|
15
|
+
const LOGGING_EVENT_EMITTER_CHANNEL = exports.LOGGING_EVENT_EMITTER_CHANNEL = 'log';
|
|
16
|
+
const FEATURE_NAME = exports.FEATURE_NAME = _features.FEATURE_NAMES.logging;
|
|
17
|
+
const MAX_PAYLOAD_SIZE = exports.MAX_PAYLOAD_SIZE = 1000000;
|
|
18
|
+
const LOGGING_FAILURE_MESSAGE = exports.LOGGING_FAILURE_MESSAGE = 'failed to wrap logger: ';
|
|
19
|
+
const LOGGING_LEVEL_FAILURE_MESSAGE = exports.LOGGING_LEVEL_FAILURE_MESSAGE = 'invalid log level: ';
|
|
20
|
+
const LOGGING_IGNORED = exports.LOGGING_IGNORED = 'ignored log: ';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Logging", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _index.Instrument;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _index = require("./instrument/index");
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Instrument = void 0;
|
|
7
|
+
var _instrumentBase = require("../../utils/instrument-base");
|
|
8
|
+
var _constants = require("../constants");
|
|
9
|
+
var _utils = require("../shared/utils");
|
|
10
|
+
class Instrument extends _instrumentBase.InstrumentBase {
|
|
11
|
+
static featureName = _constants.FEATURE_NAME;
|
|
12
|
+
constructor(agentIdentifier, aggregator) {
|
|
13
|
+
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
14
|
+
super(agentIdentifier, aggregator, _constants.FEATURE_NAME, auto);
|
|
15
|
+
const instanceEE = this.ee;
|
|
16
|
+
/** emitted by wrap-logger function */
|
|
17
|
+
this.ee.on('wrap-logger-end', function handleLog(_ref) {
|
|
18
|
+
let [message] = _ref;
|
|
19
|
+
const {
|
|
20
|
+
level,
|
|
21
|
+
customAttributes
|
|
22
|
+
} = this;
|
|
23
|
+
(0, _utils.bufferLog)(instanceEE, message, customAttributes, level);
|
|
24
|
+
});
|
|
25
|
+
this.importAggregator();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.Instrument = Instrument;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Log = void 0;
|
|
7
|
+
var _runtime = require("../../../common/constants/runtime");
|
|
8
|
+
var _cleanUrl = require("../../../common/url/clean-url");
|
|
9
|
+
var _constants = require("../constants");
|
|
10
|
+
class Log {
|
|
11
|
+
/** @type {long} the unix timestamp of the log event */
|
|
12
|
+
timestamp;
|
|
13
|
+
/** @type {string} the log message */
|
|
14
|
+
message;
|
|
15
|
+
/** @type {object} the object of attributes to be parsed by logging ingest into top-level properties */
|
|
16
|
+
attributes;
|
|
17
|
+
/** @type {'ERROR'|'TRACE'|'DEBUG'|'INFO'|'WARN'} the log type of the log */
|
|
18
|
+
level;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param {number} timestamp - Unix timestamp
|
|
22
|
+
* @param {string} message - message string
|
|
23
|
+
* @param {object} attributes - other log event attributes
|
|
24
|
+
* @param {enum} level - Log level
|
|
25
|
+
*/
|
|
26
|
+
constructor(timestamp, message) {
|
|
27
|
+
let attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
28
|
+
let level = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _constants.LOG_LEVELS.INFO;
|
|
29
|
+
/** @type {long} */
|
|
30
|
+
this.timestamp = timestamp;
|
|
31
|
+
this.message = message;
|
|
32
|
+
this.attributes = {
|
|
33
|
+
...attributes,
|
|
34
|
+
pageUrl: (0, _cleanUrl.cleanURL)('' + _runtime.globalScope.location)
|
|
35
|
+
};
|
|
36
|
+
this.level = level.toUpperCase();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.Log = Log;
|