@dynatrace/react-native-plugin 2.337.3 → 2.341.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +122 -21
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/dynatrace/android/agent/DynatraceRNBridgeImpl.kt +0 -1
- package/files/default.config.js +2 -0
- package/files/plugin.gradle +1 -1
- package/instrumentation/BabelPluginDynatrace.js +1 -1
- package/instrumentation/DynatraceInstrumentation.js +1 -1
- package/instrumentation/jsx/CreateElement.js +5 -9
- package/instrumentation/jsx/ElementHelper.js +5 -6
- package/instrumentation/jsx/JsxDevRuntime.js +33 -31
- package/instrumentation/jsx/JsxRuntime.js +30 -30
- package/instrumentation/jsx/JsxRuntimeHelpers.js +14 -0
- package/instrumentation/jsx/components/ClassComponent.js +6 -9
- package/instrumentation/jsx/components/ComponentUtil.js +24 -25
- package/instrumentation/libs/UserInteraction.js +27 -24
- package/instrumentation/libs/react-native/RefreshControl.js +5 -9
- package/instrumentation/libs/react-navigation/ReactNavigation.js +7 -4
- package/instrumentation/libs/withOnPressMonitoring.js +67 -55
- package/lib/core/Application.js +5 -2
- package/lib/core/Dynatrace.js +113 -44
- package/lib/core/DynatraceAction.js +78 -23
- package/lib/core/DynatraceInternal.js +39 -26
- package/lib/core/DynatraceRootAction.js +6 -3
- package/lib/core/DynatraceWebRequestTiming.js +25 -4
- package/lib/core/ErrorHandler.js +46 -19
- package/lib/core/NullAction.js +1 -3
- package/lib/core/logging/ConsoleLogger.js +17 -6
- package/lib/core/logging/LogMessages.js +764 -0
- package/lib/core/logging/LogType.js +9 -0
- package/lib/core/util/JsonUtils.js +6 -0
- package/lib/features/ui-interaction/IUserInteractionEvent.js +1 -1
- package/lib/features/ui-interaction/Runtime.js +7 -3
- package/lib/features/ui-interaction/TouchMetaResolver.js +4 -3
- package/lib/next/Dynatrace.js +42 -22
- package/lib/next/appstart/AppStartObserver.js +7 -2
- package/lib/next/events/EventPipeline.js +12 -5
- package/lib/next/events/EventTimestamp.js +5 -1
- package/lib/next/events/ExceptionEventData.js +1 -1
- package/lib/next/events/HttpRequestEventData.js +18 -9
- package/lib/next/events/interface/HttpRequestEventDataTypes.js +2 -0
- package/lib/next/events/modifier/BaseDataEventModifier.js +4 -1
- package/lib/next/events/modifier/EventModifierUtil.js +12 -5
- package/lib/next/events/modifier/ModifyEventValidation.js +99 -58
- package/lib/next/events/modifier/SendEventValidation.js +10 -4
- package/lib/next/events/modifier/StringLengthEventModifier.js +4 -1
- package/lib/next/events/modifier/ValueRestrictionModifier.js +5 -1
- package/lib/next/events/spec/EventSpecContstants.js +6 -2
- package/lib/next/util/TraceContextUtils.js +4 -3
- package/package.json +7 -5
- package/react-native-dynatrace.podspec +1 -1
- package/scripts/Config.js +7 -3
- package/scripts/DebugFlag.js +20 -0
- package/scripts/FileOperationHelper.js +15 -39
- package/scripts/Logger.js +2 -3
- package/scripts/core/InstrumentCall.js +101 -80
- package/scripts/util/CustomArgumentUtil.js +8 -6
- package/types.d.ts +159 -8
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ModifyEventValidation = void 0;
|
|
4
4
|
const ConsoleLogger_1 = require("../../../core/logging/ConsoleLogger");
|
|
5
|
+
const LogMessages_1 = require("../../../core/logging/LogMessages");
|
|
5
6
|
const EventSpecContstants_1 = require("../spec/EventSpecContstants");
|
|
6
7
|
const EventModifierUtil_1 = require("./EventModifierUtil");
|
|
8
|
+
const JsonUtils_1 = require("../../../core/util/JsonUtils");
|
|
7
9
|
class ModifyEventValidation {
|
|
8
10
|
constructor() {
|
|
9
11
|
this.customEventModifierChain = [];
|
|
@@ -22,46 +24,30 @@ class ModifyEventValidation {
|
|
|
22
24
|
return false;
|
|
23
25
|
}
|
|
24
26
|
modifyEvent(event) {
|
|
25
|
-
if (this.customEventModifierChain.length
|
|
26
|
-
|
|
27
|
-
let exceptionOccured = false;
|
|
28
|
-
let isDiscarded = false;
|
|
29
|
-
for (const modifier of this.customEventModifierChain) {
|
|
30
|
-
try {
|
|
31
|
-
const eventRv = modifier.modifyEvent(event);
|
|
32
|
-
if (!eventRv) {
|
|
33
|
-
isDiscarded = true;
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
event = eventRv;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
catch (_a) {
|
|
41
|
-
if (event != null) {
|
|
42
|
-
exceptionOccured = true;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (!isDiscarded) {
|
|
47
|
-
event = this.sanitizeUserEnrichedEvent(eventCopy, event, exceptionOccured);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
27
|
+
if (this.customEventModifierChain.length === 0) {
|
|
28
|
+
return event;
|
|
52
29
|
}
|
|
53
|
-
|
|
30
|
+
const eventCopy = Object.assign({}, event);
|
|
31
|
+
const modifiedEventResult = this.applyCustomModifiers(event);
|
|
32
|
+
if (modifiedEventResult.isDiscarded) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return this.sanitizeUserEnrichedEvent(eventCopy, modifiedEventResult.event, modifiedEventResult.exceptionOccured);
|
|
54
36
|
}
|
|
55
37
|
isCustomPropertiesAllowed(key, hasSessionPropertyCharacteristics) {
|
|
56
38
|
if (hasSessionPropertyCharacteristics) {
|
|
57
39
|
if (key.startsWith(`${"event_properties"}.`)) {
|
|
58
|
-
this.logger.debug(
|
|
40
|
+
this.logger.debug(LogMessages_1.LogMessage.EVENT_PROPERTIES_FILTERED, {
|
|
41
|
+
key,
|
|
42
|
+
});
|
|
59
43
|
return false;
|
|
60
44
|
}
|
|
61
45
|
}
|
|
62
46
|
else {
|
|
63
47
|
if (key.startsWith(`${"session_properties"}.`)) {
|
|
64
|
-
this.logger.debug(
|
|
48
|
+
this.logger.debug(LogMessages_1.LogMessage.SESSION_PROPERTIES_FILTERED, {
|
|
49
|
+
key,
|
|
50
|
+
});
|
|
65
51
|
return false;
|
|
66
52
|
}
|
|
67
53
|
}
|
|
@@ -78,16 +64,22 @@ class ModifyEventValidation {
|
|
|
78
64
|
return false;
|
|
79
65
|
}
|
|
80
66
|
}
|
|
81
|
-
this.logger.debug(
|
|
67
|
+
this.logger.debug(LogMessages_1.LogMessage.KEY_NAME_FORBIDDEN, { key });
|
|
82
68
|
return true;
|
|
83
69
|
}
|
|
84
70
|
sanitizeUserEnrichedEvent(originalEvent, userEnrichedEvent, externalException) {
|
|
85
71
|
if (!(0, EventModifierUtil_1.isObject)(userEnrichedEvent)) {
|
|
86
|
-
this.logger.debug(
|
|
72
|
+
this.logger.debug(LogMessages_1.LogMessage.SANITIZE_EVENT_NOT_OBJECT, {
|
|
73
|
+
originalEvent: JSON.stringify(originalEvent),
|
|
74
|
+
userEnrichedEvent: JSON.stringify(userEnrichedEvent),
|
|
75
|
+
});
|
|
87
76
|
return originalEvent;
|
|
88
77
|
}
|
|
89
78
|
if (userEnrichedEvent === originalEvent) {
|
|
90
|
-
this.logger.debug(
|
|
79
|
+
this.logger.debug(LogMessages_1.LogMessage.SANITIZE_EVENT_NOT_CHANGED, {
|
|
80
|
+
originalEvent: JSON.stringify(originalEvent),
|
|
81
|
+
userEnrichedEvent: JSON.stringify(userEnrichedEvent),
|
|
82
|
+
});
|
|
91
83
|
return originalEvent;
|
|
92
84
|
}
|
|
93
85
|
let overriddenKeys = originalEvent["dt.support.api.overridden_fields"];
|
|
@@ -144,32 +136,15 @@ class ModifyEventValidation {
|
|
|
144
136
|
validEntries.push([prop, value]);
|
|
145
137
|
continue;
|
|
146
138
|
}
|
|
147
|
-
|
|
139
|
+
const validationResult = this.validateModifiedEntry(prop, value, originalValue, originalJSONEvent, overriddenKeys);
|
|
140
|
+
if (validationResult.entry !== undefined) {
|
|
141
|
+
validEntries.push(validationResult.entry);
|
|
142
|
+
}
|
|
143
|
+
if (validationResult.droppedCustomProperties) {
|
|
148
144
|
droppedCustomProperties = true;
|
|
149
|
-
continue;
|
|
150
145
|
}
|
|
151
|
-
|
|
152
|
-
const isForbiddenKey = this.isKeyNameForbidden(prop, isNewlyAdded);
|
|
153
|
-
if (isForbiddenKey) {
|
|
154
|
-
if (!isNewlyAdded) {
|
|
155
|
-
validEntries.push([prop, originalValue]);
|
|
156
|
-
}
|
|
146
|
+
if (validationResult.droppedProperties) {
|
|
157
147
|
droppedProperties = true;
|
|
158
|
-
continue;
|
|
159
|
-
}
|
|
160
|
-
if (!isNewlyAdded && !overriddenKeys.includes(prop)) {
|
|
161
|
-
overriddenKeys.push(prop);
|
|
162
|
-
}
|
|
163
|
-
if (!isNewlyAdded &&
|
|
164
|
-
EventSpecContstants_1.MODIFY_EVENT_WHITELIST_STRING_FIELDS.includes(prop)) {
|
|
165
|
-
const maximumLength = Math.max(originalJSONEvent[prop].toString().length, EventSpecContstants_1.MAX_CUSTOM_EVENT_VALUE_LENGTH);
|
|
166
|
-
validEntries.push([
|
|
167
|
-
prop,
|
|
168
|
-
(0, EventModifierUtil_1.trimString)(prop, value.toString(), maximumLength),
|
|
169
|
-
]);
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
validEntries.push([prop, value]);
|
|
173
148
|
}
|
|
174
149
|
}
|
|
175
150
|
if (droppedCustomProperties) {
|
|
@@ -230,6 +205,43 @@ class ModifyEventValidation {
|
|
|
230
205
|
return entries;
|
|
231
206
|
}, resultEntries);
|
|
232
207
|
}
|
|
208
|
+
validateModifiedEntry(prop, value, originalValue, originalJSONEvent, overriddenKeys) {
|
|
209
|
+
if (!this.isCustomPropertiesAllowed(prop, originalJSONEvent["characteristics.has_session_properties"] === true)) {
|
|
210
|
+
return {
|
|
211
|
+
droppedCustomProperties: true,
|
|
212
|
+
droppedProperties: false,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
const isNewlyAdded = originalValue === undefined;
|
|
216
|
+
const isForbiddenKey = this.isKeyNameForbidden(prop, isNewlyAdded);
|
|
217
|
+
if (isForbiddenKey) {
|
|
218
|
+
return {
|
|
219
|
+
entry: isNewlyAdded ? undefined : [prop, originalValue],
|
|
220
|
+
droppedCustomProperties: false,
|
|
221
|
+
droppedProperties: true,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
if (!isNewlyAdded && !overriddenKeys.includes(prop)) {
|
|
225
|
+
overriddenKeys.push(prop);
|
|
226
|
+
}
|
|
227
|
+
if (!isNewlyAdded &&
|
|
228
|
+
EventSpecContstants_1.MODIFY_EVENT_WHITELIST_STRING_FIELDS.includes(prop)) {
|
|
229
|
+
const maximumLength = Math.max(JsonUtils_1.JsonUtils.stringify(originalJSONEvent[prop]).length, EventSpecContstants_1.MAX_CUSTOM_EVENT_VALUE_LENGTH);
|
|
230
|
+
return {
|
|
231
|
+
entry: [
|
|
232
|
+
prop,
|
|
233
|
+
(0, EventModifierUtil_1.trimString)(prop, JsonUtils_1.JsonUtils.stringify(value), maximumLength),
|
|
234
|
+
],
|
|
235
|
+
droppedCustomProperties: false,
|
|
236
|
+
droppedProperties: false,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
entry: [prop, value],
|
|
241
|
+
droppedCustomProperties: false,
|
|
242
|
+
droppedProperties: false,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
233
245
|
validateAddedEntries(addedEntries) {
|
|
234
246
|
const validEntries = [];
|
|
235
247
|
let droppedProperties = false;
|
|
@@ -263,6 +275,33 @@ class ModifyEventValidation {
|
|
|
263
275
|
}
|
|
264
276
|
return validEntries;
|
|
265
277
|
}
|
|
278
|
+
applyCustomModifiers(event) {
|
|
279
|
+
let currentEvent = event;
|
|
280
|
+
let exceptionOccured = false;
|
|
281
|
+
for (const modifier of this.customEventModifierChain) {
|
|
282
|
+
try {
|
|
283
|
+
const eventRv = modifier.modifyEvent(currentEvent);
|
|
284
|
+
if (!eventRv) {
|
|
285
|
+
return {
|
|
286
|
+
event: currentEvent,
|
|
287
|
+
exceptionOccured,
|
|
288
|
+
isDiscarded: true,
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
currentEvent = eventRv;
|
|
292
|
+
}
|
|
293
|
+
catch (_a) {
|
|
294
|
+
if (currentEvent != null) {
|
|
295
|
+
exceptionOccured = true;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return {
|
|
300
|
+
event: currentEvent,
|
|
301
|
+
exceptionOccured,
|
|
302
|
+
isDiscarded: false,
|
|
303
|
+
};
|
|
304
|
+
}
|
|
266
305
|
enforcePropertyLimit(entries) {
|
|
267
306
|
const result = [];
|
|
268
307
|
let propertyCount = 0;
|
|
@@ -272,8 +311,10 @@ class ModifyEventValidation {
|
|
|
272
311
|
if ((0, EventModifierUtil_1.isKeyCustomProperty)(key)) {
|
|
273
312
|
propertyCount++;
|
|
274
313
|
if (propertyCount > EventSpecContstants_1.MAX_CUSTOM_EVENT_FIELDS) {
|
|
275
|
-
this.logger.debug(
|
|
276
|
-
|
|
314
|
+
this.logger.debug(LogMessages_1.LogMessage.PROPERTY_LIMIT_EXCEEDED, {
|
|
315
|
+
key,
|
|
316
|
+
limit: EventSpecContstants_1.MAX_CUSTOM_EVENT_FIELDS,
|
|
317
|
+
});
|
|
277
318
|
droppedCustomProperties = true;
|
|
278
319
|
continue;
|
|
279
320
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SendSessionPropertyEventValidation = exports.SendEventValidation = void 0;
|
|
3
|
+
exports.SendExceptionEventValidation = exports.SendSessionPropertyEventValidation = exports.SendEventValidation = void 0;
|
|
4
4
|
const ConsoleLogger_1 = require("../../../core/logging/ConsoleLogger");
|
|
5
|
+
const LogMessages_1 = require("../../../core/logging/LogMessages");
|
|
5
6
|
const TimestampProvider_1 = require("../../provider/TimestampProvider");
|
|
6
7
|
const EventTimestamp_1 = require("../EventTimestamp");
|
|
7
8
|
const EventSpecContstants_1 = require("../spec/EventSpecContstants");
|
|
@@ -14,7 +15,9 @@ class SendEventValidationImpl {
|
|
|
14
15
|
this.fieldWhitelist = fieldWhitelist;
|
|
15
16
|
}
|
|
16
17
|
modifyEvent(event) {
|
|
17
|
-
this.logger.debug(
|
|
18
|
+
this.logger.debug(LogMessages_1.LogMessage.MODIFY_EVENT, {
|
|
19
|
+
event: JSON.stringify(event),
|
|
20
|
+
});
|
|
18
21
|
if (event == null) {
|
|
19
22
|
return null;
|
|
20
23
|
}
|
|
@@ -90,7 +93,9 @@ class SendEventValidationImpl {
|
|
|
90
93
|
if ((0, EventModifierUtil_1.isKeyCustomProperty)(entry[0])) {
|
|
91
94
|
amountOfCustomProperties++;
|
|
92
95
|
if (amountOfCustomProperties > EventSpecContstants_1.MAX_CUSTOM_EVENT_FIELDS) {
|
|
93
|
-
this.logger.debug(
|
|
96
|
+
this.logger.debug(LogMessages_1.LogMessage.EVENT_PROPERTY_LIMIT_EXCEEDED, {
|
|
97
|
+
key: entry[0],
|
|
98
|
+
});
|
|
94
99
|
droppedCustomProperties = true;
|
|
95
100
|
return;
|
|
96
101
|
}
|
|
@@ -122,9 +127,10 @@ class SendEventValidationImpl {
|
|
|
122
127
|
if (this.fieldWhitelist.includes(key)) {
|
|
123
128
|
return true;
|
|
124
129
|
}
|
|
125
|
-
this.logger.debug(
|
|
130
|
+
this.logger.debug(LogMessages_1.LogMessage.KEY_NAME_NOT_ALLOWED, { key });
|
|
126
131
|
return false;
|
|
127
132
|
}
|
|
128
133
|
}
|
|
129
134
|
exports.SendEventValidation = new SendEventValidationImpl(TimestampProvider_1.defaultTimestampProvider, EventSpecContstants_1.SEND_EVENT_WHITELIST_NAMESPACES, EventSpecContstants_1.SEND_EVENT_WHITELIST_FIELDS, 'SendEventValidation');
|
|
130
135
|
exports.SendSessionPropertyEventValidation = new SendEventValidationImpl(TimestampProvider_1.defaultTimestampProvider, EventSpecContstants_1.SEND_SESSION_PROPERTY_EVENT_WHITELIST_NAMESPACES, EventSpecContstants_1.SEND_SESSION_PROPERTY_EVENT_WHITELIST_FIELDS, 'SendSessionPropertyEventValidation');
|
|
136
|
+
exports.SendExceptionEventValidation = new SendEventValidationImpl(TimestampProvider_1.defaultTimestampProvider, EventSpecContstants_1.SEND_EXCEPTION_EVENT_WHITELIST_NAMESPACES, EventSpecContstants_1.SEND_EXCEPTION_EVENT_WHITELIST_FIELDS, 'SendExceptionEventValidation');
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StringLengthEventModifier = void 0;
|
|
4
4
|
const ConsoleLogger_1 = require("../../../core/logging/ConsoleLogger");
|
|
5
|
+
const LogMessages_1 = require("../../../core/logging/LogMessages");
|
|
5
6
|
const EventSpecContstants_1 = require("../spec/EventSpecContstants");
|
|
6
7
|
const EventModifierUtil_1 = require("./EventModifierUtil");
|
|
7
8
|
class StringLengthEventModifier {
|
|
@@ -10,7 +11,9 @@ class StringLengthEventModifier {
|
|
|
10
11
|
}
|
|
11
12
|
modifyEvent(event) {
|
|
12
13
|
if (event == null) {
|
|
13
|
-
this.logger.debug(
|
|
14
|
+
this.logger.debug(LogMessages_1.LogMessage.MODIFY_EVENT_NULL, {
|
|
15
|
+
event: JSON.stringify(event),
|
|
16
|
+
});
|
|
14
17
|
return event;
|
|
15
18
|
}
|
|
16
19
|
if (event["characteristics.is_api_reported"] ===
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ValueRestrictionModifier = void 0;
|
|
4
4
|
const ConsoleLogger_1 = require("../../../core/logging/ConsoleLogger");
|
|
5
|
+
const LogMessages_1 = require("../../../core/logging/LogMessages");
|
|
5
6
|
const EventModifierUtil_1 = require("./EventModifierUtil");
|
|
6
7
|
class ValueRestrictionModifierImpl {
|
|
7
8
|
constructor() {
|
|
@@ -23,7 +24,10 @@ class ValueRestrictionModifierImpl {
|
|
|
23
24
|
if (Object.prototype.hasOwnProperty.call(obj, key) &&
|
|
24
25
|
(this.valueHasRestrictedValues(obj[key]) ||
|
|
25
26
|
obj[key] === undefined)) {
|
|
26
|
-
this.logger.debug(
|
|
27
|
+
this.logger.debug(LogMessages_1.LogMessage.EVENT_NON_FINITE_VALUE, {
|
|
28
|
+
key,
|
|
29
|
+
value: JSON.stringify(obj[key]),
|
|
30
|
+
});
|
|
27
31
|
return true;
|
|
28
32
|
}
|
|
29
33
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ALL_APP_START_KEYS = exports.EVENT_WHITELIST_SIZE = exports.MODIFY_EVENT_WHITELIST_NAMESPACE = exports.MODIFY_EVENT_WHITELIST_STRING_FIELDS = exports.MODIFY_EVENT_WHITELIST_FIELDS = exports.SEND_SESSION_PROPERTY_EVENT_WHITELIST_FIELDS = exports.SEND_EVENT_WHITELIST_FIELDS = exports.SEND_SESSION_PROPERTY_EVENT_WHITELIST_NAMESPACES = exports.SEND_EVENT_WHITELIST_NAMESPACES = exports.AllCharacteristicsKeys = exports.KEY_NAME_REGEX = exports.MAX_CUSTOM_EVENT_VALUE_LENGTH = exports.MAX_CUSTOM_EVENT_KEY_LENGTH = exports.MAX_CUSTOM_EVENT_FIELDS = exports.SPECIFICATION_VERSION = void 0;
|
|
3
|
+
exports.ALL_APP_START_KEYS = exports.EVENT_WHITELIST_SIZE = exports.MODIFY_EVENT_WHITELIST_NAMESPACE = exports.MODIFY_EVENT_WHITELIST_STRING_FIELDS = exports.MODIFY_EVENT_WHITELIST_FIELDS = exports.SEND_SESSION_PROPERTY_EVENT_WHITELIST_FIELDS = exports.SEND_EXCEPTION_EVENT_WHITELIST_FIELDS = exports.SEND_EVENT_WHITELIST_FIELDS = exports.SEND_SESSION_PROPERTY_EVENT_WHITELIST_NAMESPACES = exports.SEND_EXCEPTION_EVENT_WHITELIST_NAMESPACES = exports.SEND_EVENT_WHITELIST_NAMESPACES = exports.AllCharacteristicsKeys = exports.KEY_NAME_REGEX = exports.MAX_CUSTOM_EVENT_VALUE_LENGTH = exports.MAX_CUSTOM_EVENT_KEY_LENGTH = exports.MAX_CUSTOM_EVENT_FIELDS = exports.SPECIFICATION_VERSION = void 0;
|
|
4
4
|
exports.SPECIFICATION_VERSION = '0.23.0';
|
|
5
5
|
exports.MAX_CUSTOM_EVENT_FIELDS = 50;
|
|
6
6
|
exports.MAX_CUSTOM_EVENT_KEY_LENGTH = 100;
|
|
@@ -32,13 +32,17 @@ exports.AllCharacteristicsKeys = Object.keys(characteristicsKeyMap);
|
|
|
32
32
|
exports.SEND_EVENT_WHITELIST_NAMESPACES = [
|
|
33
33
|
"event_properties",
|
|
34
34
|
];
|
|
35
|
+
exports.SEND_EXCEPTION_EVENT_WHITELIST_NAMESPACES = [
|
|
36
|
+
"event_properties",
|
|
37
|
+
];
|
|
35
38
|
exports.SEND_SESSION_PROPERTY_EVENT_WHITELIST_NAMESPACES = [
|
|
36
39
|
"session_properties",
|
|
37
40
|
];
|
|
38
41
|
exports.SEND_EVENT_WHITELIST_FIELDS = [
|
|
39
42
|
"duration",
|
|
40
43
|
];
|
|
41
|
-
exports.
|
|
44
|
+
exports.SEND_EXCEPTION_EVENT_WHITELIST_FIELDS = [];
|
|
45
|
+
exports.SEND_SESSION_PROPERTY_EVENT_WHITELIST_FIELDS = [];
|
|
42
46
|
exports.MODIFY_EVENT_WHITELIST_FIELDS = [
|
|
43
47
|
"exception.stack_trace",
|
|
44
48
|
"url.full",
|
|
@@ -2,22 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.trimTraceState = exports.generateTracestate = exports.generateTraceparentHeader = exports.parseTraceparent = void 0;
|
|
4
4
|
const ConsoleLogger_1 = require("../../core/logging/ConsoleLogger");
|
|
5
|
+
const LogMessages_1 = require("../../core/logging/LogMessages");
|
|
5
6
|
const ConfigurationHandler_1 = require("../../core/configuration/ConfigurationHandler");
|
|
6
7
|
const logger = new ConsoleLogger_1.ConsoleLogger('TraceContextUtils');
|
|
7
8
|
const parseTraceparent = (traceparent) => {
|
|
8
9
|
const traceparentRegex = /^[0-9a-f]{2}-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/i;
|
|
9
10
|
const match = traceparentRegex.exec(traceparent);
|
|
10
11
|
if (!match) {
|
|
11
|
-
logger.debug(
|
|
12
|
+
logger.debug(LogMessages_1.LogMessage.HTTP_REQUEST_TRACEPARENT_FORMAT_INVALID);
|
|
12
13
|
return undefined;
|
|
13
14
|
}
|
|
14
15
|
const [, traceId, parentId] = match;
|
|
15
16
|
if (allZeros(traceId)) {
|
|
16
|
-
logger.debug(
|
|
17
|
+
logger.debug(LogMessages_1.LogMessage.HTTP_REQUEST_TRACEPARENT_TRACE_ID_ZEROS);
|
|
17
18
|
return undefined;
|
|
18
19
|
}
|
|
19
20
|
if (allZeros(parentId)) {
|
|
20
|
-
logger.debug(
|
|
21
|
+
logger.debug(LogMessages_1.LogMessage.HTTP_REQUEST_TRACEPARENT_PARENT_ID_ZEROS);
|
|
21
22
|
return undefined;
|
|
22
23
|
}
|
|
23
24
|
return { traceId, parentId };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynatrace/react-native-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.341.1",
|
|
4
4
|
"description": "This plugin gives you the ability to use the Dynatrace Mobile agent in your react native application.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "types.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"test": "jest --runInBand",
|
|
27
27
|
"test:coverage": "jest --runInBand --coverage",
|
|
28
28
|
"test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand",
|
|
29
|
-
"test:local": "npm run lint && node runner.js test",
|
|
29
|
+
"test:local": "node cleanMacFiles.js && npm run lint && node runner.js test",
|
|
30
30
|
"test:examples": "node tests/jsdoc_examples/RunJestTest.js",
|
|
31
31
|
"tsc:local": "tsc -p tsconfig.local.json",
|
|
32
32
|
"tsc:types": "tsc -p tsconfig.types.json && rollup -c rollup.config.types.mjs",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
"author": "Dynatrace",
|
|
50
50
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@babel/runtime": "^
|
|
52
|
+
"@babel/runtime": "^8.0.0",
|
|
53
53
|
"jscodeshift": "^17.3.0",
|
|
54
54
|
"plist": "^3.1.0",
|
|
55
55
|
"proxy-polyfill": "^0.3.2",
|
|
56
|
-
"semver": "^7.8.
|
|
56
|
+
"semver": "^7.8.5"
|
|
57
57
|
},
|
|
58
58
|
"homepage": "https://www.dynatrace.com/",
|
|
59
59
|
"peerDependencies": {
|
|
@@ -67,7 +67,9 @@
|
|
|
67
67
|
"ast-types": "npm:ast-types-x"
|
|
68
68
|
},
|
|
69
69
|
"ast-types": "npm:ast-types-x",
|
|
70
|
-
"flow-parser": "0.160"
|
|
70
|
+
"flow-parser": "0.160",
|
|
71
|
+
"tmp": ">=0.2.6",
|
|
72
|
+
"ws": "^7.5.11"
|
|
71
73
|
},
|
|
72
74
|
"devDependencies": {
|
|
73
75
|
"@babel/plugin-transform-class-properties": "^7.27.1",
|
|
@@ -111,7 +111,7 @@ Pod::Spec.new do |s|
|
|
|
111
111
|
#
|
|
112
112
|
|
|
113
113
|
s.dependency "React"
|
|
114
|
-
s.dependency 'Dynatrace', '~> 8.
|
|
114
|
+
s.dependency 'Dynatrace', '~> 8.341.1.1010'
|
|
115
115
|
|
|
116
116
|
# Allows for better compatibility for older and newer versions
|
|
117
117
|
if defined?(install_modules_dependencies)
|
package/scripts/Config.js
CHANGED
|
@@ -36,7 +36,7 @@ exports.defaultConfig = {
|
|
|
36
36
|
navigation: {
|
|
37
37
|
enabled: true,
|
|
38
38
|
},
|
|
39
|
-
userInteraction:
|
|
39
|
+
userInteraction: true,
|
|
40
40
|
sourcemap: {
|
|
41
41
|
enabled: true,
|
|
42
42
|
androidSourcemapLocation: 'app/build/generated/sourcemaps/react/release/index.android.bundle.map',
|
|
@@ -46,7 +46,7 @@ exports.defaultConfig = {
|
|
|
46
46
|
const readConfigDefault = () => {
|
|
47
47
|
const customArguments = (0, CustomArgumentUtil_1.readCustomArguments)();
|
|
48
48
|
const configPath = customArguments.isCustomConfigurationPathSet()
|
|
49
|
-
? path.
|
|
49
|
+
? path.resolve(PathsConstants_1.default.getApplicationPath(), customArguments.getCustomConfigurationPath())
|
|
50
50
|
: PathsConstants_1.default.getConfigFilePath();
|
|
51
51
|
return (0, exports.readConfig)(configPath);
|
|
52
52
|
};
|
|
@@ -80,8 +80,12 @@ exports.checkConfiguration = checkConfiguration;
|
|
|
80
80
|
const createNewConfiguration = (pathToDynatraceConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
81
81
|
const defaultConfigContent = yield FileOperationHelper_1.default.readTextFromFile(PathsConstants_1.default.getDefaultConfig());
|
|
82
82
|
yield FileOperationHelper_1.default.writeTextToFile(pathToDynatraceConfig, defaultConfigContent);
|
|
83
|
-
|
|
83
|
+
logConfigCreatedMessage();
|
|
84
84
|
});
|
|
85
|
+
const logConfigCreatedMessage = () => {
|
|
86
|
+
const message = 'Created dynatrace.config.js - Please insert your configuration and update the file!';
|
|
87
|
+
Logger_1.default.logMessageSync(message, Logger_1.default.INFO);
|
|
88
|
+
};
|
|
85
89
|
const patchMalformedConfiguration = (pathToDynatraceConfig) => {
|
|
86
90
|
const configContent = FileOperationHelper_1.default.readTextFromFileSync(pathToDynatraceConfig);
|
|
87
91
|
if (configContent.indexOf('\u200B') !== -1) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.isDebugEnabled = void 0;
|
|
5
|
+
const PathsConstants_1 = require("./PathsConstants");
|
|
6
|
+
let cached;
|
|
7
|
+
const isDebugEnabled = () => {
|
|
8
|
+
var _a;
|
|
9
|
+
if (cached === undefined) {
|
|
10
|
+
try {
|
|
11
|
+
const { readConfig } = require('./Config');
|
|
12
|
+
cached = ((_a = readConfig(PathsConstants_1.default.getConfigFilePath()).react) === null || _a === void 0 ? void 0 : _a.debug) === true;
|
|
13
|
+
}
|
|
14
|
+
catch (_b) {
|
|
15
|
+
cached = false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return cached;
|
|
19
|
+
};
|
|
20
|
+
exports.isDebugEnabled = isDebugEnabled;
|
|
@@ -71,49 +71,25 @@ const mkdirSyncRecursive = (directory) => {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
const deleteDirectory = (dir) =>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
fs.readdir(dir, (err, files) => {
|
|
80
|
-
if (err) {
|
|
81
|
-
return reject(err);
|
|
82
|
-
}
|
|
83
|
-
Promise.all(files.map((file) => deleteFile(path.join(dir, file)))).then(() => {
|
|
84
|
-
fs.rmdir(dir, (err) => {
|
|
85
|
-
if (err) {
|
|
86
|
-
return reject(err);
|
|
87
|
-
}
|
|
88
|
-
resolve();
|
|
89
|
-
});
|
|
90
|
-
}).catch(reject);
|
|
91
|
-
});
|
|
92
|
-
});
|
|
74
|
+
const deleteDirectory = (dir) => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
|
+
yield fsPromise.access(dir);
|
|
76
|
+
const files = yield fsPromise.readdir(dir);
|
|
77
|
+
yield Promise.all(files.map((file) => deleteFile(path.join(dir, file))));
|
|
78
|
+
yield fsPromise.rmdir(dir);
|
|
93
79
|
});
|
|
94
80
|
const deleteDirectorySync = (dir) => {
|
|
95
81
|
fs.accessSync(dir);
|
|
96
82
|
const files = fs.readdirSync(dir);
|
|
97
|
-
files.
|
|
83
|
+
files.forEach((file) => deleteFileSync(path.join(dir, file)));
|
|
98
84
|
fs.rmdirSync(dir);
|
|
99
85
|
};
|
|
100
|
-
const deleteFile = (filePath) =>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
fs.unlink(filePath, (err) => {
|
|
110
|
-
if (err) {
|
|
111
|
-
return reject(err);
|
|
112
|
-
}
|
|
113
|
-
resolve();
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
});
|
|
86
|
+
const deleteFile = (filePath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
87
|
+
const stats = yield fsPromise.lstat(filePath);
|
|
88
|
+
if (stats.isDirectory()) {
|
|
89
|
+
yield deleteDirectory(filePath);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
yield fsPromise.unlink(filePath);
|
|
117
93
|
});
|
|
118
94
|
const deleteFileSync = (filePath) => {
|
|
119
95
|
const stats = fs.lstatSync(filePath);
|
|
@@ -157,7 +133,7 @@ const copyDirectory = (from, to) => {
|
|
|
157
133
|
}
|
|
158
134
|
});
|
|
159
135
|
};
|
|
160
|
-
const allowedRootFolders = ['src', 'node_modules'];
|
|
136
|
+
const allowedRootFolders = new Set(['src', 'node_modules']);
|
|
161
137
|
const getAllFiles = (log, dir, base = '', isRoot = false) => __awaiter(void 0, void 0, void 0, function* () {
|
|
162
138
|
const entries = yield fsPromise.readdir(dir);
|
|
163
139
|
let files = [];
|
|
@@ -166,7 +142,7 @@ const getAllFiles = (log, dir, base = '', isRoot = false) => __awaiter(void 0, v
|
|
|
166
142
|
const relPath = path.join(base, entry);
|
|
167
143
|
const stat = yield fsPromise.stat(fullPath);
|
|
168
144
|
if (stat.isDirectory()) {
|
|
169
|
-
if (isRoot && !allowedRootFolders.
|
|
145
|
+
if (isRoot && !allowedRootFolders.has(entry)) {
|
|
170
146
|
yield log(`🔸 Skipping folder: ${entry}`);
|
|
171
147
|
continue;
|
|
172
148
|
}
|
package/scripts/Logger.js
CHANGED
|
@@ -5,7 +5,7 @@ const fs = require("fs");
|
|
|
5
5
|
const nodePath = require("path");
|
|
6
6
|
const FileOperationHelper_1 = require("./FileOperationHelper");
|
|
7
7
|
const PathsConstants_1 = require("./PathsConstants");
|
|
8
|
-
const
|
|
8
|
+
const DebugFlag_1 = require("./DebugFlag");
|
|
9
9
|
const ERROR = 0;
|
|
10
10
|
const INFO = 1;
|
|
11
11
|
const WARNING = 2;
|
|
@@ -26,8 +26,7 @@ const closeLogFile = () => {
|
|
|
26
26
|
.catch(errorHandling);
|
|
27
27
|
};
|
|
28
28
|
const logErrorSync = (_message) => {
|
|
29
|
-
|
|
30
|
-
if (config.react !== undefined && config.react.debug) {
|
|
29
|
+
if ((0, DebugFlag_1.isDebugEnabled)()) {
|
|
31
30
|
logMessageSync(_message, ERROR, true);
|
|
32
31
|
}
|
|
33
32
|
};
|