New-Relic Add-on for Java Application on Heroku Setup

Add New Relic Agent Dependency

 <dependency>
  	<groupId>com.newrelic.agent.java</groupId>
  	<artifactId>newrelic-agent</artifactId>
  	<version>3.5.1</version>
  	<scope>provided</scope>
</dependency>

pom.xml build tag

  <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
                <version>2.3.2</version>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.2</version>
            </plugin>
            
            <plugin>
				<groupId>com.mysema.maven</groupId>
				<artifactId>apt-maven-plugin</artifactId>
				<version>1.0.8</version>
				<dependencies>
					<dependency>
						<groupId>com.mysema.querydsl</groupId>
						<artifactId>querydsl-apt</artifactId>
						<version>2.9.0</version>
					</dependency>
				</dependencies>
				<executions>
					<execution>
						<phase>generate-sources</phase>
						<goals>
							<goal>process</goal>
						</goals>
						<configuration>
							<outputDirectory>target/generated-sources</outputDirectory>
							<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
						</configuration>
					</execution>
				</executions>
			</plugin>
            
            
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                           <goal>copy</goal>
                        </goals>
                         
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.github.jsimone</groupId>
                                    <artifactId>webapp-runner</artifactId>
                                    <version>7.0.22.3</version>
                                    <destFileName>webapp-runner.jar</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                   <execution>
         				 <id>copy-new-relic</id>
          					<phase>package</phase>
         				<goals>
          					 <goal>copy-dependencies</goal>
         				 </goals>
         				 <configuration>
           					 <includeGroupIds>com.newrelic.agent.java</includeGroupIds>
           					 <includeArtifactIds>newrelic-agent</includeArtifactIds>
           					 <stripVersion>true</stripVersion>
          					</configuration>
        			</execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
	<plugins>
    <!-- Ignore/Execute plugin execution -->
    <plugin>
        <groupId>org.eclipse.m2e</groupId>
        <artifactId>lifecycle-mapping</artifactId>
        <version>1.0.0</version>
        <configuration>
            <lifecycleMappingMetadata>
                <pluginExecutions>
                    <!-- copy-dependency plugin -->
                    <pluginExecution>
                        <pluginExecutionFilter>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-dependency-plugin</artifactId>
                            <versionRange>[1.0.0,)</versionRange>
                            <goals>
                                <goal>copy-dependencies</goal>
                            </goals>
                        </pluginExecutionFilter>
                        <action>
                            <ignore />
                        </action>
                    </pluginExecution>
                </pluginExecutions>
            </lifecycleMappingMetadata>
        </configuration>
    </plugin>
   </plugins></pluginManagement>
        
    </build>
    <name>CloudSole Developer</name>
    <description>CloudSole Developer</description>
    <organization>
    	<name>Thys Michels</name>
    	<url>http://www.thysmichels.com</url>
    </organization>

Create newrelic.yml and save to project route (same level as pom.xml)

.....
license_key: 'OURLICENCEKEYHERE'
....
app_name: CloudSole
....

Add the following flag to your JAVA_OPTS config var on Heroku:

heroku config:set JAVA_OPTS='-Xmx384m -Xss512k -XX:+UseCompressedOops -javaagent:target/dependency/newrelic-agent.jar' NEW_RELIC_APP_NAME="CloudSole"

2 Comments on “New-Relic Add-on for Java Application on Heroku Setup”

  1. Nice respond in return of this difficulty with genuine arguments and explaining all on the topic of that.

  2. This is unquestionably one from the best handheld Wi-Fi devices readily available for its practical convenience. Networks built to use wireless are vulnerable whether they’re switched you aren’t.

    If you can not move your Xbox 360, consider utilizing a USB extension cable to provide you more flexibility in locating the Xbox 360 Wireless Adapter itself. Wireless fidelity, other wise called Wi-Fi, has become a great tool in aiding people connect to the Internet minus the use of wires. Buying a car ny Not only will this implies you’re more probable to get the compatibility you may need but you’re not as likely to encounter some outdated setup process.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: