Sentry Integration

Sentry Integration
by AceOfAces
Version R1.03 (25/04/2021)
​
This plugin allows developers to receive automated crash reports when the game crashes. This can be a life-saver, especially if the players don't bother to report bugs. You can even use this plugin to catch errors in the code as well.

This plugin uses Sentry as a base.

Features​
  • Portable plugin. It can be used in pretty much every platform an RPG Maker game can run.
  • Easy to use API.
  • Easy to install. Put in some details, edit the HTML, and you are off!
  • [R1.01+] Includes a customizable feedback window for crashes.
Screenshots
Spoiler
X8k3afp.png
OJoWctz.png

Demo​
This is quite self-explanatory. I'll upload a test project so you can see how it works.

Installation and Setup​
The setup is a bit complex, so I wrote a guide for setup.
​
Spoiler
1. Sign up to Sentry (https://sentry.io). We'll need a DSN for this.

2. Once you've signed up, you'll be asked to create a project. Follow the instructions (make sure to select JavaScript as the programming language).

3. Now, you'll need to download the package. Copy the URL in the "<script" part and open the link in the browser. Then, right-click and select "Save As...". Save the js file in the game's js/libs folder. For simplicity, name it as sentry.js

3. Now, let's set up your project. Do the following:

- Edit the index.html with a code editor (or notepad). In the body section, insert this on top of the line that references pixi.js:
Code:
<script type="text/javascript" src="js/libs/sentry.js"></script>
- Put the plugin in the top area of the plugin list. This is important, since we need to initialize the library before the game starts up.
- If you use Yanfly's Core Engine or Olivia's Player Anti-Stress plugin, we'll need to patch them. Open the plugin(s) with notepad or a code
editor, find the SceneManager.catchException and add the line:
Code:
FirehawkADK.SentryIntegration.ReportEvent(e, 'fatal', 'engine', 'code');
Underneath the line:
Code:
SceneManager.catchException = function(e){
- Once this is done, you'll need to fill in the data necessary to initialize the SDK. Copy the DSN (see the init code in the setup page), the version and environment tags you've set up over to this plugin's parameters. Make sure to replace [at] with the @ symbol and switch the 'Force Reporting' to Yes.

4. Once the project's set up, we'll need to test it out. Take any plugin and add a myfunction1(); in another function. The AltMenuScreen plugin is a good candidate. Also, make sure to set the 'Force Reporting' option to Yes.

5. If the game crashes and Sentry has en entry for the error, the plugin's set up correctly. Set the 'Force Reporting' option to No. Make sure to also remove the myfunction1(); as well.
​

Q&A
​
Spoiler
Q: What is Sentry?
A: Sentry is an error tracking service. This handles the automatic reports for you, providing information about the crash (see below for details) it can also integrate with a code hosting service (such as Github) to provide more context as well. You can either use the company's servers or host it on your servers.

Q: What does the service collect?
A: The service collects the stack trace (the error that the console throws), breadcrumbs (what did the engine do until the error or crash occurred), Operating System name and version, browser version, any tags you've set up via code and IP address ( you can prevent the collection of the IP address via JS code or in the dashboard settings).

Q: Does the plugin send reports without the user's approval?
A: Under normal circumstances, no. RPG Maker MV pretty much catches any exceptions (errors) that occur. So, unless you bypass the catch code, it shouldn't send anything without the user's approval.

Q: After installing the plugin and library, do I need to do anything else?
A: There are a few things, to ensure that no personal info is sent. Aside from leaving the 'Default Option' setting to 'Don't send', it's a good idea to adjust the privacy settings in Sentry's dashboard. I recommend setting most of the privacy settings to ON (specifically, turn on Enhanced Privacy, Require Data Scrubber, Require Using Default Data Scrubbers and Prevent Storing of IP addresses). Setting up the Global Sensitive Fields option is also a good idea. Lastly, please make sure that you disclose the use of the service to your players.

If there are any other questions, please let me know and I'll try to help as much as possible. Please handle this plugin and service with care.
​


Compatibility​
Tested with RPG Maker MV version 1.6.2. May work with version 1.5.x. Versions older than 1.5 may work but I cannot guarantee compatibility. Compatible with most plugins.

Download
Github
itch.io

Credits
AceOfAces

Changelog:​
Spoiler
R1.03
-Added support for Console log capturing.
-The plugin can now store captured events when the player is offline.
-By default, the plugin will record the player's location in the game's level (including the checks for if they are fighting and/or are in a vehicle).
R1.02
-Added the option to adjust the Session Recording setting.
-Improved stability of the plugin when the game closes.
R1.01
-Added a customizable feedback window.
R1.00
-Initial Release
Nice thank you !
This is awesome! Thank you 🙂
Heyo! I've recently released a new update to the plugin. This adds a small but pretty important change: In crashes, a feedback window will appear for the user, allowing them to provide additional info.


Quick note: Make sure to update the Sentry library before updating the plugin.
Oh, this is really helpful! Thank you so much!

Unrelated question... Could I somehow get other player's info for example variable's values etc?
@KotoYama , it is technically possible to pull info if you need it. You will need to edit the code in the plugin to pull this off. Take a look at the documentation for Sentry for how to add any details you need: Add Context for JavaScript | Sentry Documentation
Released version R1.03 for the plugin.


Important Note: In order to add the support for Console Capturing and Offline Storage, two integrations for Sentry need to be installed as well. A link to download them is in the help file.

Changelog:​

  • Added support for Console log capturing.
  • The plugin can now store the events captured if the user is not connected to the internet.
  • The player's location in the game's level is now captured by default (including if they are fighting and/or are in a vehicle).

Original thread: https://forums.rpgmakerweb.com/threads/sentry-integration.117184/