mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-17 00:36:02 +10:00
[강운덕] [LUCYSUS-1744] profiler가 배포 될 경우 자동으로 maven의 version필드를 가져 오도록 처리함.
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@2642 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -10,8 +10,9 @@ public class AgentInformation {
|
||||
private final int pid;
|
||||
private final String machineName;
|
||||
private final short serverType;
|
||||
private final String version;
|
||||
|
||||
public AgentInformation(String agentId, String applicationName, long startTime, int pid, String machineName, short serverType) {
|
||||
public AgentInformation(String agentId, String applicationName, long startTime, int pid, String machineName, short serverType, String version) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
@@ -21,12 +22,16 @@ public class AgentInformation {
|
||||
if (machineName == null) {
|
||||
throw new NullPointerException("machineName must not be null");
|
||||
}
|
||||
if (version == null) {
|
||||
throw new NullPointerException("version must not be null");
|
||||
}
|
||||
this.agentId = agentId;
|
||||
this.applicationName = applicationName;
|
||||
this.startTime = startTime;
|
||||
this.pid = pid;
|
||||
this.machineName = machineName;
|
||||
this.serverType = serverType;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +60,10 @@ public class AgentInformation {
|
||||
return serverType;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("AgentInformation{");
|
||||
@@ -64,6 +73,7 @@ public class AgentInformation {
|
||||
sb.append(", pid=").append(pid);
|
||||
sb.append(", machineName='").append(machineName).append('\'');
|
||||
sb.append(", serverType=").append(serverType);
|
||||
sb.append(", version='").append(version).append('\'');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.nhn.pinpoint.profiler;
|
||||
import com.nhn.pinpoint.ProductInfo;
|
||||
import com.nhn.pinpoint.common.PinpointConstants;
|
||||
import com.nhn.pinpoint.common.ServiceType;
|
||||
import com.nhn.pinpoint.common.Version;
|
||||
import com.nhn.pinpoint.common.util.BytesUtils;
|
||||
import com.nhn.pinpoint.exception.PinpointException;
|
||||
import com.nhn.pinpoint.profiler.context.*;
|
||||
@@ -129,7 +130,7 @@ public class DefaultAgent implements Agent {
|
||||
final String applicationName = getId("pinpoint.applicationName", "UnknownApplicationName", PinpointConstants.APPLICATION_NAME_MAX_LEN);
|
||||
final long startTime = RuntimeMXBeanUtils.getVmStartTime();
|
||||
final int pid = RuntimeMXBeanUtils.getPid();
|
||||
return new AgentInformation(agentId, applicationName, startTime, pid, machineName, serverType.getCode());
|
||||
return new AgentInformation(agentId, applicationName, startTime, pid, machineName, serverType.getCode(), Version.VERSION);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.nhn.pinpoint.profiler.context;
|
||||
|
||||
import com.nhn.pinpoint.common.ServiceType;
|
||||
import com.nhn.pinpoint.common.Version;
|
||||
import com.nhn.pinpoint.profiler.AgentInformation;
|
||||
import com.nhn.pinpoint.profiler.logging.Slf4jLoggerBinderInitializer;
|
||||
import com.nhn.pinpoint.profiler.sender.LoggingDataSender;
|
||||
@@ -29,7 +30,7 @@ public class DefaultTraceTest {
|
||||
@Test
|
||||
public void testPushPop() {
|
||||
DefaultTraceContext defaultTraceContext = new DefaultTraceContext();
|
||||
defaultTraceContext.setAgentInformation(new AgentInformation("agentId", "applicationName", System.currentTimeMillis(), 10, "test", ServiceType.TOMCAT.getCode()));
|
||||
defaultTraceContext.setAgentInformation(new AgentInformation("agentId", "applicationName", System.currentTimeMillis(), 10, "test", ServiceType.TOMCAT.getCode(), Version.VERSION));
|
||||
DefaultTrace trace = new DefaultTrace(defaultTraceContext, "agent", 0, 1);
|
||||
|
||||
trace.setStorage(new SpanStorage(LoggingDataSender.DEFAULT_LOGGING_DATA_SENDER));
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.nhn.pinpoint.profiler.context;
|
||||
|
||||
import com.nhn.pinpoint.common.AnnotationKey;
|
||||
import com.nhn.pinpoint.common.ServiceType;
|
||||
import com.nhn.pinpoint.common.Version;
|
||||
import com.nhn.pinpoint.profiler.AgentInformation;
|
||||
|
||||
import com.nhn.pinpoint.profiler.sender.EnhancedDataSender;
|
||||
@@ -56,7 +57,7 @@ public class TraceTest {
|
||||
|
||||
private DefaultTraceContext getDefaultTraceConetxt() {
|
||||
DefaultTraceContext defaultTraceContext = new DefaultTraceContext();
|
||||
defaultTraceContext.setAgentInformation(new AgentInformation("agentId", "applicationName", System.currentTimeMillis(), 10, "test", ServiceType.TOMCAT.getCode()));
|
||||
defaultTraceContext.setAgentInformation(new AgentInformation("agentId", "applicationName", System.currentTimeMillis(), 10, "test", ServiceType.TOMCAT.getCode(), Version.VERSION));
|
||||
return defaultTraceContext;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user