From ef59f0a1c36451dbee51110149fe0cc8a0b6655e Mon Sep 17 00:00:00 2001 From: Woonduk Kang Date: Mon, 28 Oct 2013 10:28:56 +0000 Subject: [PATCH] =?UTF-8?q?[=EA=B0=95=EC=9A=B4=EB=8D=95]=20[LUCYSUS-1744]?= =?UTF-8?q?=20profiler=EA=B0=80=20=EB=B0=B0=ED=8F=AC=20=EB=90=A0=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=20=EC=9E=90=EB=8F=99=EC=9C=BC=EB=A1=9C=20mav?= =?UTF-8?q?en=EC=9D=98=20version=ED=95=84=EB=93=9C=EB=A5=BC=20=EA=B0=80?= =?UTF-8?q?=EC=A0=B8=20=EC=98=A4=EB=8F=84=EB=A1=9D=20=EC=B2=98=EB=A6=AC?= =?UTF-8?q?=ED=95=A8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@2642 84d0f5b1-2673-498c-a247-62c4ff18d310 --- .../com/nhn/pinpoint/profiler/AgentInformation.java | 12 +++++++++++- .../java/com/nhn/pinpoint/profiler/DefaultAgent.java | 3 ++- .../pinpoint/profiler/context/DefaultTraceTest.java | 3 ++- .../com/nhn/pinpoint/profiler/context/TraceTest.java | 3 ++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/nhn/pinpoint/profiler/AgentInformation.java b/src/main/java/com/nhn/pinpoint/profiler/AgentInformation.java index b37140a6c..5890812b2 100644 --- a/src/main/java/com/nhn/pinpoint/profiler/AgentInformation.java +++ b/src/main/java/com/nhn/pinpoint/profiler/AgentInformation.java @@ -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(); } diff --git a/src/main/java/com/nhn/pinpoint/profiler/DefaultAgent.java b/src/main/java/com/nhn/pinpoint/profiler/DefaultAgent.java index 522a8d39e..74663d6ef 100644 --- a/src/main/java/com/nhn/pinpoint/profiler/DefaultAgent.java +++ b/src/main/java/com/nhn/pinpoint/profiler/DefaultAgent.java @@ -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); } diff --git a/src/test/java/com/nhn/pinpoint/profiler/context/DefaultTraceTest.java b/src/test/java/com/nhn/pinpoint/profiler/context/DefaultTraceTest.java index 256884e62..28a0de52a 100644 --- a/src/test/java/com/nhn/pinpoint/profiler/context/DefaultTraceTest.java +++ b/src/test/java/com/nhn/pinpoint/profiler/context/DefaultTraceTest.java @@ -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)); diff --git a/src/test/java/com/nhn/pinpoint/profiler/context/TraceTest.java b/src/test/java/com/nhn/pinpoint/profiler/context/TraceTest.java index 843892687..9f3b67b66 100644 --- a/src/test/java/com/nhn/pinpoint/profiler/context/TraceTest.java +++ b/src/test/java/com/nhn/pinpoint/profiler/context/TraceTest.java @@ -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; }