State Telemetry

Changes in your application’s state are important context to understand how an error occurred. You can easily send these state changes to TrackJS by hooking into our custom console. However, because of the diversity in application design, we can’t show you exactly how to do this. You’ll need to add a hook into your application wherever state is maintained.

If you use Redux, we have an example of how to build TrackJS middleware. If you’re using a different architecture, here is a rough solution:

(function main() {

    setState: function(newState) {
        TrackJS.console.info(newState);
        // standard behavior to update your state
    }

})();
trackjs application state example

WARNING The total size of the TrackJS error payload is 100 kb. If your state contains very large objects, storing many changes may exceed the limit of the error payload. The TrackJS agent will attempt to truncate these large objects to fit within the payload limit, however relevant data may get excluded. We recommend logging only the values that change.