Merge remote-tracking branch 'profiler-optional/master' into merge

This commit is contained in:
Jongho Moon
2014-08-27 18:05:12 +09:00
6 changed files with 339 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
Pinpoint-profiler-optional
=========
아래와 같이 maven compile을 하기 위해서는 JDK 1.7+이 필요합니다.
```xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<inherited>true</inherited>
<configuration>
<source>1.7</source>
<target>1.7</target>
<debug>${compiler-debug}</debug>
<optimize>true</optimize>
<fork>true</fork>
<verbose>true</verbose>
<compilerVersion>1.7</compilerVersion>
<executable>${JAVA_7_HOME}/bin/javac</executable>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
```
환경변수에 JAVA_7_HOME을 잡아주시고, maven의 settings.xml에 JAVA_7_HOME property를 아래와 같이 설정해주세요.
(m2e 플러그인을 사용한 maven 빌드를 하시려면 settings.xml을 수정하셔야 합니다.)
```xml
<settings>
<profiles>
<profile>
<id>JAVA_7_HOME</id>
<properties>
<JAVA_7_HOME>JDK 1.7+ 패스</JAVA_7_HOME>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>JAVA_7_HOME</activeProfile>
</activeProfiles>
</settings>
```
+1
View File
@@ -0,0 +1 @@
mvn package install -Dmaven.test.skip
+36
View File
@@ -0,0 +1,36 @@
#! /bin/bash
VERSION="1.0.2-SNAPSHOT"
OUT_JAR="pinpoint-profiler-optional-$VERSION.jar"
DEPLOY_DIR="../pinpoint-testbed/agent"
# profile
PROFILE=""
if [ "$1" != "" ] ; then
PROFILE="-P $1"
echo "*********************"
echo "USING PROFILE $1"
echo "*********************"
else
echo "*********************"
echo "USING DEFAULT PROFILE"
echo "*********************"
fi
# cleanup optional jar in deploy directory
rm $DEPLOY_DIR/$OUT_JAR
mvn clean install eclipse:eclipse package -Dmaven.test.skip $PROFILE
rc=$?
if [[ $rc != 0 ]] ; then
echo "BUILD FAILED $rc"
exit $rc
fi
# copy optional jar to deploy directory
cp ./target/$OUT_JAR $DEPLOY_DIR
rc=$?
if [[ $rc != 0 ]] ; then
echo "BUILD FAILED $rc"
exit $rc
fi
+42
View File
@@ -0,0 +1,42 @@
<project name="pinpoint_profiler_optional_build" basedir="." default="deploy">
<property environment="env"/>
<!-- 버전은 맨날 변경해야 됨 -->
<property name="pinpoint.version" value="1.0.2"/>
<property name="pinpoint.profiler.optional.jar" value="pinpoint-profiler-optional-${pinpoint.version}.jar"/>
<property name="maven.dir" value="${env.M2_HOME}"/>
<property name="agent.lib.dir" value="${basedir}/../deploy/pinpoint-agent/lib"/>
<property name="target.dir" value="${basedir}/target"/>
<target name="deploy" depends="mvn.build.install, copy.optional">
</target>
<target name="mvn.build.install">
<exec executable="${maven.dir}/bin/mvn.bat">
<arg value="-Dmaven.test.skip=true"/>
<arg value="clean"/>
<arg value="install"/>
</exec>
</target>
<target name="copy.optional">
<copy file="${target.dir}/${pinpoint.profiler.optional.jar}" todir="${agent.lib.dir}" overwrite="true">
</copy>
</target>
<target name="mvn.build.jar">
<exec executable="${maven.dir}/bin/mvn.bat">
<arg value="compile"/>
<arg value="jar:jar"/>
</exec>
</target>
<!--<target name="clean" >-->
<!--<delete dir="${class.dir}/class/*"/>-->
<!--<delete dir="${jar.dir}/jar/*"/>-->
<!--<delete dir="${javadoc.dir}/doc/*"/>-->
<!--</target>-->
</project>
+182
View File
@@ -0,0 +1,182 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.nhn.pinpoint</groupId>
<artifactId>pinpoint-profiler-optional</artifactId>
<version>1.0.2</version>
<name>pinpoint profiler optional</name>
<description>pinpoint profiler optional package</description>
<dependencies>
<dependency>
<groupId>com.nhn.pinpoint</groupId>
<artifactId>pinpoint-profiler</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>com.nhn.pinpoint</groupId>
<artifactId>pinpoint-commons</artifactId>
</exclusion>
<exclusion>
<groupId>com.nhn.pinpoint</groupId>
<artifactId>pinpoint-bootstrap</artifactId>
</exclusion>
<exclusion>
<groupId>com.nhn.pinpoint</groupId>
<artifactId>pinpoint-rpc</artifactId>
</exclusion>
<exclusion>
<groupId>com.nhn.pinpoint</groupId>
<artifactId>pinpoint-thrift</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<env>local</env>
<deploy-path>deploy</deploy-path>
<compiler-debug>true</compiler-debug>
</properties>
</profile>
<!-- Test server -->
<profile>
<id>test</id>
<properties>
<env>test</env>
<compiler-debug>true</compiler-debug>
</properties>
</profile>
<!-- Development server -->
<profile>
<id>dev</id>
<properties>
<env>dev</env>
<compiler-debug>true</compiler-debug>
</properties>
</profile>
<!-- real server -->
<profile>
<id>release</id>
<properties>
<env>release</env>
<compiler-debug>false</compiler-debug>
</properties>
</profile>
</profiles>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>${basedir}/src/test/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
<testResource>
<filtering>true</filtering>
<directory>${basedir}/src/test/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<inherited>true</inherited>
<configuration>
<source>1.7</source>
<target>1.7</target>
<debug>${compiler-debug}</debug>
<optimize>true</optimize>
<fork>true</fork>
<verbose>true</verbose>
<compilerVersion>1.7</compilerVersion>
<executable>${JAVA_7_HOME}/bin/javac</executable>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<configuration>
<tasks>
<copy file="${project.build.directory}/${project.build.finalName}.jar"
tofile="${basedir}/../pinpoint-profiler/target/pinpoint-agent/lib/${project.build.finalName}.jar">
</copy>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<jvm>${JAVA_7_HOME}/bin/java</jvm>
<forkMode>once</forkMode>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<encoding>UTF-8</encoding>
<jdk>1.7</jdk>
<generateXml>true</generateXml>
<generateHtml>true</generateHtml>
<generateHistorical>false</generateHistorical>
<licenseLocation>clover.license</licenseLocation>
<singleCloverDatabase>false</singleCloverDatabase>
<includesTestSourceRoots>false</includesTestSourceRoots>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,36 @@
package com.nhn.pinpoint.profiler.monitor.codahale.cpu.metric;
import com.codahale.metrics.Gauge;
import com.sun.management.OperatingSystemMXBean;
/**
* @author hyungil.jeong
*/
public class EnhancedCpuLoadMetricSet extends AbstractCpuLoadMetricSet {
@Override
protected Gauge<Double> getJvmCpuLoadGauge(final OperatingSystemMXBean operatingSystemMXBean) {
return new Gauge<Double>() {
@Override
public Double getValue() {
return operatingSystemMXBean.getProcessCpuLoad();
}
};
}
@Override
protected Gauge<Double> getSystemCpuLoadGauge(final OperatingSystemMXBean operatingSystemMXBean) {
return new Gauge<Double>() {
@Override
public Double getValue() {
return operatingSystemMXBean.getSystemCpuLoad();
}
};
}
@Override
public String toString() {
return "CpuLoadMetricSet for Java 1.7+";
}
}