Sentry

Content Type: Module
Categories: Tracing

Overview

This module enables error capturing and performance analysis for the Mendix Runtime and Mendix Native applications

Documentation

Mendix implementation of Sentry (version 1.1)

Implemented parts of the platform

  • 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)

Mendix Native

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.

Installation instructions

Preparations

Collect the following values from the Sentry UI:

Mendix Native Template

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/react-native@2.4.3
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.

Mendix Model

Perform the following steps:

  • Import the module into the project (e.g. from the App Store)
  • Implement the Sentry.Administration snippet into your project.
  • Attach Sentry.AfterStartup to 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.NativeConfiguration to 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

Debugging

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 debug attribute in the JSON object of the NativeDefaultConfig and the Configuration in Native Configuration to true.
  • Attach your device to a development environment.
  • Inspect the log messages with e.g. Logcat of Android Studio.

Development

Dependency management

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_modules and widgets.src/js/node_modules from the widgets.src to the javascriptactions

It's not pretty, but it works.

Mendix Runtime

Installation instructions

  • Model
    • Attach the AfterStartup microflow to the after startup sequence.
    • Make the snippet Sentry.Web_Configuration available in the application for configuration.
    • Connect the Administrator module role to a project role.
  • Configure the environments through the added snippet.
  • Restart the application if configuration is completed.

Upgrade instructions

From any to 1.1.0

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.

From 0.5 to 0.6

The constant Sentry.NativeConfig has been renamed to Sentry.NativeDefaultConfig. This configuration will only be used if no Sentry.NativeConfigruation has been configured.

From 0.4 to 0.5

Make sure that sentry-4.3.0.jar is the only sentry-X.jar in the userlib folder of your Mendix project.

From 0.3 to 0.4

None.

From 0.2 to 0.3

  • Re-read the installation instructions. The majority of instructions are new.

From 0.1 to 0.2

  • The constant Sentry.SentryConfig has been renamed to Sentry.NativeConfig
  • The actions for Mendix Native have been prefixed with Native_ (e.g. from AddTag to Native_AddTag)

Releases

Version: 1.2.0
Framework Version: 8.18.1
Release Notes: Configurable loglevel per profile (web/native/runtime). This reduces the amount of logs sent to Sentry.
Version: 1.1.0
Framework Version: 8.18.1
Release Notes: Added integration for the Web/Desktop client in a similar way as for Native/Runtime.
Version: 1.0.0
Framework Version: 8.18.1
Release Notes: - Upgraded Sentry versions. - Performance for client. - Server side configuration for Native clients - User specific configurations for Native clients