mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-16 08:16:15 +10:00
[강운덕] [LUCYSUS-1744] 우선순위가 높은 메시지의 경우 별도 queue를 가진 datasender를 사용하도록 수정.
- 우선순위가 높은 메시지: metadata류, agent info. git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@1174 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -30,6 +30,8 @@ public class Agent {
|
||||
private final SystemMonitor systemMonitor;
|
||||
|
||||
private TraceContext traceContext;
|
||||
|
||||
private DataSender priorityDataSender;
|
||||
private DataSender dataSender;
|
||||
|
||||
private final String agentId;
|
||||
@@ -54,6 +56,7 @@ public class Agent {
|
||||
this.nodeName = getId("hippo.nodeName", machineName);
|
||||
this.applicationName = getId("hippo.applicationName", "UnknownApplicationName");
|
||||
|
||||
this.priorityDataSender = createDataSender();
|
||||
this.dataSender = createDataSender();
|
||||
this.startTime = System.currentTimeMillis();
|
||||
this.identifier = (short) IDENTIFIER_KEY.nextInt(16);
|
||||
@@ -76,6 +79,7 @@ public class Agent {
|
||||
|
||||
this.traceContext.setAgentId(this.agentId);
|
||||
this.traceContext.setApplicationId(this.applicationName);
|
||||
this.traceContext.setPriorityDataSender(this.priorityDataSender);
|
||||
|
||||
if (profilerConfig.isSamplingElapsedTimeBaseEnable()) {
|
||||
TimeBaseStorageFactory timeBaseStorageFactory = new TimeBaseStorageFactory(this.dataSender, this.profilerConfig);
|
||||
@@ -180,9 +184,9 @@ public class Agent {
|
||||
|
||||
private void send3(AgentInfo agentInfo) {
|
||||
// 특정 collector가 죽더라도 나머지 collector가 받을수 있도록 일부러 중복해서 3번 보낸다.
|
||||
this.dataSender.send(agentInfo);
|
||||
this.dataSender.send(agentInfo);
|
||||
this.dataSender.send(agentInfo);
|
||||
this.priorityDataSender.send(agentInfo);
|
||||
this.priorityDataSender.send(agentInfo);
|
||||
this.priorityDataSender.send(agentInfo);
|
||||
}
|
||||
|
||||
public void start() {
|
||||
@@ -214,6 +218,8 @@ public class Agent {
|
||||
send3(agentInfo);
|
||||
// 종료 처리 필요.
|
||||
this.dataSender.stop();
|
||||
this.priorityDataSender.stop();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ public class TraceContext {
|
||||
|
||||
private String applicationId;
|
||||
|
||||
private DataSender priorityDataSender;
|
||||
|
||||
private StorageFactory storageFactory;
|
||||
|
||||
private LRUCache<String> sqlCache = new LRUCache<String>(1000);
|
||||
@@ -124,8 +126,8 @@ public class TraceContext {
|
||||
apiMetadata.setApiId(result.getId());
|
||||
apiMetadata.setApiInfo(methodDescriptor.getApiDescriptor());
|
||||
apiMetadata.setLine(methodDescriptor.getLineNumber());
|
||||
DataSender dataSender = storageFactory.getDataSender();
|
||||
dataSender.send(apiMetadata);
|
||||
|
||||
this.priorityDataSender.send(apiMetadata);
|
||||
methodDescriptor.setApiId(result.getId());
|
||||
}
|
||||
return result.getId();
|
||||
@@ -156,10 +158,14 @@ public class TraceContext {
|
||||
sqlMetaData.setStartTime(Agent.getInstance().getStartTime());
|
||||
sqlMetaData.setHashCode(normalizedSql.hashCode());
|
||||
sqlMetaData.setSql(normalizedSql);
|
||||
// 다른 우선순위가 더 높은 sender가 존재하면 좋을듯 하다.
|
||||
this.storageFactory.getDataSender().send(sqlMetaData);
|
||||
|
||||
this.priorityDataSender.send(sqlMetaData);
|
||||
}
|
||||
// hashId그냥 return String에서 까보면 됨.
|
||||
return parsingResult;
|
||||
}
|
||||
|
||||
public void setPriorityDataSender(DataSender priorityDataSender) {
|
||||
this.priorityDataSender = priorityDataSender;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user