Mendix implementation of Sentry (version 1.1)
- Mendix Native client and Web/Desktop (using Sentry 2.4.3)
- Redirection of client logs -as in the normal Log actions you can already use in nanoflows
- Uncatched errors
- Breadcrumbs (using Javascript action)
- User correlation (Javascript action)
- Tags (Javascript action)
- Performance
- User specific configuration
- Mendix Runtime (using Sentry 4.3.0)
- Redirection of Mendix logging to Sentry (including Mendix runtime version, model revision, hostname and lognode)
- Performance (including nested transactions)
The implementation on the Mendix Native domain consists of the following component:
- The Mendix Module (Sentry) containing a widget and Javascript actions
- The Sentry library included in the Mendix Native Template
The implementation of Sentry is implemented quite early as a static initialization inside the widget source.
Collect the following values from the Sentry UI:
-
DSN: Settings > sentry > project > Client Keys (DSN) (e.g. http://[email protected]:9000/3)
-
Environment to target (e.g. dev/test/prod/...)\
Assuming you already have your Mendix Native project locally, execute the following commands with the command line in the project's directory.
npm install --save @sentry/[email protected]
npx sentry-wizard -i reactNative -p ios android --skip-connect
Note: the --skip-connect part is included for on-premise environments. If you're leveraging sentry.io, you can leave this part.
Perform the following steps:
- Import the module into the project (e.g. from the App Store)
- Implement the
Sentry.Administrationsnippet into your project. - Attach
Sentry.AfterStartupto your after startup flow. - Mendix Native
- Include the Sentry widget on your homepages (e.g. for both the Anonymous and User homepage)
- Configure the Native Sentry settings.
- Add the
Sentry.NativeConfigurationto your Offline Synchronization profile.
- Desktop/Web
- Connect the InitWebSentry nanoflow to a nanoflow which starts early in your app.
- Configure the Native Sentry settings.
- Apply the Sentry actions within your model where they suit the best.
- Apply the Sentry configuration at the Native and Runtime Configuration in the
Administration
If everything is configured correct, all will magically work and messages will arrive on your Sentry host. If this is not the case, take the following steps:
- Set the
debugattribute in the JSON object of theNativeDefaultConfigand theConfigurationin Native Configuration to true. - Attach your device to a development environment.
- Inspect the log messages with e.g. Logcat of Android Studio.
Seen all components (native template, widget and Javascript actions) need to be aware of the Sentry API, they require the Node modules in all parts. It is recommended to pin the version and upgrade all components at the same time. My preferred order is:
-
Upgrade the Native Template
-
Upgrade the widget (in
widgets.src/js) -
Copy the overlapping modules of
javascriptsource/reactnativebackgroundgeolocation/actions/node_modulesandwidgets.src/js/node_modulesfrom thewidgets.srcto thejavascriptactions
It's not pretty, but it works.
- Model
- Attach the AfterStartup microflow to the after startup sequence.
- Make the snippet
Sentry.Web_Configurationavailable in the application for configuration. - Connect the
Administratormodule role to a project role.
- Configure the environments through the added snippet.
- Restart the application if configuration is completed.
The Native_X Javascript actions are now suitable for Web/Desktop and have been renamed to generic names, e.g. from Native_StartTransaction to StartTransaction. You might have to reselect the actions in your model.
The constant Sentry.NativeConfig has been renamed to Sentry.NativeDefaultConfig. This configuration will only be used if no Sentry.NativeConfigruation has been configured.
Make sure that sentry-4.3.0.jar is the only sentry-X.jar in the userlib folder of your Mendix project.
None.
- Re-read the installation instructions. The majority of instructions are new.
- The constant
Sentry.SentryConfighas been renamed toSentry.NativeConfig - The actions for Mendix Native have been prefixed with
Native_(e.g. fromAddTagtoNative_AddTag)