@dynatrace/react-native-plugin 2.323.2 → 2.325.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -7
- package/android/build.gradle +1 -1
- package/files/plugin.gradle +1 -1
- package/index.js +18 -11
- package/instrumentation/jsx/CreateElement.js +10 -7
- package/instrumentation/model/Types.js +0 -1
- package/internal.js +7 -0
- package/lib/core/DynatraceAction.js +3 -2
- package/lib/core/DynatraceWebRequestTiming.js +5 -5
- package/lib/core/NullWebRequestTiming.js +1 -0
- package/lib/core/configuration/Configuration.js +2 -2
- package/lib/core/configuration/ConfigurationBuilder.js +3 -2
- package/lib/core/configuration/ManualStartupConfiguration.js +6 -3
- package/lib/core/interface/IWebRequestTiming.js +1 -0
- package/lib/core/logging/LogLevel.js +1 -10
- package/lib/core/logging/LogLevelUtil.js +13 -0
- package/lib/metro/getSourceMapInfo.js +7 -1
- package/lib/next/Dynatrace.js +22 -15
- package/lib/next/appstart/AppStartObserver.js +1 -1
- package/lib/next/events/EventPipeline.js +14 -6
- package/lib/next/events/IHttpRequestEventBuilder.js +2 -0
- package/lib/next/events/modifier/BaseDataEventModifier.js +6 -0
- package/lib/next/events/modifier/EventModifierUtil.js +21 -1
- package/lib/next/events/modifier/ModifyEventValidation.js +18 -5
- package/lib/next/events/spec/EventSpecContstants.js +1 -0
- package/package.json +12 -6
- package/public.js +22 -0
- package/react-augmentation.js +3 -0
- package/react-native-dynatrace.podspec +1 -1
- package/scripts/core/LineOffsetAnalyzeCall.js +3 -3
- package/types.d.ts +1969 -0
- package/instrumentation/model/TypesUtil.js +0 -21
- package/src/instrumentation/jsx/IDynatraceProperties.ts +0 -15
- package/typings/react-native-dynatrace.d.ts +0 -1849
package/README.md
CHANGED
|
@@ -33,8 +33,8 @@ If you want to start using this plugin and are not a Dynatrace customer yet, hea
|
|
|
33
33
|
## Agent Versions
|
|
34
34
|
This agent versions are configured in this plugin:
|
|
35
35
|
|
|
36
|
-
* Android Agent: 8.
|
|
37
|
-
* iOS Agent: 8.
|
|
36
|
+
* Android Agent: 8.325.1.1007
|
|
37
|
+
* iOS Agent: 8.325.1.1012
|
|
38
38
|
|
|
39
39
|
## Quick Setup
|
|
40
40
|
|
|
@@ -339,7 +339,7 @@ myAction.leaveAction();
|
|
|
339
339
|
```
|
|
340
340
|

|
|
341
341
|
|
|
342
|
-
* `enterManualAction` - Creates an Action which will NOT be handled by the plugin. This means that you have full control about the
|
|
342
|
+
* `enterManualAction` - Creates an Action which will NOT be handled by the plugin. This means that you have full control about the hierarchy of your actions. This function will create a root action for you, which has the ability to create child actions via `enterAction`. Be aware, because of the full manual approach the plugin will not link webrequest automatically. Webrequest have to be manually tagged by using the tag provided by the action via `getRequestTag`.
|
|
343
343
|
|
|
344
344
|
```ts
|
|
345
345
|
import { Dynatrace } from '@dynatrace/react-native-plugin';
|
|
@@ -740,7 +740,7 @@ npx react-native run-android --port=2000
|
|
|
740
740
|
|
|
741
741
|
## Manually adding iOS OneAgent to a project
|
|
742
742
|
|
|
743
|
-
Adding the iOS agent manually depends on the
|
|
743
|
+
Adding the iOS agent manually depends on the availability of support for CocoaPods.
|
|
744
744
|
|
|
745
745
|
### With CocoaPods support
|
|
746
746
|
Insert the following in your Podfile:
|
|
@@ -963,7 +963,7 @@ The content of the `config` block is directly copied to the `plist` file. Theref
|
|
|
963
963
|
|
|
964
964
|
## Define build stages in dynatrace.config.js
|
|
965
965
|
|
|
966
|
-
If you have several stages such as debug, QA, and production, you probably want to
|
|
966
|
+
If you have several stages such as debug, QA, and production, you probably want to separate them and let them report in different applications. This can be done with two different approaches:
|
|
967
967
|
|
|
968
968
|
1. Create several dynatrace.config.js (e.g. dynatrace.config.prod.js) and pass those configuration files via [arguments](#customizing-paths-for-configuration) in the CLI.
|
|
969
969
|
2. Use the configuration options which are available through Gradle and XCode. (Described below)
|
|
@@ -1394,7 +1394,7 @@ In summary, ensure your build fulfills our Kotlin 2.0.21 requirement while simul
|
|
|
1394
1394
|
|
|
1395
1395
|
## Configuration of standalone React Native project
|
|
1396
1396
|
|
|
1397
|
-
This section explains the configuration of a standalone React Native project. This means you have a React Native project, but don't use the
|
|
1397
|
+
This section explains the configuration of a standalone React Native project. This means you have a React Native project, but don't use the typical `iOS` and `android` folders. Instead you have a separate native `iOS` or `android` project which is embedding your React Native project.
|
|
1398
1398
|
|
|
1399
1399
|
To get the same experience as somebody who has a combined project, you roughly need to do the following things:
|
|
1400
1400
|
|
|
@@ -1403,7 +1403,7 @@ To get the same experience as somebody who has a combined project, you roughly n
|
|
|
1403
1403
|
|
|
1404
1404
|
### Auto Instrumentation of your Native Project
|
|
1405
1405
|
|
|
1406
|
-
The mobile application in the web UI offers you a configuration wizard (see settings page) for your native project (Android/iOS). Use it and apply it to your
|
|
1406
|
+
The mobile application in the web UI offers you a configuration wizard (see settings page) for your native project (Android/iOS). Use it and apply it to your separated native project according to this documentation:
|
|
1407
1407
|
|
|
1408
1408
|
- Android: https://www.dynatrace.com/support/help/technology-support/operating-systems/android/instrumentation-via-plugin/instrumentation-via-plugin/
|
|
1409
1409
|
- iOS: https://www.dynatrace.com/support/help/technology-support/operating-systems/ios/instrumentation/dynatrace-auto-instrumentation-for-ios/
|
|
@@ -1491,6 +1491,14 @@ If you are struggling with a problem, submit a support ticket to Dynatrace (supp
|
|
|
1491
1491
|
<br/><br/>
|
|
1492
1492
|
## Changelog
|
|
1493
1493
|
|
|
1494
|
+
2.325.2
|
|
1495
|
+
* Fixed incombatability with Metro 0.83.2 and newer
|
|
1496
|
+
|
|
1497
|
+
2.325.1
|
|
1498
|
+
* Updated Android (8.325.1.1007) & iOS Agent (8.325.1.1012)
|
|
1499
|
+
* [New RUM experience preview] ReactNative version now added to RUM on Grail event base data
|
|
1500
|
+
* [New RUM experience preview] Added API documentation for RUM on Grail API
|
|
1501
|
+
|
|
1494
1502
|
2.323.2
|
|
1495
1503
|
* Fixed error "Execution failed for task ':app:mergeReleaseAssets'. A problem occured starting process 'command 'npx''" when building for release on Windows.
|
|
1496
1504
|
* Downgraded required NodeJS version to 16.0.0+
|
package/android/build.gradle
CHANGED
|
@@ -72,7 +72,7 @@ repositories {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
dependencies {
|
|
75
|
-
implementation 'com.dynatrace.agent:agent-android:8.
|
|
75
|
+
implementation 'com.dynatrace.agent:agent-android:8.325.1.1007'
|
|
76
76
|
implementation "com.facebook.react:react-native:${safeExtGet('reactNative', '+')}"
|
|
77
77
|
}
|
|
78
78
|
|
package/files/plugin.gradle
CHANGED
package/index.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./public"), exports);
|
|
18
|
+
__exportStar(require("./internal"), exports);
|
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createElement = void 0;
|
|
3
4
|
const Types_1 = require("../model/Types");
|
|
4
5
|
const ElementHelper_1 = require("./ElementHelper");
|
|
5
6
|
const ClassComponent_1 = require("./components/ClassComponent");
|
|
6
7
|
const FunctionalComponent_1 = require("./components/FunctionalComponent");
|
|
7
|
-
const
|
|
8
|
+
const react_1 = require("react");
|
|
8
9
|
const createElement = (type, props, ...children) => {
|
|
9
10
|
if (type != null && type._dtInfo != null && !(0, ElementHelper_1.isDtActionIgnore)(props)) {
|
|
10
11
|
if (type._dtInfo.type === Types_1.Types.FunctionalComponent) {
|
|
11
|
-
return
|
|
12
|
+
return (0, react_1.createElement)(FunctionalComponent_1.DynatraceFunctionalComponent, {
|
|
13
|
+
children: (0, react_1.createElement)(type, props, ...children),
|
|
14
|
+
});
|
|
12
15
|
}
|
|
13
16
|
else if (type._dtInfo.type === Types_1.Types.ClassComponent &&
|
|
14
17
|
type.prototype !== undefined &&
|
|
15
18
|
type.prototype.isReactComponent !== undefined) {
|
|
16
|
-
return
|
|
19
|
+
return (0, react_1.createElement)(ClassComponent_1.DynatraceClassComponent, {
|
|
20
|
+
children: (0, react_1.createElement)(type, props, ...children),
|
|
21
|
+
});
|
|
17
22
|
}
|
|
18
23
|
else {
|
|
19
24
|
(0, ElementHelper_1.modifyElement)(type, props);
|
|
20
25
|
}
|
|
21
26
|
}
|
|
22
|
-
return
|
|
23
|
-
};
|
|
24
|
-
module.exports = {
|
|
25
|
-
createElement,
|
|
27
|
+
return (0, react_1.createElement)(type, props, ...children);
|
|
26
28
|
};
|
|
29
|
+
exports.createElement = createElement;
|
package/internal.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createElement = exports.ApplicationHandler = void 0;
|
|
4
|
+
var Application_1 = require("./lib/core/Application");
|
|
5
|
+
Object.defineProperty(exports, "ApplicationHandler", { enumerable: true, get: function () { return Application_1.ApplicationHandler; } });
|
|
6
|
+
var CreateElement_1 = require("./instrumentation/jsx/CreateElement");
|
|
7
|
+
Object.defineProperty(exports, "createElement", { enumerable: true, get: function () { return CreateElement_1.createElement; } });
|
|
@@ -43,12 +43,13 @@ class DynatraceAction {
|
|
|
43
43
|
this.logger.debug(`reportStringValue(${valueName}, ${value}): Action was closed already!`);
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(valueName)
|
|
46
|
+
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(valueName) &&
|
|
47
|
+
!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(value)) {
|
|
47
48
|
DynatraceBridge_1.DynatraceNative.reportStringValueInAction(this.key, valueName, value, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
48
49
|
this.logger.debug(`reportStringValue(${valueName}, ${value}): in Action - ${this.name}`);
|
|
49
50
|
}
|
|
50
51
|
else {
|
|
51
|
-
this.logger.debug(`reportStringValue(valueName, value): String value will not be reported because valueName is invalid! valueName: ${valueName}, value: ${value} in Action - ${this.name}`);
|
|
52
|
+
this.logger.debug(`reportStringValue(valueName, value): String value will not be reported because valueName or value is invalid! valueName: ${valueName}, value: ${value} in Action - ${this.name}`);
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
reportIntValue(valueName, value, platform) {
|
|
@@ -4,20 +4,20 @@ exports.DynatraceWebRequestTiming = void 0;
|
|
|
4
4
|
const DynatraceBridge_1 = require("./DynatraceBridge");
|
|
5
5
|
const ConsoleLogger_1 = require("./logging/ConsoleLogger");
|
|
6
6
|
const StringUtils_1 = require("./util/StringUtils");
|
|
7
|
+
const logger = new ConsoleLogger_1.ConsoleLogger('DynatraceWebRequestTiming');
|
|
7
8
|
class DynatraceWebRequestTiming {
|
|
8
9
|
constructor(requestTag, url) {
|
|
9
10
|
this.requestTag = requestTag;
|
|
10
11
|
this.url = url;
|
|
11
|
-
this.logger = new ConsoleLogger_1.ConsoleLogger('DynatraceWebRequestTiming');
|
|
12
12
|
}
|
|
13
13
|
startWebRequestTiming() {
|
|
14
14
|
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(this.requestTag) &&
|
|
15
15
|
!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(this.url)) {
|
|
16
|
-
|
|
16
|
+
logger.debug(`startWebRequestTiming() - (${this.url}/${this.requestTag})`);
|
|
17
17
|
DynatraceBridge_1.DynatraceNative.startWebRequestTiming(this.requestTag, this.url);
|
|
18
18
|
}
|
|
19
19
|
else {
|
|
20
|
-
|
|
20
|
+
logger.debug(`startWebRequestTiming(): Web Request Timing could not be created! - (${this.url}/${this.requestTag})`);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
stopWebRequestTiming(responseCode, responseMessage) {
|
|
@@ -28,11 +28,11 @@ class DynatraceWebRequestTiming {
|
|
|
28
28
|
!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(this.url) &&
|
|
29
29
|
responseCode != null &&
|
|
30
30
|
!StringUtils_1.StringUtils.isStringNullOrUndefined(responseMessage)) {
|
|
31
|
-
|
|
31
|
+
logger.debug(`stopWebRequestTiming(${responseCode}, ${responseMessage}, ${requestSize}, ${responseSize}) - (${this.url}/${this.requestTag})`);
|
|
32
32
|
DynatraceBridge_1.DynatraceNative.stopWebRequestTimingWithSize(this.requestTag, this.url, responseCode, responseMessage, requestSize, responseSize);
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
|
-
|
|
35
|
+
logger.debug(`stopWebRequestTiming(${responseCode}, ${responseMessage}, ${requestSize}, ${responseSize}): Web Request Timing could not be stopped! - (${this.url}/${this.requestTag})`);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
getRequestTag() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Configuration = void 0;
|
|
4
|
-
const
|
|
4
|
+
const LogLevelUtil_1 = require("../logging/LogLevelUtil");
|
|
5
5
|
class Configuration {
|
|
6
6
|
constructor(beaconUrl, applicationId, reportCrash, errorHandler, reportFatalErrorAsCrash, logLevel, lifecycleUpdate, userOptIn, actionNamePrivacy, bundleName, bundleVersion) {
|
|
7
7
|
this.beaconUrl = beaconUrl;
|
|
@@ -29,7 +29,7 @@ class Configuration {
|
|
|
29
29
|
`, lifecycleUpdate: ${this.lifecycleUpdate}` +
|
|
30
30
|
(isAutoStart ? '' : `, userOptIn: ${this.userOptIn}`) +
|
|
31
31
|
`, actionNamePrivacy: ${this.actionNamePrivacy}` +
|
|
32
|
-
`, logLevel: ${(0,
|
|
32
|
+
`, logLevel: ${(0, LogLevelUtil_1.LogLevelToString)(this.logLevel)}`;
|
|
33
33
|
if (this.bundleName !== undefined) {
|
|
34
34
|
configurationString += `, bundleName: ${this.bundleName}`;
|
|
35
35
|
}
|
|
@@ -60,10 +60,11 @@ class ConfigurationBuilder {
|
|
|
60
60
|
}
|
|
61
61
|
buildConfiguration() {
|
|
62
62
|
if (!this.autoStartup && this.beaconUrl.length === 0) {
|
|
63
|
-
throw new Error('beaconUrl configuration property is empty. This configuration is not possible! Please use a proper beacon
|
|
63
|
+
throw new Error('beaconUrl configuration property is empty. This configuration is not possible! Please use a proper beacon URL.');
|
|
64
64
|
}
|
|
65
65
|
if (!this.autoStartup && this.applicationId.length === 0) {
|
|
66
|
-
throw new Error('applicationId configuration property is empty.
|
|
66
|
+
throw new Error('applicationId configuration property is empty. ' +
|
|
67
|
+
'This configuration is not possible! Please use a proper application ID.');
|
|
67
68
|
}
|
|
68
69
|
return new Configuration_1.Configuration(this.beaconUrl, this.applicationId, this.reportCrash, this.errorHandler, this.reportFatalErrorAsCrash, this.logLevel, this.lifecycleUpdate, this.userOptIn, this.actionNamePrivacy, this.bundleName, this.bundleVersion);
|
|
69
70
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ManualStartupConfiguration = void 0;
|
|
4
|
-
const
|
|
4
|
+
const LogLevelUtil_1 = require("../logging/LogLevelUtil");
|
|
5
5
|
const ConfigurationDefaults_1 = require("./ConfigurationDefaults");
|
|
6
6
|
const ConfigurationPreset_1 = require("./ConfigurationPreset");
|
|
7
7
|
class ManualStartupConfiguration {
|
|
8
|
-
constructor(beaconUrl, applicationId, reportCrash, logLevel, lifecycleUpdate, userOptIn, actionNamePrivacy, bundleName) {
|
|
8
|
+
constructor(beaconUrl, applicationId, reportCrash, logLevel, lifecycleUpdate, userOptIn, actionNamePrivacy, bundleName, bundleVersion) {
|
|
9
9
|
this.reportCrash = ConfigurationDefaults_1.DEFAULT_REPORT_CRASH;
|
|
10
10
|
this.userOptIn = ConfigurationDefaults_1.DEFAULT_USER_OPT_IN;
|
|
11
11
|
if (!applicationId || !beaconUrl) {
|
|
@@ -38,11 +38,14 @@ class ManualStartupConfiguration {
|
|
|
38
38
|
if (bundleName != null) {
|
|
39
39
|
this.bundleName = bundleName;
|
|
40
40
|
}
|
|
41
|
+
if (bundleVersion != null) {
|
|
42
|
+
this.bundleVersion = bundleVersion;
|
|
43
|
+
}
|
|
41
44
|
}
|
|
42
45
|
toString() {
|
|
43
46
|
let configurationString = `{Startup: Manual Start, applicationId: ${this.applicationId}, beaconUrl: ${this.beaconUrl},` +
|
|
44
47
|
` reportCrash: ${this.reportCrash}, errorHandler: ${this.errorHandler}, reportFatalErrorAsCrash: ${this.reportFatalErrorAsCrash},` +
|
|
45
|
-
` lifecycleUpdate: ${this.lifecycleUpdate}, userOptIn: ${this.userOptIn}, actionNamePrivacy: ${this.actionNamePrivacy}, logLevel: ${(0,
|
|
48
|
+
` lifecycleUpdate: ${this.lifecycleUpdate}, userOptIn: ${this.userOptIn}, actionNamePrivacy: ${this.actionNamePrivacy}, logLevel: ${(0, LogLevelUtil_1.LogLevelToString)(this.logLevel)}`;
|
|
46
49
|
if (this.bundleName !== undefined) {
|
|
47
50
|
configurationString += `, bundleName: ${this.bundleName}`;
|
|
48
51
|
}
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.LogLevel = void 0;
|
|
4
4
|
var LogLevel;
|
|
5
5
|
(function (LogLevel) {
|
|
6
6
|
LogLevel[LogLevel["Debug"] = 0] = "Debug";
|
|
7
7
|
LogLevel[LogLevel["Info"] = 1] = "Info";
|
|
8
8
|
})(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
|
|
9
|
-
const LogLevelToString = (level) => {
|
|
10
|
-
if (level === LogLevel.Debug) {
|
|
11
|
-
return 'Debug';
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
return 'Info';
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
exports.LogLevelToString = LogLevelToString;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogLevelToString = void 0;
|
|
4
|
+
const LogLevel_1 = require("./LogLevel");
|
|
5
|
+
const LogLevelToString = (level) => {
|
|
6
|
+
if (level === LogLevel_1.LogLevel.Debug) {
|
|
7
|
+
return 'Debug';
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
return 'Info';
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
exports.LogLevelToString = LogLevelToString;
|
|
@@ -5,7 +5,13 @@ const fileOperation = require('@dynatrace/react-native-plugin/scripts/FileOperat
|
|
|
5
5
|
const INSTRUMENTED_FILE_EXTENSION = require('@dynatrace/react-native-plugin/scripts/util/InstrumentUtil').INSTRUMENTED_FILE_EXTENSION;
|
|
6
6
|
const originalSourceMapInfo = require('./getSourceMapInfoOrig');
|
|
7
7
|
const getSourceMapInfo = (module, options) => {
|
|
8
|
-
|
|
8
|
+
let dataOrig;
|
|
9
|
+
if (originalSourceMapInfo.default !== undefined) {
|
|
10
|
+
dataOrig = originalSourceMapInfo.default(module, options);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
dataOrig = originalSourceMapInfo(module, options);
|
|
14
|
+
}
|
|
9
15
|
try {
|
|
10
16
|
if (!options.excludeSource) {
|
|
11
17
|
const correctPath = module.path.replace(pathsConstants.getApplicationPath(), '') +
|
package/lib/next/Dynatrace.js
CHANGED
|
@@ -68,36 +68,43 @@ class DynatraceImpl {
|
|
|
68
68
|
EventPipeline_1.EventPipeline.insertEvent(event);
|
|
69
69
|
}
|
|
70
70
|
sendExceptionEvent(error, fields) {
|
|
71
|
-
|
|
72
|
-
this.logger.debug(`sendExceptionEvent(${JSON.stringify(error)}, ${JSON.stringify(fieldsCheck)})`);
|
|
71
|
+
this.logger.debug(`sendExceptionEvent(${JSON.stringify(error)}, ${JSON.stringify(fields)})`);
|
|
73
72
|
const event = Object.assign({}, (0, EventCreator_1.createErrorEvent)(error.name, error.message, error.stack));
|
|
74
|
-
let eventValidated =
|
|
73
|
+
let eventValidated = null;
|
|
74
|
+
if (fields) {
|
|
75
|
+
eventValidated = Object.assign({}, SendEventValidation_1.SendEventValidation.modifyEvent(fields));
|
|
76
|
+
}
|
|
75
77
|
eventValidated = Object.assign(Object.assign({}, event), eventValidated);
|
|
76
78
|
(0, EventModifierUtil_1.addIsApiReported)(eventValidated);
|
|
77
79
|
EventPipeline_1.EventPipeline.insertEvent(eventValidated);
|
|
78
80
|
}
|
|
79
|
-
sendEvent(properties
|
|
80
|
-
this.logger.debug(`sendEvent(${JSON.stringify(properties
|
|
81
|
+
sendEvent(properties) {
|
|
82
|
+
this.logger.debug(`sendEvent(${JSON.stringify(properties)})`);
|
|
81
83
|
const eventValidated = SendEventValidation_1.SendEventValidation.modifyEvent(properties);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
if (eventValidated !== null) {
|
|
85
|
+
(0, EventModifierUtil_1.flagEventProperties)(eventValidated);
|
|
86
|
+
(0, EventModifierUtil_1.addIsApiReported)(eventValidated);
|
|
87
|
+
EventPipeline_1.EventPipeline.insertEvent(eventValidated);
|
|
88
|
+
}
|
|
85
89
|
}
|
|
86
90
|
sendSessionPropertyEvent(properties) {
|
|
87
91
|
this.logger.debug(`sendSessionPropertyEvent(${JSON.stringify(properties)})`);
|
|
88
92
|
const eventValidated = SendEventValidation_1.SendSessionPropertyEventValidation.modifyEvent(properties);
|
|
89
|
-
if (eventValidated
|
|
90
|
-
(0, EventModifierUtil_1.containSessionProperties)(eventValidated)) {
|
|
91
|
-
|
|
93
|
+
if (eventValidated !== null) {
|
|
94
|
+
if ((0, EventModifierUtil_1.containSessionProperties)(eventValidated)) {
|
|
95
|
+
eventValidated["characteristics.has_session_properties"] = true;
|
|
96
|
+
}
|
|
97
|
+
(0, EventModifierUtil_1.addIsApiReported)(eventValidated);
|
|
98
|
+
EventPipeline_1.EventPipeline.insertEvent(eventValidated);
|
|
92
99
|
}
|
|
93
|
-
(0, EventModifierUtil_1.addIsApiReported)(eventValidated);
|
|
94
|
-
EventPipeline_1.EventPipeline.insertEvent(eventValidated);
|
|
95
100
|
}
|
|
96
101
|
sendHttpRequestEvent(httpRequestEventBuilder) {
|
|
97
102
|
const sanitizedEvent = httpRequestEventBuilder.build();
|
|
98
103
|
this.logger.debug(`sendHttpRequestEvent(${JSON.stringify(sanitizedEvent)})`);
|
|
99
|
-
|
|
100
|
-
|
|
104
|
+
if (sanitizedEvent !== null) {
|
|
105
|
+
(0, EventModifierUtil_1.flagEventProperties)(sanitizedEvent);
|
|
106
|
+
EventPipeline_1.EventPipeline.insertEvent(sanitizedEvent);
|
|
107
|
+
}
|
|
101
108
|
}
|
|
102
109
|
}
|
|
103
110
|
exports.Dynatrace = new DynatraceImpl(TimestampProvider_1.defaultTimestampProvider);
|
|
@@ -22,7 +22,7 @@ class AppStartObserverImpl {
|
|
|
22
22
|
this.logger.debug(`emitter(${JSON.stringify(data)}})`);
|
|
23
23
|
const appStartEvent = (0, EventCreator_1.createAppStartEvent)(data);
|
|
24
24
|
if (appStartEvent != null) {
|
|
25
|
-
EventPipeline_1.EventPipeline.insertEvent(Object.assign({}, appStartEvent)
|
|
25
|
+
EventPipeline_1.EventPipeline.insertEvent(Object.assign({}, appStartEvent));
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
28
28
|
this.logger.debug(`emitter(${JSON.stringify(data)}}): App Start event ignored!`);
|
|
@@ -20,19 +20,27 @@ class EventPipelineImpl {
|
|
|
20
20
|
ValueRestrictionModifier_1.ValueRestrictionModifier,
|
|
21
21
|
];
|
|
22
22
|
}
|
|
23
|
-
insertEvent(event
|
|
23
|
+
insertEvent(event) {
|
|
24
24
|
this.logger.debug(`insertEvent(${JSON.stringify(event)})`);
|
|
25
|
-
|
|
25
|
+
let isDiscarded = false;
|
|
26
|
+
for (const modifier of this.getEventModifierChain()) {
|
|
26
27
|
try {
|
|
27
|
-
|
|
28
|
+
const eventRv = modifier.modifyEvent(event);
|
|
29
|
+
if (eventRv == null) {
|
|
30
|
+
isDiscarded = true;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
event = eventRv;
|
|
35
|
+
}
|
|
28
36
|
}
|
|
29
|
-
catch (
|
|
37
|
+
catch (_a) {
|
|
30
38
|
if (event != null) {
|
|
31
39
|
event["dt.support.api.has_enrich_exception"] = true;
|
|
32
40
|
}
|
|
33
41
|
}
|
|
34
|
-
}
|
|
35
|
-
if (event != null) {
|
|
42
|
+
}
|
|
43
|
+
if (event != null && !isDiscarded) {
|
|
36
44
|
this.logger.debug(`forwardEvent(${JSON.stringify(event)})`);
|
|
37
45
|
if (event["characteristics.has_app_start"] === true) {
|
|
38
46
|
DynatraceBridge_1.DynatraceNative.forwardAppStartEvent(event, EventSpecContstants_1.ALL_APP_START_KEYS);
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BaseDataEventModifier = void 0;
|
|
4
4
|
const ConfigurationHandler_1 = require("../../../core/configuration/ConfigurationHandler");
|
|
5
5
|
const ConsoleLogger_1 = require("../../../core/logging/ConsoleLogger");
|
|
6
|
+
const EventModifierUtil_1 = require("./EventModifierUtil");
|
|
6
7
|
class BaseDataEventModifier {
|
|
7
8
|
constructor(viewInfo) {
|
|
8
9
|
this.viewInfo = viewInfo;
|
|
@@ -25,6 +26,11 @@ class BaseDataEventModifier {
|
|
|
25
26
|
event["react_native.bundle.version"] =
|
|
26
27
|
bundleVersion;
|
|
27
28
|
}
|
|
29
|
+
const reactNativeVersion = (0, EventModifierUtil_1.getReactNativeVersion)();
|
|
30
|
+
if (reactNativeVersion) {
|
|
31
|
+
event["react_native.version"] =
|
|
32
|
+
reactNativeVersion;
|
|
33
|
+
}
|
|
28
34
|
return event;
|
|
29
35
|
}
|
|
30
36
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.containEventPropertiesInArray = exports.addIsApiReported = exports.flagEventProperties = exports.containEventProperties = exports.containSessionProperties = exports.trimStringValuesInObject = exports.trimString = exports.isObject = exports.flattenAdditionalData = void 0;
|
|
3
|
+
exports.getReactNativeVersion = exports.containEventPropertiesInArray = exports.addIsApiReported = exports.flagEventProperties = exports.containEventProperties = exports.containSessionProperties = exports.trimStringValuesInObject = exports.trimString = exports.isObject = exports.flattenAdditionalData = void 0;
|
|
4
|
+
const ConsoleLogger_1 = require("../../../core/logging/ConsoleLogger");
|
|
4
5
|
const MAX_STRING_LENGTH_FOR_VALUES = 5000;
|
|
6
|
+
const logger = new ConsoleLogger_1.ConsoleLogger('EventModifierUtil');
|
|
5
7
|
const flattenAdditionalData = (obj, parent, res = {}) => {
|
|
6
8
|
for (const key in obj) {
|
|
7
9
|
const propName = parent != null ? parent + '.' + key : key;
|
|
@@ -82,6 +84,24 @@ const containEventPropertiesInArray = (eventEntries) => {
|
|
|
82
84
|
return false;
|
|
83
85
|
};
|
|
84
86
|
exports.containEventPropertiesInArray = containEventPropertiesInArray;
|
|
87
|
+
const getReactNativeVersion = () => {
|
|
88
|
+
const candidates = [
|
|
89
|
+
() => require('react-native').ReactNativeVersion,
|
|
90
|
+
() => require('react-native/Libraries/Core/ReactNativeVersion').version,
|
|
91
|
+
];
|
|
92
|
+
for (const get of candidates) {
|
|
93
|
+
try {
|
|
94
|
+
const v = get();
|
|
95
|
+
if (v)
|
|
96
|
+
return toVersionString(v);
|
|
97
|
+
}
|
|
98
|
+
catch (_a) { }
|
|
99
|
+
}
|
|
100
|
+
logger.debug('Unable to determine React Native version');
|
|
101
|
+
return undefined;
|
|
102
|
+
};
|
|
103
|
+
exports.getReactNativeVersion = getReactNativeVersion;
|
|
104
|
+
const toVersionString = (v) => `${v.major}.${v.minor}.${v.patch}${v.prerelease ? `-${v.prerelease}` : ''}`;
|
|
85
105
|
const trimStringValuesInArray = (arrayData) => {
|
|
86
106
|
arrayData.forEach((value, index, array) => {
|
|
87
107
|
array[index] = trimStringValue(value);
|
|
@@ -26,17 +26,30 @@ class ModifyEventValidation {
|
|
|
26
26
|
if (this.customEventModifierChain.length > 0) {
|
|
27
27
|
const eventCopy = Object.assign({}, event);
|
|
28
28
|
let exceptionOccured = false;
|
|
29
|
-
|
|
29
|
+
let isDiscarded = false;
|
|
30
|
+
for (const modifier of this.customEventModifierChain) {
|
|
30
31
|
try {
|
|
31
|
-
|
|
32
|
+
const eventRv = modifier.modifyEvent(event);
|
|
33
|
+
if (eventRv === null) {
|
|
34
|
+
isDiscarded = true;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
event = eventRv;
|
|
39
|
+
}
|
|
32
40
|
}
|
|
33
|
-
catch (
|
|
41
|
+
catch (_a) {
|
|
34
42
|
if (event != null) {
|
|
35
43
|
exceptionOccured = true;
|
|
36
44
|
}
|
|
37
45
|
}
|
|
38
|
-
}
|
|
39
|
-
|
|
46
|
+
}
|
|
47
|
+
if (!isDiscarded) {
|
|
48
|
+
event = this.sanitizeUserEnrichedEvent(eventCopy, event, exceptionOccured);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
40
53
|
}
|
|
41
54
|
return event;
|
|
42
55
|
}
|
|
@@ -41,6 +41,7 @@ exports.SEND_EVENT_WHITELIST_FIELDS = [
|
|
|
41
41
|
exports.SEND_SESSION_PROPERTY_EVENT_WHITELIST_FIELDS = exports.SEND_EVENT_WHITELIST_FIELDS;
|
|
42
42
|
exports.MODIFY_EVENT_WHITELIST_FIELDS = [
|
|
43
43
|
"exception.stack_trace",
|
|
44
|
+
"url.full",
|
|
44
45
|
];
|
|
45
46
|
exports.MODIFY_EVENT_WHITELIST_NAMESPACE = [
|
|
46
47
|
"session_properties",
|