Meteor is a complete platform for building web and mobile apps in pure Javascript. Atatus provides meteor package for monitoring errors and performance of your Meteor apps.
Meteor Client Installation
Install Atatus meteor integration package using:
meteor add atatus:atatus
Add AtatusNotifier.initialize(settings)
to Meteor.startup()
on the client, ie:
if (Meteor.isClient) {
Meteor.startup(function () {
AtatusNotifier.initialize({
client: {
apiKey: 'YOUR_API_KEY',
options: {
tags: ['paid_user', 'premium'],
customData: {
name: 'John Doe',
plan: 'premium',
beta_access: true
},
version: '1.0.0'
}
},
trackUser: true
});
});
}
where client.apiKey
is your browser project's API key. If you don't have a browser project in your Atatus dashboard, then create a project and follow the steps. Here client.options
is an advanced configuration to atatus and it is optional.
If you are using the Meteor Accounts package, you can enable user tracking on errors with trackUser
option.
Test Integration
To verify that your integration is working, call notify() in your application. An error will appear in your project dashboard.
atatus.notify(new Error('Test Atatus Setup'));
Meteor Server Installation
To track meteor errors in Meteor server, you need to create Node.js APM project and install Atatus Node.js agent.
// Install Atatus Node Agent
npm install --save atatus-nodejs
Initialize atatus in your meteor server as follows
if (Meteor.isServer) {
var atatus = require("atatus-nodejs");
// var atatus = Meteor.npmRequire("atatus-node"); // For older meteor
atatus.start({
licenseKey: "YOUR_APM_LICENSE_KEY",
appName: "YOUR_APP_NAME"
});
var consoleLogOrig = console.log;
console.log = function (message) {
// special case for meteor dev mode
if(message === 'LISTENING') {
return consoleLogOrig.call(console, 'LISTENING');
}
if (typeof message === 'string' && message.indexOf('Exception') === 0) {
atatus.notifyError(message);
}
consoleLogOrig.apply(console, arguments);
};
}
where YOUR_APM_LICENSE_KEY
is your APM license key. YOUR_APP_NAME
is your Node.js project name in atatus.
Notify Error from Meteor Client
Atatus can capture errors automatically. You can also manually notify error as follows
AtatusNotifier.notify(new Error('Test error'));
Optionally you can pass a custom data as second argument and tags as third argument:
AtatusNotifier.notify(new Error('Test error'), {
name: 'John Doe',
plan: 'premium',
beta_access: true
}, ['production', 'premium']);
Atatus also works very well with saving full error and exception stack traces. Simply pass an Error or a Meteor.Error object to the log method to keep the stack trace.
AtatusNotifier.notify(new Meteor.Error(422, 'Failed to save object to database'));