How to integration new relic in springboot project

Xiao Qiang Lv4

How to integrate newRelic into spring-boot application

From the stackoverflow, I found three ways to implement newRelic integration.

  • Way one locally test by java cmd
    • we can download java agent from the following url.
    • unzip the zip file
    • modify the license_key and app_name
    • run mvn package to build your application jar package
    • Enter this command java -javagent: <path to your new relic jar>\newrelic.jar -jar <path to your application jar>\.jar
    • go to newrelic console
      • your application APM
        APM service name
      • other metrics
        metrics charts
      • logs contents
        logs contents
  • Way two using newRelic agent locally
    • using intellig idea jvm, add newrelic.jar path to jvm option
    • open Edit Configuration ->
      add agent path to jvm option
    • click debug/run
    • console will
  • Way three using maven dependency
    • add maven dependency
      • <dependency>
            <groupId>com.newrelic.telemetry</groupId>
            <artifactId>micrometer-registry-new-relic</artifactId>
            <version>0.8.0</version>
        </dependency>
        
    • add NewRelicMetricsExportAutoConfiguration as a java been to auto detect interface
      • For example, adding apikey, application service name. etc. By Override existed methods.
  • Way four using dockerfile to access new relic agent
    • add new Dockerfile
    • copy code src, pom, newrelic agent into docker images
    • docker build -t local/newrelicjava .
    • docker run -it -p 8080:8080 local/newrelicjava

source code

  • Title: How to integration new relic in springboot project
  • Author: Xiao Qiang
  • Created at : 2023-03-05 14:07:20
  • Updated at : 2025-03-08 10:49:30
  • Link: http://fdslk.github.io/uncategorized/2023/03/05/integration-new-relic/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments