@dynatrace/react-native-plugin 2.329.1 → 2.331.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 +8 -4
- package/android/build.gradle +1 -1
- package/files/plugin.gradle +1 -1
- package/instrumentation/DynatraceInstrumentation.js +1 -1
- package/lib/next/Dynatrace.js +35 -0
- package/lib/next/DynatraceArgValidators.js +10 -0
- package/lib/next/events/HttpRequestEventData.js +22 -20
- package/lib/next/events/modifier/ModifyEventValidation.js +2 -4
- package/lib/next/events/spec/EventSpecContstants.js +2 -2
- package/package.json +4 -3
- package/react-native-dynatrace.podspec +1 -1
- package/types.d.ts +24 -23
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.331.1.1004
|
|
37
|
+
* iOS Agent: 8.331.1.1008
|
|
38
38
|
|
|
39
39
|
## Quick Setup
|
|
40
40
|
|
|
@@ -766,7 +766,7 @@ This example shows two *TouchableHighlight*, which will fire the *onPress()* fun
|
|
|
766
766
|
|
|
767
767
|
The New RUM Experience introduces a set of advanced APIs that allow you to send custom events, modify event data, track exceptions, monitor HTTP requests, and manage view contexts in your React Native application. These APIs provide more granular control over the data captured by Dynatrace and are designed for the next generation RUM capabilities.
|
|
768
768
|
|
|
769
|
-
For more detailed information about the New RUM Experience, see the [official Dynatrace documentation](https://docs.dynatrace.com/docs/
|
|
769
|
+
For more detailed information about the New RUM Experience, see the [official Dynatrace documentation](https://docs.dynatrace.com/docs/shortlink/react-native-main).
|
|
770
770
|
|
|
771
771
|
### Send Event
|
|
772
772
|
|
|
@@ -875,6 +875,7 @@ Dynatrace.removeEventModifier(myModifier);
|
|
|
875
875
|
- **Reserved fields**: Certain reserved fields and namespaces cannot be modified. Attempts to modify them will be ignored
|
|
876
876
|
- **Error handling**: If a modifier throws an exception, it will be logged but won't prevent other modifiers from executing
|
|
877
877
|
- **Primitive values**: Event fields can only contain primitive values (String, int, double, bool)
|
|
878
|
+
- **Invalid argument**: In case you pass an invalid argument to `addEventModifier`, we return a no-op placeholder modifier.
|
|
878
879
|
|
|
879
880
|
### Send Exception Event
|
|
880
881
|
|
|
@@ -1528,7 +1529,7 @@ ios: {
|
|
|
1528
1529
|
## How does Dynatrace determine the user action name?
|
|
1529
1530
|
* React views
|
|
1530
1531
|
* dtActionName: Use a custom property called dtActionName
|
|
1531
|
-
* displayName: Use the displayName property to check if React views have a display name set
|
|
1532
|
+
* displayName: Use the displayName property to check if React views have a display name set
|
|
1532
1533
|
* instrumentation string: Auto instrumentation or manual instrumentation is passing a string. This will be used if available.
|
|
1533
1534
|
* class name: If the display name is not available, the class name is used by taking the property name from the constructor
|
|
1534
1535
|
* Touchables
|
|
@@ -1971,6 +1972,9 @@ If you are struggling with a problem, submit a support ticket to Dynatrace (supp
|
|
|
1971
1972
|
<br/><br/>
|
|
1972
1973
|
## Changelog
|
|
1973
1974
|
|
|
1975
|
+
2.331.1
|
|
1976
|
+
* Updated Android (8.331.1.1004) & iOS Agent (8.331.1.1008)
|
|
1977
|
+
|
|
1974
1978
|
2.329.1
|
|
1975
1979
|
* Updated Android (8.329.1.1014) & iOS Agent (8.329.1.1017)
|
|
1976
1980
|
* [New RUM experience](#new-rum-experience) Removed Dynatrace.stopView() API
|
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.331.1.1004'
|
|
76
76
|
implementation "com.facebook.react:react-native:${safeExtGet('reactNative', '+')}"
|
|
77
77
|
}
|
|
78
78
|
|
package/files/plugin.gradle
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a,n=require("@babel/runtime/helpers/interopRequireDefault"),e=n(require("@babel/runtime/helpers/toConsumableArray")),c=(Object.defineProperty(exports,"t",{value:!0}),exports.instrument=void 0,require("path")),u=require("jscodeshift"),i=require("jscodeshift/src/Collection"),r=require("../scripts/FileOperationHelper"),l=require("../scripts/PathsConstants"),f=require("../lib/core/util/GetValuesFromPackage"),t=require("../scripts/util/InstrumentUtil"),o=require("./libs/react-native/Touchables.InstrInfo"),s=require("./libs/react-native/RefreshControl.InstrInfo"),v=require("./libs/react-native/Switch.InstrInfo"),d=require("./libs/community/gesture-handler/Touchables.InstrInfo"),p=require("./libs/community/Picker.InstrInfo"),m=require("./model/Types"),g=require("./parser/ParserUtil"),y=((n=>{n[n.i=-1]="Filtered",n[n.u=0]="Normal",n[n.o=1]="ReactNative",n[n.l=2]="React",n[n.v=3]="ReactNativeCssInterop"})(a=a||{}),[]),q=(y.push.apply(y,(0,e.default)(o.instrumentationInfo)),y.push.apply(y,(0,e.default)(s.instrumentationInfo)),y.push.apply(y,(0,e.default)(v.instrumentationInfo)),y.push.apply(y,(0,e.default)(d.instrumentationInfo)),y.push.apply(y,(0,e.default)(p.instrumentationInfo)),["AppRegistry","AppRegistryImpl","renderApplication","ExceptionsManager"]),b="@dynatrace/react-native-plugin/instrumentation/libs",instrument=function(n,e,r){e=O(e);var t=z(e);if(t!==a.i){var i=!1,u=N(e,n);if(t===a.l)U(u),i=!0;else if(t===a.o)e.endsWith("AppRegistryImpl.js")?null!=r&&r.autoStart&&V(u)&&(i=!0):e.endsWith("AppRegistry.js")?null!=r&&r.autoStart&&w(u)&&(i=!0):e.endsWith("renderApplication.js")?(A(u),i=!0):e.endsWith("ExceptionsManager.js")&&(o=void 0!==r&&r.autoStart&&r.errorHandler.enabled,J(u,r.errorHandler.reportFatalErrorAsCrash,o),i=!0);else if(t===a.v)i=G(u)||i;else{var o=k(e,r);if(r.navigation.enabled&&L(e,u))i=!0;else{if(!o.input&&!o.lifecycle)return null!=r&&r.debug&&console.log("Dynatrace - Filtered All: ".concat(e)),I(e),n;o.lifecycle&&A(u)&&(i=!0),o.input&&y.forEach(function(n){n=X(u,n);u=n.root,i=i||n.p})}}i?(n=u.toSource({quote:"single"}),h(n,e)):I(e),null!=r&&r.debug&&i&&console.log("Dynatrace - Modified Filename: "+e)}else e.includes(c.join("@dynatrace","react-native-plugin"))&&e.endsWith(c.join("lib","core","configuration","ConfigurationPreset.js"))&&void 0!==r&&(t=(0,f.getHostAppBundleInfo)(l.default.getPackageJsonFile()),o=N(e,n),void 0!==r.lifecycle&&x(o,"getLifecycleUpdate",r.lifecycle.includeUpdate),void 0!==r.debug&&x(o,"getLogLevel",r.debug?0:1),void 0!==r.bundleName?x(o,"getBundleName",r.bundleName):null!==t&&x(o,"getBundleName",null==t?void 0:t.name),void 0!==r.bundleVersion?x(o,"getBundleVersion",r.bundleVersion):null!==t&&x(o,"getBundleVersion",null==t?void 0:t.version),void 0!==r.input&&void 0!==r.input.actionNamePrivacy&&x(o,"getActionNamePrivacy",r.input.actionNamePrivacy),void 0!==r.errorHandler&&(x(o,"isErrorHandlerEnabled",r.errorHandler.enabled),x(o,"isReportFatalErrorAsCrash",r.errorHandler.reportFatalErrorAsCrash)),r.autoStart&&x(o,"isAutoStartupEnabled",r.autoStart),n=o.toSource({quote:"single"}),h(n,e));return n},L=(exports.instrument=instrument,function(n,e){return!!T(n,e)&&(n="import { monitorNavigation } from '".concat(b,"/react-navigation/ReactNavigation';"),e.find(u.ImportDeclaration).at(0).insertBefore(n),!0)}),T=function(n,e){var r=!1;return n.includes("@react-navigation")&&n.includes("core")&&(n.includes("BaseNavigationContainer.js")||n.includes("BaseNavigationContainer.tsx"))&&e.find(u.VariableDeclarator,{id:{name:"getRootState"}}).forEach(function(n){r=!0,n.parent.insertAfter("monitorNavigation(getRootState);")}),r},A=function(n){var e=n.findJSXElements(),t=!1;return 0<e.length&&(n.find(u.FunctionDeclaration).forEach(function(n){var e,r=(0,i.fromPaths)([n]);0<r.findJSXElements().length&&null!=n&&null!=n.value&&null!=n.value.id&&n.value.id.name.toString()&&(e=r.find(u.ClassDeclaration),r=r.find(u.ClassExpression),0===e.length)&&0===r.length&&(j(n,m.Types.FunctionalComponent,n.value.id.name.toString()),t=!0)}),n.find(u.ClassDeclaration).forEach(function(n){0<(0,i.fromPaths)([n]).findJSXElements().length&&null!=n&&null!=n.value&&n.value.id&&n.value.id.name.toString()&&(j(n,m.Types.ClassComponent,n.value.id.name.toString()),t=!0)}),n.find(u.ArrowFunctionExpression).forEach(function(n){0<(0,i.fromPaths)([n]).findJSXElements().length&&null!=n.parent&&null!=n.parent.value&&null!=n.parent.value.id&&null!=n.parent.value.id.name&&(j(n,m.Types.FunctionalComponent,n.parent.value.id.name),t=!0)})),t},j=function(n,e,r){for(e=u.expressionStatement(u.assignmentExpression("=",u.memberExpression(u.identifier(r),u.identifier("_dtInfo")),M(e,r)));"body"!==(null==n?void 0:n.parentPath.name);)n=n.parentPath;void 0!==n.parentPath&&n.insertAfter(e)},M=function(n,e){return u.objectExpression([u.objectProperty(u.identifier("type"),u.numericLiteral(n)),u.objectProperty(u.identifier("name"),u.stringLiteral(e))])},x=function(n,e,r){var n=n.find(u.Identifier).filter(function(n){return n.node.name===e});1===n.length&&"ReturnStatement"===(n=n.paths()[0].parent.value.body.body[0]).type&&("boolean"==typeof r&&(n.argument=u.booleanLiteral(r)),"string"==typeof r&&(n.argument=u.stringLiteral(r)),"number"==typeof r)&&(n.argument=u.numericLiteral(r))},N=function(n,e){return u.withParser((0,g.chooseParser)(n,e))(e)},O=function(n){return c.isAbsolute(n)?n.replace(l.default.getApplicationPath()+c.sep,""):n},I=function(n){try{var e=c.join(l.default.getBuildPath(),n+t.INSTRUMENTED_FILE_EXTENSION);r.default.checkIfFileExistsSync(e),r.default.deleteFileSync(e)}catch(n){}},h=function(n,e){e=c.join(l.default.getBuildPath(),e);try{r.default.checkIfFileExistsSync(c.dirname(e))}catch(n){r.default.createDirectorySync(c.dirname(e))}r.default.writeTextToFileSync(e+t.INSTRUMENTED_FILE_EXTENSION,n)},k=function(n,e){var r={input:!1,lifecycle:!1};return void 0!==e&&(void 0!==e.lifecycle&&void 0!==e.lifecycle.instrument&&e.lifecycle.instrument(n)&&(r.lifecycle=!0),void 0!==e.input)&&void 0!==e.input.instrument&&e.input.instrument(n)&&(r.input=!0),r},U=function(n){var e,n=n.find(u.Program);1===n.length&&(e=u.expressionStatement(u.callExpression(u.memberExpression(u.callExpression(u.identifier("require"),[u.stringLiteral("@dynatrace/react-native-plugin/instrumentation/jsx/ElementHelper")]),u.identifier("instrumentCreateElement")),[u.memberExpression(u.identifier("module"),u.identifier("exports"))])),n.paths()[0].node.body.push(e))},V=function(n){var e=n.find(u.FunctionDeclaration,{id:{name:"runApplication"}});return 1===e.length&&(D(n,{m:"_DynatraceApplicationHandler",module:"@dynatrace/react-native-plugin",reference:"ApplicationHandler"}),R(e.get().value.body.body,0,_("_DynatraceApplicationHandler","startup",[])),!0)},w=function(n){var e=n.find(u.ObjectMethod,{key:{name:"runApplication"}});return 1===e.length&&(D(n,{m:"_DynatraceApplicationHandler",module:"@dynatrace/react-native-plugin",reference:"ApplicationHandler"}),R(e.get().value.body.body,0,_("_DynatraceApplicationHandler","startup",[])),!0)},J=function(n,r,t){var i=u;n.find(i.FunctionDeclaration,{id:{name:"handleException"}}).forEach(function(n){var e=i.callExpression(i.memberExpression(i.callExpression(i.identifier("require"),[i.literal("@dynatrace/react-native-plugin/lib/core/ErrorHandler")]),i.identifier("reportErrorToDynatrace")),[i.identifier("e"),i.identifier("isFatal"),i.literal(r),i.literal(t)]),e=i.expressionStatement(i.callExpression(i.identifier("setTimeout"),[i.arrowFunctionExpression([],i.blockStatement(n.node.body.body)),e]));n.node.body.body=[e]})},G=function(n){var e=!1,n=n.find(u.CallExpression,{callee:{name:"require"}});return n.find(u.Literal,{value:"react/jsx-runtime"}).replaceWith(function(n){n=n.node;return n.value="@dynatrace/react-native-plugin/jsx-runtime",e=!0,n}),n.find(u.Literal,{value:"react/jsx-dev-runtime"}).replaceWith(function(n){n=n.node;return n.value="@dynatrace/react-native-plugin/jsx-dev-runtime",e=!0,n}),e},R=function(n,e){for(var r=arguments.length,t=new Array(2<r?r-2:0),i=2;i<r;i++)t[i-2]=arguments[i];return n.splice.apply(n,[e,0].concat(t))},z=function(n){if(n.includes("@dynatrace"))return a.i;var e=c.extname(n);if(".js"!==e&&".ts"!==e&&".tsx"!==e&&".jsx"!==e)return a.i;for(var r=c.parse(n),t=r.dir.split(c.sep),i=0;i<t.length;i++)if("node_modules"===t[i]){if("react-native"===t[i+1]||"create-react-class"===t[i+1]||"react-clone-referenced-element"===t[i+1])return q.includes(r.name)?a.o:a.i;if("react"===t[i+1]&&"index"===r.name)return a.l;if("react-native-css-interop"===t[i+1]&&("jsx-runtime"===r.name||"jsx-dev-runtime"===r.name))return a.v}return a.u},K=function(n,e,r){var t=Q(n,e,r);return W(n,e,r)||t},Q=function(n,e,r){var t=Y(n,e);return 0<t.length&&(void 0!==(t=H(t,e.reference,!1))&&(r.m=t.localName),tn(n,r),!0)},W=function(n,e,r){var t=C(n,e.module);if(1===t.length){t=H(t,e.reference,!0);if(void 0!==t)return un(n,r.defaultImport,t.localName,"ImportNamespaceSpecifier"===t.type),!0}return!1},X=function(n,e){var r=JSON.parse(JSON.stringify(e.new));return{root:n,p:K(n,e.old,r)||Z(n,e.old,e.new.defaultImport)}},Y=function(n,e){return n.find(u.ImportDeclaration).filter(function(n){return n.node.source.value===e.module&&null!=n.node.specifiers&&n.node.specifiers.some(function(n){return E(n)&&n.imported.name===e.reference||n.local&&n.local.name===e.reference})})},E=function(n){return void 0!==n.imported},Z=function(n,e,r){var t=!1;return n.find(u.CallExpression).filter(function(n){return $(n.node.callee)&&nn(n.node.arguments[0])&&n.node.arguments[0].value===e.module&&void 0!==n.parent}).forEach(function(n){(void 0===n.parent.value.property||void 0!==n.parent.value.property&&void 0!==n.parent.value.property.name&&n.parent.value.property.name===e.reference)&&(n.node.arguments[0].value=r,t=t||!0)}),t},$=function(n){return"require"===n.name},nn=function(n){return"StringLiteral"===n.type||"Literal"===n.type},C=function(n,e){return n.find(u.ImportDeclaration).filter(function(n){return n.node.source.value===e})},H=function(n,r,t){var i;return n.forEach(function(n){void 0!==n.node.specifiers&&(n.node.specifiers=n.node.specifiers.filter(function(n){var e;return E(n)&&!t?((e=n.imported.name!==r)||null==n.local||n.imported.name===n.local.name||(i={localName:n.local.name.toString(),type:n.type}),e):!(!E(n)&&t&&(null!=n.local&&(i={localName:n.local.name.toString(),type:n.type}),1))}),0===n.node.specifiers.length)&&n.prune()}),i},en=function(n,e){n.find(u.ImportDeclaration).filter(function(n){return n.node.source.value===e.module}).forEach(function(n){null!=n.node.specifiers&&n.node.specifiers.push(P(e))})},rn=function(n,e,r){n.find(u.ImportDeclaration).filter(function(n){return n.node.source.value===e}).forEach(function(n){null!=n.node.specifiers&&n.node.specifiers.push(r)})},S=function(n,e,r){var t=n.find(u.ImportDeclaration);0<t.length?u(t.paths()[0]).insertAfter(B(e,r)):1===(t=n.find(u.Program)).length&&t.paths()[0].node.body.unshift(B(e,r))},tn=function(n,e){0<C(n,e.module).length?en(n,e):S(n,e.module,[P(e)])},un=function(n,e,r,t){var i=C(n,e),t=(t?vn:sn)(r);0<i.length?rn(n,e,t):S(n,e,[t])},D=function(n,e){n=n.find(u.VariableDeclaration);0<n.length&&u(n.paths()[0]).insertAfter(an(e))},_=function(n,e,r){return u.expressionStatement(on(n,e,r))},on=function(n,e,r){return u.callExpression(fn(n,e),r)},an=function(n){return u.variableDeclaration("var",[cn(n)])},cn=function(n){return u.variableDeclarator(void 0!==n.m?u.identifier(n.m):u.identifier(n.reference),(0<n.reference.length?ln:F)(n))},ln=function(n){return u.memberExpression(F(n),u.identifier(n.reference))},fn=function(n,e){return u.memberExpression(u.identifier(n),u.identifier(e))},F=function(n){return u.callExpression(u.identifier("require"),[u.literal(n.module)])},B=function(n,e){return u.importDeclaration(e,u.literal(n))},P=function(n){return void 0!==n.m?u.importSpecifier(u.identifier(n.reference),u.identifier(n.m)):u.importSpecifier(u.identifier(n.reference))},sn=function(n){return u.importDefaultSpecifier(u.identifier(n))},vn=function(n){return u.importNamespaceSpecifier(u.identifier(n))};
|
|
1
|
+
var a,n=require("@babel/runtime/helpers/interopRequireDefault"),e=n(require("@babel/runtime/helpers/toConsumableArray")),c=(Object.defineProperty(exports,"t",{value:!0}),exports.instrument=void 0,require("path")),u=require("jscodeshift"),i=require("jscodeshift/src/Collection"),r=require("../scripts/FileOperationHelper"),l=require("../scripts/PathsConstants"),f=require("../lib/core/util/GetValuesFromPackage"),t=require("../scripts/util/InstrumentUtil"),o=require("./libs/react-native/Touchables.InstrInfo"),s=require("./libs/react-native/RefreshControl.InstrInfo"),v=require("./libs/react-native/Switch.InstrInfo"),d=require("./libs/community/gesture-handler/Touchables.InstrInfo"),p=require("./libs/community/Picker.InstrInfo"),m=require("./model/Types"),g=require("./parser/ParserUtil"),y=((n=>{n[n.i=-1]="Filtered",n[n.u=0]="Normal",n[n.o=1]="ReactNative",n[n.l=2]="React",n[n.v=3]="ReactNativeCssInterop"})(a=a||{}),[]),q=(y.push.apply(y,(0,e.default)(o.instrumentationInfo)),y.push.apply(y,(0,e.default)(s.instrumentationInfo)),y.push.apply(y,(0,e.default)(v.instrumentationInfo)),y.push.apply(y,(0,e.default)(d.instrumentationInfo)),y.push.apply(y,(0,e.default)(p.instrumentationInfo)),["AppRegistry","AppRegistryImpl","renderApplication","ExceptionsManager"]),b="@dynatrace/react-native-plugin/instrumentation/libs",instrument=function(n,e,r){e=O(e);var t=z(e);if(t!==a.i){var i=!1,u=N(e,n);if(t===a.l)U(u),i=!0;else if(t===a.o)e.endsWith("AppRegistryImpl.js")?null!=r&&r.autoStart&&V(u)&&(i=!0):e.endsWith("AppRegistry.js")?null!=r&&r.autoStart&&w(u)&&(i=!0):e.endsWith("renderApplication.js")?(A(u),i=!0):e.endsWith("ExceptionsManager.js")&&(o=void 0!==r&&r.autoStart&&r.errorHandler.enabled,J(u,r.errorHandler.reportFatalErrorAsCrash,o),i=!0);else if(t===a.v)i=G(u)||i;else{var o=k(e,r);if(r.navigation.enabled&&L(e,u))i=!0;else{if(!o.input&&!o.lifecycle)return null!=r&&r.debug&&console.log("Dynatrace - Filtered All: ".concat(e)),I(e),n;o.lifecycle&&A(u)&&(i=!0),o.input&&y.forEach(function(n){n=X(u,n);u=n.root,i=i||n.p})}}i?(n=u.toSource({quote:"single"}),h(n,e)):I(e),null!=r&&r.debug&&i&&console.log("Dynatrace - Modified Filename: "+e)}else e.includes(c.join("@dynatrace","react-native-plugin"))&&e.endsWith(c.join("lib","core","configuration","ConfigurationPreset.js"))&&void 0!==r&&(t=(0,f.getHostAppBundleInfo)(l.default.getPackageJsonFile()),o=N(e,n),void 0!==r.lifecycle&&x(o,"getLifecycleUpdate",r.lifecycle.includeUpdate),void 0!==r.debug&&x(o,"getLogLevel",r.debug?0:1),void 0!==r.bundleName?x(o,"getBundleName",r.bundleName):null!==t&&x(o,"getBundleName",null==t?void 0:t.name),void 0!==r.bundleVersion?x(o,"getBundleVersion",r.bundleVersion):null!==t&&x(o,"getBundleVersion",null==t?void 0:t.version),void 0!==r.input&&void 0!==r.input.actionNamePrivacy&&x(o,"getActionNamePrivacy",r.input.actionNamePrivacy),void 0!==r.errorHandler&&(x(o,"isErrorHandlerEnabled",r.errorHandler.enabled),x(o,"isReportFatalErrorAsCrash",r.errorHandler.reportFatalErrorAsCrash)),r.autoStart&&x(o,"isAutoStartupEnabled",r.autoStart),n=o.toSource({quote:"single"}),h(n,e));return n},L=(exports.instrument=instrument,function(n,e){return!!T(n,e)&&(n="import { monitorNavigation } from '".concat(b,"/react-navigation/ReactNavigation';"),e.find(u.ImportDeclaration).at(0).insertBefore(n),!0)}),T=function(n,e){var r=!1;return n.includes("@react-navigation")&&n.includes("core")&&(n.includes("BaseNavigationContainer.js")||n.includes("BaseNavigationContainer.tsx"))&&e.find(u.VariableDeclarator,{id:{name:"getRootState"}}).forEach(function(n){r=!0,n.parent.insertAfter("monitorNavigation(getRootState);")}),r},A=function(n){var e=n.findJSXElements(),t=!1;return 0<e.length&&(n.find(u.FunctionDeclaration).forEach(function(n){var e,r=(0,i.fromPaths)([n]);0<r.findJSXElements().length&&null!=n&&null!=n.value&&null!=n.value.id&&n.value.id.name.toString()&&(e=r.find(u.ClassDeclaration),r=r.find(u.ClassExpression),0===e.length)&&0===r.length&&(j(n,m.Types.FunctionalComponent,n.value.id.name.toString()),t=!0)}),n.find(u.ClassDeclaration).forEach(function(n){0<(0,i.fromPaths)([n]).findJSXElements().length&&null!=n&&null!=n.value&&n.value.id&&n.value.id.name.toString()&&(j(n,m.Types.ClassComponent,n.value.id.name.toString()),t=!0)}),n.find(u.ArrowFunctionExpression).forEach(function(n){0<(0,i.fromPaths)([n]).findJSXElements().length&&null!=n.parent&&null!=n.parent.value&&null!=n.parent.value.id&&null!=n.parent.value.id.name&&(j(n,m.Types.FunctionalComponent,n.parent.value.id.name),t=!0)}),n.find(u.FunctionExpression).forEach(function(n){0<(0,i.fromPaths)([n]).findJSXElements().length&&null!=n.parent&&null!=n.parent.value&&null!=n.parent.value.id&&null!=n.parent.value.id.name&&(j(n,m.Types.FunctionalComponent,n.parent.value.id.name),t=!0)})),t},j=function(n,e,r){for(e=u.expressionStatement(u.assignmentExpression("=",u.memberExpression(u.identifier(r),u.identifier("_dtInfo")),M(e,r)));"body"!==(null==n?void 0:n.parentPath.name);)n=n.parentPath;void 0!==n.parentPath&&n.insertAfter(e)},M=function(n,e){return u.objectExpression([u.objectProperty(u.identifier("type"),u.numericLiteral(n)),u.objectProperty(u.identifier("name"),u.stringLiteral(e))])},x=function(n,e,r){var n=n.find(u.Identifier).filter(function(n){return n.node.name===e});1===n.length&&"ReturnStatement"===(n=n.paths()[0].parent.value.body.body[0]).type&&("boolean"==typeof r&&(n.argument=u.booleanLiteral(r)),"string"==typeof r&&(n.argument=u.stringLiteral(r)),"number"==typeof r)&&(n.argument=u.numericLiteral(r))},N=function(n,e){return u.withParser((0,g.chooseParser)(n,e))(e)},O=function(n){return c.isAbsolute(n)?n.replace(l.default.getApplicationPath()+c.sep,""):n},I=function(n){try{var e=c.join(l.default.getBuildPath(),n+t.INSTRUMENTED_FILE_EXTENSION);r.default.checkIfFileExistsSync(e),r.default.deleteFileSync(e)}catch(n){}},h=function(n,e){e=c.join(l.default.getBuildPath(),e);try{r.default.checkIfFileExistsSync(c.dirname(e))}catch(n){r.default.createDirectorySync(c.dirname(e))}r.default.writeTextToFileSync(e+t.INSTRUMENTED_FILE_EXTENSION,n)},k=function(n,e){var r={input:!1,lifecycle:!1};return void 0!==e&&(void 0!==e.lifecycle&&void 0!==e.lifecycle.instrument&&e.lifecycle.instrument(n)&&(r.lifecycle=!0),void 0!==e.input)&&void 0!==e.input.instrument&&e.input.instrument(n)&&(r.input=!0),r},U=function(n){var e,n=n.find(u.Program);1===n.length&&(e=u.expressionStatement(u.callExpression(u.memberExpression(u.callExpression(u.identifier("require"),[u.stringLiteral("@dynatrace/react-native-plugin/instrumentation/jsx/ElementHelper")]),u.identifier("instrumentCreateElement")),[u.memberExpression(u.identifier("module"),u.identifier("exports"))])),n.paths()[0].node.body.push(e))},V=function(n){var e=n.find(u.FunctionDeclaration,{id:{name:"runApplication"}});return 1===e.length&&(D(n,{m:"_DynatraceApplicationHandler",module:"@dynatrace/react-native-plugin",reference:"ApplicationHandler"}),R(e.get().value.body.body,0,_("_DynatraceApplicationHandler","startup",[])),!0)},w=function(n){var e=n.find(u.ObjectMethod,{key:{name:"runApplication"}});return 1===e.length&&(D(n,{m:"_DynatraceApplicationHandler",module:"@dynatrace/react-native-plugin",reference:"ApplicationHandler"}),R(e.get().value.body.body,0,_("_DynatraceApplicationHandler","startup",[])),!0)},J=function(n,r,t){var i=u;n.find(i.FunctionDeclaration,{id:{name:"handleException"}}).forEach(function(n){var e=i.callExpression(i.memberExpression(i.callExpression(i.identifier("require"),[i.literal("@dynatrace/react-native-plugin/lib/core/ErrorHandler")]),i.identifier("reportErrorToDynatrace")),[i.identifier("e"),i.identifier("isFatal"),i.literal(r),i.literal(t)]),e=i.expressionStatement(i.callExpression(i.identifier("setTimeout"),[i.arrowFunctionExpression([],i.blockStatement(n.node.body.body)),e]));n.node.body.body=[e]})},G=function(n){var e=!1,n=n.find(u.CallExpression,{callee:{name:"require"}});return n.find(u.Literal,{value:"react/jsx-runtime"}).replaceWith(function(n){n=n.node;return n.value="@dynatrace/react-native-plugin/jsx-runtime",e=!0,n}),n.find(u.Literal,{value:"react/jsx-dev-runtime"}).replaceWith(function(n){n=n.node;return n.value="@dynatrace/react-native-plugin/jsx-dev-runtime",e=!0,n}),e},R=function(n,e){for(var r=arguments.length,t=new Array(2<r?r-2:0),i=2;i<r;i++)t[i-2]=arguments[i];return n.splice.apply(n,[e,0].concat(t))},z=function(n){if(n.includes("@dynatrace"))return a.i;var e=c.extname(n);if(".js"!==e&&".ts"!==e&&".tsx"!==e&&".jsx"!==e)return a.i;for(var r=c.parse(n),t=r.dir.split(c.sep),i=0;i<t.length;i++)if("node_modules"===t[i]){if("react-native"===t[i+1]||"create-react-class"===t[i+1]||"react-clone-referenced-element"===t[i+1])return q.includes(r.name)?a.o:a.i;if("react"===t[i+1]&&"index"===r.name)return a.l;if("react-native-css-interop"===t[i+1]&&("jsx-runtime"===r.name||"jsx-dev-runtime"===r.name))return a.v}return a.u},K=function(n,e,r){var t=Q(n,e,r);return W(n,e,r)||t},Q=function(n,e,r){var t=Y(n,e);return 0<t.length&&(void 0!==(t=H(t,e.reference,!1))&&(r.m=t.localName),tn(n,r),!0)},W=function(n,e,r){var t=C(n,e.module);if(1===t.length){t=H(t,e.reference,!0);if(void 0!==t)return un(n,r.defaultImport,t.localName,"ImportNamespaceSpecifier"===t.type),!0}return!1},X=function(n,e){var r=JSON.parse(JSON.stringify(e.new));return{root:n,p:K(n,e.old,r)||Z(n,e.old,e.new.defaultImport)}},Y=function(n,e){return n.find(u.ImportDeclaration).filter(function(n){return n.node.source.value===e.module&&null!=n.node.specifiers&&n.node.specifiers.some(function(n){return E(n)&&n.imported.name===e.reference||n.local&&n.local.name===e.reference})})},E=function(n){return void 0!==n.imported},Z=function(n,e,r){var t=!1;return n.find(u.CallExpression).filter(function(n){return $(n.node.callee)&&nn(n.node.arguments[0])&&n.node.arguments[0].value===e.module&&void 0!==n.parent}).forEach(function(n){(void 0===n.parent.value.property||void 0!==n.parent.value.property&&void 0!==n.parent.value.property.name&&n.parent.value.property.name===e.reference)&&(n.node.arguments[0].value=r,t=t||!0)}),t},$=function(n){return"require"===n.name},nn=function(n){return"StringLiteral"===n.type||"Literal"===n.type},C=function(n,e){return n.find(u.ImportDeclaration).filter(function(n){return n.node.source.value===e})},H=function(n,r,t){var i;return n.forEach(function(n){void 0!==n.node.specifiers&&(n.node.specifiers=n.node.specifiers.filter(function(n){var e;return E(n)&&!t?((e=n.imported.name!==r)||null==n.local||n.imported.name===n.local.name||(i={localName:n.local.name.toString(),type:n.type}),e):!(!E(n)&&t&&(null!=n.local&&(i={localName:n.local.name.toString(),type:n.type}),1))}),0===n.node.specifiers.length)&&n.prune()}),i},en=function(n,e){n.find(u.ImportDeclaration).filter(function(n){return n.node.source.value===e.module}).forEach(function(n){null!=n.node.specifiers&&n.node.specifiers.push(P(e))})},rn=function(n,e,r){n.find(u.ImportDeclaration).filter(function(n){return n.node.source.value===e}).forEach(function(n){null!=n.node.specifiers&&n.node.specifiers.push(r)})},S=function(n,e,r){var t=n.find(u.ImportDeclaration);0<t.length?u(t.paths()[0]).insertAfter(B(e,r)):1===(t=n.find(u.Program)).length&&t.paths()[0].node.body.unshift(B(e,r))},tn=function(n,e){0<C(n,e.module).length?en(n,e):S(n,e.module,[P(e)])},un=function(n,e,r,t){var i=C(n,e),t=(t?vn:sn)(r);0<i.length?rn(n,e,t):S(n,e,[t])},D=function(n,e){n=n.find(u.VariableDeclaration);0<n.length&&u(n.paths()[0]).insertAfter(an(e))},_=function(n,e,r){return u.expressionStatement(on(n,e,r))},on=function(n,e,r){return u.callExpression(fn(n,e),r)},an=function(n){return u.variableDeclaration("var",[cn(n)])},cn=function(n){return u.variableDeclarator(void 0!==n.m?u.identifier(n.m):u.identifier(n.reference),(0<n.reference.length?ln:F)(n))},ln=function(n){return u.memberExpression(F(n),u.identifier(n.reference))},fn=function(n,e){return u.memberExpression(u.identifier(n),u.identifier(e))},F=function(n){return u.callExpression(u.identifier("require"),[u.literal(n.module)])},B=function(n,e){return u.importDeclaration(e,u.literal(n))},P=function(n){return void 0!==n.m?u.importSpecifier(u.identifier(n.reference),u.identifier(n.m)):u.importSpecifier(u.identifier(n.reference))},sn=function(n){return u.importDefaultSpecifier(u.identifier(n))},vn=function(n){return u.importNamespaceSpecifier(u.identifier(n))};
|
package/lib/next/Dynatrace.js
CHANGED
|
@@ -8,20 +8,39 @@ const EventPipeline_1 = require("./events/EventPipeline");
|
|
|
8
8
|
const EventTimestamp_1 = require("./events/EventTimestamp");
|
|
9
9
|
const EventModifierUtil_1 = require("./events/modifier/EventModifierUtil");
|
|
10
10
|
const TimestampProvider_1 = require("./provider/TimestampProvider");
|
|
11
|
+
const EventData_1 = require("./events/EventData");
|
|
12
|
+
const SessionPropertyEventData_1 = require("./events/SessionPropertyEventData");
|
|
13
|
+
const ExceptionEventData_1 = require("./events/ExceptionEventData");
|
|
14
|
+
const HttpRequestEventData_1 = require("./events/HttpRequestEventData");
|
|
15
|
+
const DynatraceArgValidators_1 = require("./DynatraceArgValidators");
|
|
11
16
|
class DynatraceImpl {
|
|
12
17
|
constructor(timestampProvider) {
|
|
13
18
|
this.timestampProvider = timestampProvider;
|
|
14
19
|
this.logger = new ConsoleLogger_1.ConsoleLogger('Dynatrace');
|
|
15
20
|
}
|
|
16
21
|
addEventModifier(eventModifier) {
|
|
22
|
+
if (!(0, DynatraceArgValidators_1.isEventModifier)(eventModifier)) {
|
|
23
|
+
this.logger.info('addEventModifier(eventModifier): eventModifier is not of type IEventModifier');
|
|
24
|
+
return {
|
|
25
|
+
modifyEvent: (event) => event,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
17
28
|
this.logger.debug('addEventModifier()');
|
|
18
29
|
return EventPipeline_1.EventPipeline.addEventModifier(eventModifier);
|
|
19
30
|
}
|
|
20
31
|
removeEventModifier(eventModifier) {
|
|
32
|
+
if (!(0, DynatraceArgValidators_1.isEventModifier)(eventModifier)) {
|
|
33
|
+
this.logger.info('removeEventModifier(eventModifier): eventModifier is not of type IEventModifier');
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
21
36
|
this.logger.debug('removeEventModifier()');
|
|
22
37
|
return EventPipeline_1.EventPipeline.removeEventModifier(eventModifier);
|
|
23
38
|
}
|
|
24
39
|
startView(name) {
|
|
40
|
+
if (typeof name !== 'string') {
|
|
41
|
+
this.logger.info(`startView(name): Name must be a string!`);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
25
44
|
this.logger.debug(`startView(${name})`);
|
|
26
45
|
if (name != null && name.length > 0) {
|
|
27
46
|
DynatraceBridge_1.DynatraceNative.startView(name);
|
|
@@ -61,6 +80,10 @@ class DynatraceImpl {
|
|
|
61
80
|
EventPipeline_1.EventPipeline.insertEvent(event);
|
|
62
81
|
}
|
|
63
82
|
sendExceptionEvent(exceptionEventData) {
|
|
83
|
+
if (!(exceptionEventData instanceof ExceptionEventData_1.default)) {
|
|
84
|
+
this.logger.info('sendExceptionEvent(exceptionEventData): exceptionEventData is not of type ExceptionEventData');
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
64
87
|
this.logger.debug('sendExceptionEvent(exceptionEventData)');
|
|
65
88
|
const eventValidated = exceptionEventData.toJSON();
|
|
66
89
|
if (eventValidated !== null) {
|
|
@@ -68,6 +91,10 @@ class DynatraceImpl {
|
|
|
68
91
|
}
|
|
69
92
|
}
|
|
70
93
|
sendEvent(eventData) {
|
|
94
|
+
if (!(eventData instanceof EventData_1.default)) {
|
|
95
|
+
this.logger.info('sendEvent(eventData): eventData is not of type EventData');
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
71
98
|
this.logger.debug('sendEvent(eventData)');
|
|
72
99
|
const eventValidated = eventData.toJSON();
|
|
73
100
|
if (eventValidated !== null) {
|
|
@@ -75,6 +102,10 @@ class DynatraceImpl {
|
|
|
75
102
|
}
|
|
76
103
|
}
|
|
77
104
|
sendSessionPropertyEvent(sessionPropertyEventData) {
|
|
105
|
+
if (!(sessionPropertyEventData instanceof SessionPropertyEventData_1.default)) {
|
|
106
|
+
this.logger.info('sendSessionPropertyEvent(SessionPropertyEventData): sessionPropertyEventData is not of type SessionPropertyEventData');
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
78
109
|
this.logger.debug('sendSessionPropertyEvent(SessionPropertyEventData)');
|
|
79
110
|
const eventValidated = sessionPropertyEventData.toJSON();
|
|
80
111
|
if (eventValidated !== null) {
|
|
@@ -82,6 +113,10 @@ class DynatraceImpl {
|
|
|
82
113
|
}
|
|
83
114
|
}
|
|
84
115
|
sendHttpRequestEvent(httpRequestEvent) {
|
|
116
|
+
if (!(httpRequestEvent instanceof HttpRequestEventData_1.default)) {
|
|
117
|
+
this.logger.info('sendHttpRequestEvent(HttpRequestEventData): httpRequestEvent is not of type HttpRequestEventData');
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
85
120
|
this.logger.debug('sendHttpRequestEvent(HttpRequestEventData)');
|
|
86
121
|
const sanitizedEvent = httpRequestEvent.toJSON();
|
|
87
122
|
if (sanitizedEvent !== null) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isEventModifier = void 0;
|
|
4
|
+
function isEventModifier(eventModifier) {
|
|
5
|
+
return (typeof eventModifier === 'object' &&
|
|
6
|
+
eventModifier !== null &&
|
|
7
|
+
'modifyEvent' in eventModifier &&
|
|
8
|
+
typeof eventModifier.modifyEvent === 'function');
|
|
9
|
+
}
|
|
10
|
+
exports.isEventModifier = isEventModifier;
|
|
@@ -12,7 +12,6 @@ class HttpRequestEventData {
|
|
|
12
12
|
this.requestMethod = requestMethod;
|
|
13
13
|
this.duration = 0;
|
|
14
14
|
this.rawEventProperties = {};
|
|
15
|
-
this.traceContextHint = "api_unused";
|
|
16
15
|
this.hasDroppedProperties = false;
|
|
17
16
|
this.triedToOverwriteDuration = false;
|
|
18
17
|
this.requestMethod =
|
|
@@ -45,7 +44,6 @@ class HttpRequestEventData {
|
|
|
45
44
|
}
|
|
46
45
|
withTraceparentHeader(traceparentHeader) {
|
|
47
46
|
this.traceparentHeader = traceparentHeader;
|
|
48
|
-
this.traceContextHint = "api_set";
|
|
49
47
|
return this;
|
|
50
48
|
}
|
|
51
49
|
addEventProperty(key, value) {
|
|
@@ -57,23 +55,26 @@ class HttpRequestEventData {
|
|
|
57
55
|
logger.debug('toJSON(): Dropped invalid event');
|
|
58
56
|
return null;
|
|
59
57
|
}
|
|
60
|
-
this.sanitizeDuration();
|
|
61
|
-
this.sanitizeStatusCode();
|
|
62
|
-
this.sanitizeBytesReceived();
|
|
63
|
-
this.sanitizeBytesSent();
|
|
58
|
+
const sanitizedDuration = this.sanitizeDuration();
|
|
59
|
+
const sanitizedStatusCode = this.sanitizeStatusCode();
|
|
60
|
+
const sanitizedBytesReceived = this.sanitizeBytesReceived();
|
|
61
|
+
const sanitizedBytesSent = this.sanitizeBytesSent();
|
|
64
62
|
const parsedTraceparentHeader = this.traceparentHeader &&
|
|
65
63
|
this.parseTraceparent(this.traceparentHeader);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
const traceContextHint = !this.traceparentHeader
|
|
65
|
+
? "api_unused"
|
|
66
|
+
: parsedTraceparentHeader
|
|
67
|
+
? "api_set"
|
|
68
|
+
: "invalid";
|
|
69
69
|
const hasFailedRequest = this.isStatusCodeError() || !!this.error;
|
|
70
70
|
const sanitizedEventProperties = SendEventValidation_1.SendEventValidation.modifyEvent(this.rawEventProperties);
|
|
71
71
|
(0, EventModifierUtil_1.flagEventProperties)(sanitizedEventProperties);
|
|
72
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, sanitizedEventProperties), { ["url.full"]: this.url, ["network.protocol.name"]: 'http', ["http.request.method"]: this.requestMethod, ["request.trace_context_hint"]:
|
|
72
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, sanitizedEventProperties), { ["url.full"]: this.url, ["network.protocol.name"]: 'http', ["http.request.method"]: this.requestMethod, ["request.trace_context_hint"]: traceContextHint, ["duration"]: sanitizedDuration, ["start_time"]: TimestampProvider_1.defaultTimestampProvider.getCurrentTimestamp() -
|
|
73
|
+
sanitizedDuration }), (this.triedToOverwriteDuration && {
|
|
73
74
|
["dt.support.api.overridden_fields"]: [
|
|
74
75
|
'duration',
|
|
75
76
|
],
|
|
76
|
-
})), (0, EventBuilderUtil_1.includeIfDefined)("http.response.status_code",
|
|
77
|
+
})), (0, EventBuilderUtil_1.includeIfDefined)("http.response.status_code", sanitizedStatusCode)), (0, EventBuilderUtil_1.includeIfDefined)("http.response.reason_phrase", this.reasonPhrase)), (0, EventBuilderUtil_1.includeIfDefined)("request.bytes_sent", sanitizedBytesSent)), (0, EventBuilderUtil_1.includeIfDefined)("request.bytes_received", sanitizedBytesReceived)), { ["characteristics.has_request"]: true, ["characteristics.is_api_reported"]: true }), (0, EventBuilderUtil_1.includeIfTrue)("characteristics.has_failed_request", hasFailedRequest)), (0, EventBuilderUtil_1.includeIfTrue)("characteristics.has_error", hasFailedRequest)), (this.error !== undefined && Object.assign({ ["characteristics.has_exception"]: true, ["exception.type"]: this.error.name, ["exception.message"]: this.error.message }, (0, EventBuilderUtil_1.includeIfDefined)("exception.stack_trace", this.error.stack)))), (parsedTraceparentHeader && {
|
|
77
78
|
["trace.id"]: parsedTraceparentHeader.traceId,
|
|
78
79
|
["span.id"]: parsedTraceparentHeader.spanId,
|
|
79
80
|
})), (0, EventBuilderUtil_1.includeIfTrue)("dt.support.api.has_dropped_properties", this.hasDroppedProperties));
|
|
@@ -103,35 +104,36 @@ class HttpRequestEventData {
|
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
sanitizeStatusCode() {
|
|
106
|
-
if (this.statusCode
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
if (this.statusCode && this.statusCode < 0) {
|
|
110
|
-
logger.debug('HttpRequestEventData: overriding invalid Status Code with 0');
|
|
111
|
-
this.statusCode = 0;
|
|
107
|
+
if (this.statusCode !== undefined && this.statusCode < 0) {
|
|
108
|
+
logger.debug('HttpRequestEventData: dropping invalid Status Code');
|
|
112
109
|
this.hasDroppedProperties = true;
|
|
110
|
+
return undefined;
|
|
113
111
|
}
|
|
112
|
+
return this.statusCode;
|
|
114
113
|
}
|
|
115
114
|
sanitizeDuration() {
|
|
116
115
|
if (!Number.isFinite(this.duration) || this.duration < 0) {
|
|
117
116
|
logger.debug('HttpRequestEventData: overriding invalid Duration with 0');
|
|
118
|
-
this.duration = 0;
|
|
119
117
|
this.hasDroppedProperties = true;
|
|
118
|
+
return 0;
|
|
120
119
|
}
|
|
120
|
+
return this.duration;
|
|
121
121
|
}
|
|
122
122
|
sanitizeBytesSent() {
|
|
123
123
|
if (this.bytesSent && this.bytesSent < 0) {
|
|
124
124
|
logger.debug(`HttpRequestEventData: dropping invalid value for Bytes Sent: ${this.bytesSent}`);
|
|
125
|
-
this.bytesSent = undefined;
|
|
126
125
|
this.hasDroppedProperties = true;
|
|
126
|
+
return undefined;
|
|
127
127
|
}
|
|
128
|
+
return this.bytesSent;
|
|
128
129
|
}
|
|
129
130
|
sanitizeBytesReceived() {
|
|
130
131
|
if (this.bytesReceived && this.bytesReceived < 0) {
|
|
131
132
|
logger.debug(`HttpRequestEventData: dropping invalid value for Bytes Received: ${this.bytesReceived}`);
|
|
132
|
-
this.bytesReceived = undefined;
|
|
133
133
|
this.hasDroppedProperties = true;
|
|
134
|
+
return undefined;
|
|
134
135
|
}
|
|
136
|
+
return this.bytesReceived;
|
|
135
137
|
}
|
|
136
138
|
isStatusCodeError() {
|
|
137
139
|
return (this.statusCode && 400 <= this.statusCode && this.statusCode <= 599);
|
|
@@ -29,7 +29,7 @@ class ModifyEventValidation {
|
|
|
29
29
|
for (const modifier of this.customEventModifierChain) {
|
|
30
30
|
try {
|
|
31
31
|
const eventRv = modifier.modifyEvent(event);
|
|
32
|
-
if (eventRv
|
|
32
|
+
if (!eventRv) {
|
|
33
33
|
isDiscarded = true;
|
|
34
34
|
break;
|
|
35
35
|
}
|
|
@@ -154,9 +154,7 @@ class ModifyEventValidation {
|
|
|
154
154
|
if (!isNewlyAdded) {
|
|
155
155
|
validEntries.push([prop, originalValue]);
|
|
156
156
|
}
|
|
157
|
-
|
|
158
|
-
droppedProperties = true;
|
|
159
|
-
}
|
|
157
|
+
droppedProperties = true;
|
|
160
158
|
continue;
|
|
161
159
|
}
|
|
162
160
|
if (!isNewlyAdded && !overriddenKeys.includes(prop)) {
|
|
@@ -1,7 +1,7 @@
|
|
|
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 = void 0;
|
|
4
|
-
|
|
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;
|
|
4
|
+
exports.SPECIFICATION_VERSION = '0.23.0';
|
|
5
5
|
exports.MAX_CUSTOM_EVENT_FIELDS = 50;
|
|
6
6
|
exports.MAX_CUSTOM_EVENT_KEY_LENGTH = 100;
|
|
7
7
|
exports.MAX_CUSTOM_EVENT_VALUE_LENGTH = 5000;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynatrace/react-native-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.331.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",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"jscodeshift": "^17.3.0",
|
|
53
53
|
"plist": "^3.1.0",
|
|
54
54
|
"proxy-polyfill": "^0.3.2",
|
|
55
|
-
"semver": "^7.7.
|
|
55
|
+
"semver": "^7.7.4"
|
|
56
56
|
},
|
|
57
57
|
"homepage": "https://www.dynatrace.com/",
|
|
58
58
|
"peerDependencies": {
|
|
@@ -67,7 +67,8 @@
|
|
|
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
|
+
"fast-xml-parser@>=4.3.6 <=5.3.3": "5.3.4"
|
|
71
72
|
},
|
|
72
73
|
"devDependencies": {
|
|
73
74
|
"@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.331.1.1008'
|
|
115
115
|
|
|
116
116
|
# Allows for better compatibility for older and newer versions
|
|
117
117
|
if defined?(install_modules_dependencies)
|
package/types.d.ts
CHANGED
|
@@ -636,7 +636,7 @@ interface IEventModifier {
|
|
|
636
636
|
* }});
|
|
637
637
|
* ```
|
|
638
638
|
*
|
|
639
|
-
* @see https://docs.dynatrace.com/docs/
|
|
639
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-custom-events#event-modifiers
|
|
640
640
|
*/
|
|
641
641
|
modifyEvent(event: JSONObject): JSONObject | null;
|
|
642
642
|
}
|
|
@@ -676,7 +676,7 @@ interface IHttpRequestEventData extends IBaseEvent {
|
|
|
676
676
|
* Dynatrace.sendHttpRequestEvent(requestEvent);
|
|
677
677
|
* ```
|
|
678
678
|
*
|
|
679
|
-
* @see https://docs.dynatrace.com/docs/
|
|
679
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
680
680
|
*/
|
|
681
681
|
withDuration(duration: number): this;
|
|
682
682
|
/**
|
|
@@ -694,7 +694,7 @@ interface IHttpRequestEventData extends IBaseEvent {
|
|
|
694
694
|
* Dynatrace.sendHttpRequestEvent(requestEvent);
|
|
695
695
|
* ```
|
|
696
696
|
*
|
|
697
|
-
* @see https://docs.dynatrace.com/docs/
|
|
697
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
698
698
|
*/
|
|
699
699
|
withStatusCode(statusCode: number): this;
|
|
700
700
|
/**
|
|
@@ -712,7 +712,7 @@ interface IHttpRequestEventData extends IBaseEvent {
|
|
|
712
712
|
* Dynatrace.sendHttpRequestEvent(requestEvent);
|
|
713
713
|
* ```
|
|
714
714
|
*
|
|
715
|
-
* @see https://docs.dynatrace.com/docs/
|
|
715
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
716
716
|
*/
|
|
717
717
|
withReasonPhrase(reasonPhrase: string): this;
|
|
718
718
|
/**
|
|
@@ -738,7 +738,7 @@ interface IHttpRequestEventData extends IBaseEvent {
|
|
|
738
738
|
* }
|
|
739
739
|
* ```
|
|
740
740
|
*
|
|
741
|
-
* @see https://docs.dynatrace.com/docs/
|
|
741
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
742
742
|
*/
|
|
743
743
|
withError(error: Error): this;
|
|
744
744
|
/**
|
|
@@ -756,7 +756,7 @@ interface IHttpRequestEventData extends IBaseEvent {
|
|
|
756
756
|
* Dynatrace.sendHttpRequestEvent(requestEvent);
|
|
757
757
|
* ```
|
|
758
758
|
*
|
|
759
|
-
* @see https://docs.dynatrace.com/docs/
|
|
759
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
760
760
|
*/
|
|
761
761
|
withBytesSent(bytesSent: number): this;
|
|
762
762
|
/**
|
|
@@ -774,7 +774,7 @@ interface IHttpRequestEventData extends IBaseEvent {
|
|
|
774
774
|
* Dynatrace.sendHttpRequestEvent(requestEvent);
|
|
775
775
|
* ```
|
|
776
776
|
*
|
|
777
|
-
* @see https://docs.dynatrace.com/docs/
|
|
777
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
778
778
|
*/
|
|
779
779
|
withBytesReceived(bytesReceived: number): this;
|
|
780
780
|
/**
|
|
@@ -793,7 +793,7 @@ interface IHttpRequestEventData extends IBaseEvent {
|
|
|
793
793
|
* Dynatrace.sendHttpRequestEvent(requestEvent);
|
|
794
794
|
* ```
|
|
795
795
|
*
|
|
796
|
-
* @see https://docs.dynatrace.com/docs/
|
|
796
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
797
797
|
*/
|
|
798
798
|
withTraceparentHeader(traceparentHeader: TraceparentHeader): this;
|
|
799
799
|
/**
|
|
@@ -822,13 +822,15 @@ interface IHttpRequestEventData extends IBaseEvent {
|
|
|
822
822
|
* Dynatrace.sendHttpRequestEvent(requestEvent);
|
|
823
823
|
* ```
|
|
824
824
|
*
|
|
825
|
-
* @see https://docs.dynatrace.com/docs/
|
|
825
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
826
826
|
*/
|
|
827
827
|
addEventProperty(key: `event_properties.${string}`, value: EventProperty): this;
|
|
828
828
|
}
|
|
829
829
|
|
|
830
830
|
type TraceparentHeader = `00-${string}-${string}-0${'0' | '1'}`;
|
|
831
831
|
type AllowedRequestMethods = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH' | 'get' | 'head' | 'post' | 'put' | 'delete' | 'connect' | 'options' | 'trace' | 'patch';
|
|
832
|
+
type Url = `http://${string}` | `https://${string}`;
|
|
833
|
+
type EventPropertyKey = `event_properties.${string}`;
|
|
832
834
|
declare class HttpRequestEventData implements IHttpRequestEventData {
|
|
833
835
|
private url;
|
|
834
836
|
private requestMethod;
|
|
@@ -841,7 +843,6 @@ declare class HttpRequestEventData implements IHttpRequestEventData {
|
|
|
841
843
|
private error?;
|
|
842
844
|
private traceparentHeader?;
|
|
843
845
|
private rawEventProperties;
|
|
844
|
-
private traceContextHint;
|
|
845
846
|
private hasDroppedProperties;
|
|
846
847
|
private triedToOverwriteDuration;
|
|
847
848
|
/**
|
|
@@ -860,9 +861,9 @@ declare class HttpRequestEventData implements IHttpRequestEventData {
|
|
|
860
861
|
* Dynatrace.sendHttpRequestEvent(requestEvent);
|
|
861
862
|
* ```
|
|
862
863
|
*
|
|
863
|
-
* @see https://docs.dynatrace.com/docs/
|
|
864
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
864
865
|
*/
|
|
865
|
-
constructor(url:
|
|
866
|
+
constructor(url: Url, requestMethod: AllowedRequestMethods);
|
|
866
867
|
withDuration(duration: number): this;
|
|
867
868
|
withStatusCode(statusCode: number): this;
|
|
868
869
|
withReasonPhrase(reasonPhrase: string): this;
|
|
@@ -870,7 +871,7 @@ declare class HttpRequestEventData implements IHttpRequestEventData {
|
|
|
870
871
|
withBytesSent(bytesSent: number): this;
|
|
871
872
|
withBytesReceived(bytesReceived: number): this;
|
|
872
873
|
withTraceparentHeader(traceparentHeader: TraceparentHeader): this;
|
|
873
|
-
addEventProperty(key:
|
|
874
|
+
addEventProperty(key: EventPropertyKey, value: EventProperty): this;
|
|
874
875
|
toJSON(): JSONObject | null;
|
|
875
876
|
private hasValidMandatoryAttributes;
|
|
876
877
|
private isInvalidUrl;
|
|
@@ -889,7 +890,7 @@ declare class HttpRequestEventData implements IHttpRequestEventData {
|
|
|
889
890
|
* Events can include custom properties and duration information.
|
|
890
891
|
* Use implementations of this interface with `Dynatrace.sendEvent()`.
|
|
891
892
|
*
|
|
892
|
-
* @see https://docs.dynatrace.com/docs/
|
|
893
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-custom-events#send-custom-events
|
|
893
894
|
*/
|
|
894
895
|
interface IEventData extends IBaseEvent {
|
|
895
896
|
/**
|
|
@@ -959,7 +960,7 @@ declare class EventData implements IEventData {
|
|
|
959
960
|
* user session and are attached to all subsequent events in that session.
|
|
960
961
|
* Use implementations of this interface with `Dynatrace.sendSessionPropertyEvent()`.
|
|
961
962
|
*
|
|
962
|
-
* @see https://docs.dynatrace.com/docs/
|
|
963
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-custom-events#send-session-property-events
|
|
963
964
|
*/
|
|
964
965
|
interface ISessionPropertyEventData extends IBaseEvent {
|
|
965
966
|
/**
|
|
@@ -1011,7 +1012,7 @@ declare class SessionPropertyEventData implements ISessionPropertyEventData {
|
|
|
1011
1012
|
* to Dynatrace. Exception events can include custom properties.
|
|
1012
1013
|
* Use implementations of this interface with `Dynatrace.sendExceptionEvent()`.
|
|
1013
1014
|
*
|
|
1014
|
-
* @see https://docs.dynatrace.com/docs/
|
|
1015
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-error-crash-reporting#send-exception-event
|
|
1015
1016
|
*/
|
|
1016
1017
|
interface IExceptionEventData extends IBaseEvent {
|
|
1017
1018
|
/**
|
|
@@ -1100,7 +1101,7 @@ interface IDynatrace$1 {
|
|
|
1100
1101
|
* });
|
|
1101
1102
|
* ```
|
|
1102
1103
|
*
|
|
1103
|
-
* @see https://docs.dynatrace.com/docs/
|
|
1104
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-custom-events#event-modifiers
|
|
1104
1105
|
*/
|
|
1105
1106
|
addEventModifier(eventModifier: IEventModifier): IEventModifier;
|
|
1106
1107
|
/**
|
|
@@ -1117,7 +1118,7 @@ interface IDynatrace$1 {
|
|
|
1117
1118
|
* const removed = Dynatrace.removeEventModifier(modifier);
|
|
1118
1119
|
* ```
|
|
1119
1120
|
*
|
|
1120
|
-
* @see https://docs.dynatrace.com/docs/
|
|
1121
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-custom-events#remove-event-modifiers
|
|
1121
1122
|
*/
|
|
1122
1123
|
removeEventModifier(eventModifier: IEventModifier): boolean;
|
|
1123
1124
|
/**
|
|
@@ -1143,7 +1144,7 @@ interface IDynatrace$1 {
|
|
|
1143
1144
|
* }
|
|
1144
1145
|
* ```
|
|
1145
1146
|
*
|
|
1146
|
-
* @see https://docs.dynatrace.com/docs/
|
|
1147
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-error-crash-reporting#send-exception-event
|
|
1147
1148
|
*/
|
|
1148
1149
|
sendExceptionEvent(exceptionEventData: ExceptionEventData): void;
|
|
1149
1150
|
/**
|
|
@@ -1164,7 +1165,7 @@ interface IDynatrace$1 {
|
|
|
1164
1165
|
* Dynatrace.sendEvent(customEvent);
|
|
1165
1166
|
* ```
|
|
1166
1167
|
*
|
|
1167
|
-
* @see https://docs.dynatrace.com/docs/
|
|
1168
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-custom-events#send-custom-events
|
|
1168
1169
|
*/
|
|
1169
1170
|
sendEvent(eventData: EventData): void;
|
|
1170
1171
|
/**
|
|
@@ -1184,7 +1185,7 @@ interface IDynatrace$1 {
|
|
|
1184
1185
|
* Dynatrace.startView('HomeScreen');
|
|
1185
1186
|
* ```
|
|
1186
1187
|
*
|
|
1187
|
-
* @see https://docs.dynatrace.com/docs/
|
|
1188
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-app-performance#view-monitoring
|
|
1188
1189
|
*/
|
|
1189
1190
|
startView(name: string): void;
|
|
1190
1191
|
/**
|
|
@@ -1208,7 +1209,7 @@ interface IDynatrace$1 {
|
|
|
1208
1209
|
* Dynatrace.sendSessionPropertyEvent(sessionEvent);
|
|
1209
1210
|
* ```
|
|
1210
1211
|
*
|
|
1211
|
-
* @see https://docs.dynatrace.com/docs/
|
|
1212
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-custom-events#send-session-property-events
|
|
1212
1213
|
*/
|
|
1213
1214
|
sendSessionPropertyEvent(sessionPropertyEventData: SessionPropertyEventData): void;
|
|
1214
1215
|
/**
|
|
@@ -1231,7 +1232,7 @@ interface IDynatrace$1 {
|
|
|
1231
1232
|
* Dynatrace.sendHttpRequestEvent(detailedRequest);
|
|
1232
1233
|
* ```
|
|
1233
1234
|
*
|
|
1234
|
-
* @see https://docs.dynatrace.com/docs/
|
|
1235
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
1235
1236
|
*/
|
|
1236
1237
|
sendHttpRequestEvent(httpRequestEvent: HttpRequestEventData): void;
|
|
1237
1238
|
}
|