This commit is contained in:
zhangxin10 2015-12-18 21:52:17 +08:00
commit 26d39e12b1
5 changed files with 61 additions and 9 deletions

View File

@ -3,11 +3,30 @@ package com.ai.cloud.skywalking.util;
import java.util.UUID;
public final class TraceIdGenerator {
private static final ThreadLocal<Integer> ThreadTraceIdSequence = new ThreadLocal<Integer>();
private static final String PROCESS_UUID;
static{
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
PROCESS_UUID = uuid.substring(uuid.length() - 7);
}
private TraceIdGenerator() {
// Non
}
public static String generate() {
return UUID.randomUUID().toString().replaceAll("-", "");
public static String generate(){
Integer seq = ThreadTraceIdSequence.get();
if(seq == null || seq == 10000 || seq > 10000){
seq = 0;
}
seq++;
ThreadTraceIdSequence.set(seq);
return System.currentTimeMillis()
+ "." + PROCESS_UUID
+ "." + BuriedPointMachineUtil.getProcessNo()
+ "." + Thread.currentThread().getId()
+ "." + seq;
}
}

View File

@ -41,7 +41,7 @@ public class BaseFreeMarkerView extends FreeMarkerView {
}
String uid = (String) session.getAttribute("uid");
if(StringUtil.isBlank(uid)){
uid = "0";
uid = "-1";
}
String userName = (String) session.getAttribute("userName");
if(StringUtil.isBlank(userName)){

View File

@ -111,7 +111,7 @@
<td>${logInfo.spanTypeName!'UNKNOWN'}</td>
<td>${logInfo.statusCodeName!'MISSING'}</td>
<td>
<a href="#" data-toggle="tooltip" data-placement="bottom"
<a href="#" name="detailInfo" data-toggle="tooltip" data-placement="bottom"
title="${logInfo.viewPointId!}">${logInfo.viewPointIdSub!}</a>
</td>
<td>${logInfo.address!}</td>
@ -250,6 +250,8 @@
<div id="collapse${logInfo_index}" class="accordion-body collapse"
style="height: 0px; ">
<ul class="list-group">
<li class="list-group-item" style="word-wrap:break-word">
<strong>服务/方法:</strong>${logInfo.viewPointId!''}</li>
<li class="list-group-item">
<strong>调用类型:</strong>${logInfo.spanTypeName!'UNKNOWN'}</li>
<li class="list-group-item">
@ -280,4 +282,25 @@
</table>
</div>
</div>
</#macro>
</#macro>
<#macro detailTraceLog>
<div class="modal fade bs-example-modal-lg" id="detailLog" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" style="display: none;">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myLargeModalLabel">日志详细信息</h4>
</div>
<div class="modal-body">
<!-- form content -->
<form class="form-horizontal" id="detailContent">
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
</#macro>

View File

@ -12,10 +12,13 @@
</head>
<body>
<!-- show detailTraceLog -->
<@common.detailTraceLog />
<!-- show traceLogInfo -->
<@common.dealTraceLog />
<!-- show traceLogInfo -->
<!-- show originLog -->
<@common.importOriginLog />
<!-- script references -->
@ -54,6 +57,13 @@
}
});
$("a[name='detailInfo']").each(function(index,ele){
$(this).bind("click",function(){
$("#detailContent").html($("#collapse"+index).html());
$("#detailLog").modal('show');
});
});
$('#example-advanced').treetable('expandAll');
});
</script>

View File

@ -22,7 +22,7 @@ $().ready(function() {
changeFrameUrl(baseUrl + "/showTraceLog/" + srchKey);
}
} else {
if(uid>0){
if(uid>=0){
changeFrameUrl(baseUrl + "/applist");
}
$("#srchKey").val("");