繁体   English   中英

在heroku play framework 2.2.1 java app中添加新的relic插件

[英]adding new relic addon to heroku play framework 2.2.1 java app

这就是我想要做的。 - >在Heroku上部署一个play框架(2.2.1)Java Web应用程序,并使用newrelic作为附加组件。

**问题/问题: * *

这些是我到目前为止所做的步骤。

1)我能够使用addon的heroku命令添加插件“heroku addons:add newrelic:stark”我在heroku资源中看到了add。

2)添加newrelic.yml文件。 添加了newrelic.yml文件作为附加并保存在play框架的conf文件夹中(是否存在application.conf文件)。 我收到的文件来自https://gist.github.com/anfuerer/6169040 (刚刚更新的许可证和应用信息)

3)作为其播放2.2.1,更改了built.sbt文件以添加依赖项。

"com.newrelic.agent.java" % "newrelic-agent" % "3.4.0",
  "com.newrelic.agent.java" % "newrelic-api" % "3.4.0"

4)heroku所需的我的Procfile指定了JAVA_OPTS,并使用命令设置了JAVA_OPTS

heroku config:set JAVA_OPTS =“ - Xmx384m -Xss512k -XX:+ UseCompressedOops -Dfile.encoding = UTF-8 -javaagent:target / staged / newrelic-agent-3.4.0.jar -Dnewrelic.bootstrap_classpath = true -Dnewrelic.config .file =。/ conf / newrelic.yml newrelic.config.log_level = finer newrelic.debug = true“

5)显然所有的更改都添加到git并在通过命令“git heroku push master”推送到heroku之前已经提交。

6)一些基本的健全性测试..我在heroku config命令之后看到我的配置为 -

JAVA_OPTS:             -Xmx384m -Xss512k -XX:+UseCompressedOops -Dfile.encoding=UTF-8 -javaagent:target/staged/newrelic-agent-3.4.0.jar -Dnewrelic.bootstrap_classpath=true -Dnewrelic.config.file=./conf/newrelic.yml newrelic.config.log_level=finer newrelic.debug=true
NEW_RELIC_APP_NAME:   test_application
NEW_RELIC_LICENSE_KEY: 000000000000000000000000000000000  (changed offcourse)
NEW_RELIC_LOG:         stdout
PATH:                  .jdk/bin:.sbt_home/bin:/usr/local/bin:/usr/bin:/bin
REPO:                  /app/.sbt_home/.ivy2/cache
SBT_OPTS:              -Xmx384m -Xss512k -XX:+UseCompressedOops

还尝试通过“heroku run env | grep NEW_RELIC”检查,它给出了输出 -

NEW_RELIC_LOG=stdout
NEW_RELIC_LICENSE_KEY=00000000000000000000000000000
NEW_RELIC_APP_NAME=test_application

现在我去我的Heroku应用程序仪表板,点击我的应用程序查看添加内容并点击新文物,然后我来到一个屏幕,要求我设置我的应用程序 -

我点击设置,但是我需要下载Java代理,它要我将java代理安装到网络服务器上。

#################编辑

尝试按照@Jeanie的评论在Play应用程序框架上安装java newrelic

1)在downloads文件夹中下载新的遗留java代理。

2)解压缩到play framework app文件夹(项目文件夹)(这需要是播放框架文件夹,其中播放构建文件是??)使用

 unzip newrelic_agent3.4.0.zip -d /path/to/appserver/ 

3)将目录更改为/ appfolder / newrelic /

4)使用安装罐子

Jan 20, 2014 12:48:39 -0700 [6935 1] com.newrelic INFO: Agent is using Logback
***** ( ( o))  New Relic Java Agent Installer
***** Installing version 3.4.0 ...
Could not edit start script because:
 .:. Could not locate a Tomcat, Jetty, JBoss, JBoss7 or Glassfish instance in /home/amit/Applications/play-2.2.1/appfolder/
Try re-running the install command with the -s <AppServerRootDirectory> option or from <AppServerRootDirectory>/newrelic.
If that doesn't work, locate and edit the start script manually.
No need to create New Relic configuration file because:
 .:. A config file already exists: /home/amit/Applications/play-2.2.1/appfolder/newrelic/newrelic.yml
***** Install incomplete
***** Next steps:
For help completing the install, see https://newrelic.com/docs/java/new-relic-for-java

5)这是我得到的信息。

 Jan 20, 2014 12:48:39 -0700 [6935 1] com.newrelic INFO: Agent is using Logback ***** ( ( o)) New Relic Java Agent Installer ***** Installing version 3.4.0 ... Could not edit start script because: .:. Could not locate a Tomcat, Jetty, JBoss, JBoss7 or Glassfish instance in /home/amit/Applications/play-2.2.1/appfolder/ Try re-running the install command with the -s <AppServerRootDirectory> option or from <AppServerRootDirectory>/newrelic. If that doesn't work, locate and edit the start script manually. No need to create New Relic configuration file because: .:. A config file already exists: /home/amit/Applications/play-2.2.1/appfolder/newrelic/newrelic.yml ***** Install incomplete ***** Next steps: For help completing the install, see https://newrelic.com/docs/java/new-relic-for-java 

我在这里错过了什么吗? 请注意这是一个Play框架应用程序,我希望newrelic插件可以在heroku上工作,而不是在我的机器上本地工作。

问题:

1)如何在heroku上安装java代理? 我首先需要吗?

2)不应该heroku和新的遗物添加我的应用程序,因为我已经添加了api和java代理作为第3步的添加?

任何帮助或方向赞赏。

问题解决了。 这是步骤。

1)获取Heroku上的添加

$ heroku addons:add newrelic:stark

2)转到您的应用仪表板并单击资源。 然后单击新的遗物插件。 这会将您带到一个页面,要求您进行设置。

3)单击设置,选择Java,单击以查看许可证编号并下载jar文件。

4)如设置页面所述,将jar文件解压缩到项目的根目录。 不要运行安装程序,因为您需要在Heroku上使用新文件。

5)编辑Heroku Procfile如下:

web: target/universal/stage/bin/myapp -Dhttp.port=${PORT} ${java_opts} -DapplyEvolutions.default=true -Ddb.default.driver=com.mysql.jdbc.Driver -Ddb.default.url=${CLEARDB_DATABASE_URL} -J-javaagent:newrelic/newrelic.jar -J-Dnewrelic.config.file=newrelic/newrelic.yml 

(根据需要更改其他设置,保持新的遗物设置不变,不要忘记在“ target / universal / stage / bin / myapp ”中将您的应用名称替换为myapp)

6)向build.sbt或Build.scala添加依赖项

"com.newrelic.agent.java" % "newrelic-agent" % "3.7.0"

7)使用git push heroku master将应用程序部署到heroku

8)将自动检测新遗物,设置页面将显示相关指标。

如果有人遇到任何问题,请告诉我。

只是为了让它不受影响,以便我们不会问你同样的基本问题。 你去送行说明https://devcenter.heroku.com/articles/newrelic ,并在密切关注Java配置https://devcenter.heroku.com/articles/newrelic#java-configuration 这应该让你朝着正确的方向前进。

如果这样做或者您需要进一步的帮助,请告诉我们。 有一个与此相关的故障单,如果需要,我们可以继续进一步排除故障。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM