旧答案如下。
2014 年更新:
截至撰写本文时的 Meteor 版本:0.9.4
。甜的。几乎是1.0!
好吧,我决定编辑这个,因为它现在已经非常过时了,但仍然得到了赞成。
从 Meteor 0.7+ 或附近(记不清了)开始,Meteor 中的 require-ing 已经从__meteor_bootstrap__.require
to Npm.require
var require = Npm.require;
var newrelic = require('newrelic');
这遵循智能包模式中的 Npm. 在这里阅读更多相关信息 http://www.meteorpedia.com/read/npm#NPM%20in%20a%20Smart%20Package
摘录给懒人(谢谢,气象百科全书 http://www.meteorpedia.com!):
智能包中的 NPM
-
In your package.js
,添加一个子句,例如:
npm.depends({
“走”:“2.2.1”
});
-
Use Npm.require
而不是要求,例如
var http = Npm.require('http');
但说真的,请在流星百科上阅读整篇文章。这是值得你花时间的。
或者,您还可以使用arunoda http://arunoda.me/优秀的NPM智能包。在这里查看!https://github.com/meteorhacks/npm https://github.com/meteorhacks/npm
旧答案:
取自本指南 https://coderwall.com/p/2fveyq,您应该能够像安装任何其他 npm 模块一样安装 newrelic 代理。在您的流星项目文件夹中:
$ cd .meteor/local/build/server
$ npm install newrelic
现在,您可以通过以下方式使用它require
:
var require = __meteor_bootstrap__.require;
var newrelic = require('newrelic');
然后,按照此处指定的方式配置您的代理:https://github.com/newrelic/node-newrelic/#configuring-the-agent https://github.com/newrelic/node-newrelic/#configuring-the-agent
如果您需要使用该指南中指定的环境变量,请运行meteor
设置了环境变量的命令,例如:
$ NEW_RELIC_APP_NAME=mynodeapp meteor
应该是这样,但我还没有真正广泛地使用它,因为我还没有找到任何这样做的理由。让我们知道您会得到什么!