Kadira - Performance Monitoring for Meteor
This project is based on the Kadira to fix meteorx package and upgrading the email package.
If you are looking for the kadira server, take a look at meteor apm server.
Why another one?
- remove legacy code
- ES6
- Meteor 2.7.3 with Meteorx updated
Getting started
- Create an account in Meteor APM or Kadira
- From the UI, create an app. You'll get an
AppIdand anAppSecret. - Run
meteor add industrialwebapps:kadirain your project - Configure your Meteor app with the
AppIdandAppSecretby adding the following code snippet to aserver/kadira.jsfile:
1Meteor.startup(function() { 2 Kadira.connect('<AppId>', '<AppSecret>'); 3});
Now you can deploy your application and it will send information to Kadira. Wait up to one minute and you'll see data appearing in the Kadira Dashboard.
Auto Connect
Your app can connect to Kadira using environment variables or using Meteor.settings.
Using Meteor.settings
Use the followng settings.json file with your app:
1{ 2 ... 3 "kadira": { 4 "appId": "<appId>", 5 "appSecret": "<appSecret>" 6 } 7 ... 8}
The run your app with meteor --settings=settings.json.
Using Environment Variables
Export the following environment variables before running or deploying your app:
export KADIRA_APP_ID=<appId> export KADIRA_APP_SECRET=<appSecret>
Error Tracking
Kadira comes with built in error tracking solution for Meteor apps. It has been enabled by default. For more information, please visit the meteor docs.
By default, Kadira tracks all the errors for you. But you may need to handle errors yourself. For those situations, you may need to report the error back to kadira as well. Here are the some of the options you can do.
Option 1 - Throw a new Error
Easiest option is try capture errors and handle them yourself. Then throw another error. Then kadira will capture that and you can see that error from in the UI.
1try { 2 // your code which may throw some errors 3} catch(ex) { 4 // handle your error and throw again 5 throw ex; 6}
Option 2 - Use Kadira.trackError
Other option is to use Kadira.trackError API. Which is available on both client and the server. See how it can used.
1try { 2 // your code 3} catch(ex) { 4 var type = 'my-error-type'; 5 var message = ex.message; 6 Kadira.trackError(type, message); 7}
When you are tracking custom errors, do not use following types:
- client
- method
- sub
- server-crash
- server-internal
We use above types to track errors automatically. If you also send errors with above types, things may not works as they used to.