Start Meteor APM on Specific Instances of a Meteor Application

I have been enjoying Arunoda Susiripala's fantastic Meteor APM for monitoring performance of Meteor applications. It is very handy for finding issues in your applications and infrastructure.

While I run the Meteor apps locally for devleopment, I find it nice to have APM initialize on just my test servers so I know the source of data APM is anaylizing and displaying. It dawned on me that it would be pretty simple to limit the instace where APM initializes. To do this, I wrapped Apm.connect in a conditional statement which checks the root URL of the application. Next, I make sure to set the ROOT_URL environment variable before launching Meteor to run the application. Code examples below.

Once an application goes into production, it might be a great idea to add another application to APM and track production performance separately. The same can be done for staging and other servers are desired.

Note: APM will be be publicly available on June 2nd. You can request early access prior to that date.

Blog Category: 

Add new comment