简体   繁体   English

使用新的Relic进行Spring Boot而无需修改依赖项

[英]Spring Boot with New Relic without modifying dependencies

I am trying to configure New Relic to monitor Spring applications created using Spring Boot. 我正在尝试配置New Relic以监视使用Spring Boot创建的Spring应用程序。 The applications are already in a released state and I would like to be able to integrate New Relic without modifying the dependencies of the java applications, as in this question . 这些应用程序已经处于发布状态,我希望能够在不修改Java应用程序依赖性的情况下集成New Relic,如本问题所述

Is there any way to include the new relic agent in such a way that restarting the Spring Boot application with new command line arguments will suffice? 有没有什么办法可以用新的命令行参数重启Spring Boot应用程序就足够了?

EDIT 编辑

I had read warnings about using the -javaagent:/path/to/newrelic.jar flag and getting error messages, but had not tried it for myself. 我已阅读有关使用-javaagent:/path/to/newrelic.jar标志的警告,并收到错误消息,但我自己没有尝试过。 It appears that this option works now. 看来此选项现在可以使用了。

SECOND EDIT 第二编辑

The single spring boot app is reporting two separate applications, one for the Embedded Tomcat server and another for the Java application itself. 单个spring boot应用程序正在报告两个单独的应用程序,一个用于嵌入式Tomcat服务器,另一个用于Java应用程序本身。 Would there be a way to resolve this? 有办法解决吗?

THIRD EDIT (for anyone reading this in the future) 第三编辑 (适用于以后阅读此书的任何人)

My spring boot app was reporting two applications to the New Replic APM tool. 我的春季启动应用程序正在向New Replic APM工具报告两个应用程序。 In order to avoid this, I now start the java application with an environment variable: 为了避免这种情况,我现在使用环境变量启动Java应用程序:

export NEW_RELIC_APP_NAME="my spring boot app"
java -jar spring-boot-app-1.0.jar -javaagent:/path/to/newrelic.jar

事实证明,独立应用程序的说明也适用于Spring Boot应用程序:

java -jar spring-boot-app-1.0.jar -javaagent:/path/to/newrelic.jar

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

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