Skip to content

Commit

Permalink
数据库表修改
Browse files Browse the repository at this point in the history
  • Loading branch information
sunface committed May 17, 2019
1 parent fe25059 commit 504524b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
3 changes: 3 additions & 0 deletions quick-start/update-log.md
Expand Up @@ -8,6 +8,9 @@
- 应用列表: 应用过多时,固定列表表头
- 应用列表: 调整错误率标示
- 应用监控: 应用图表增加JVM异常率展示
- 应用地图: 优化节点红色显示:自身异常率过高或者没有节点存活时
- 应用地图: 增加应用过滤功能
- 应用地图: 错误过滤,同时过滤点节点和连接

### 0.5.7 (5.15 2019)
- 应用监控: 将所有错误率替换为访问错误率
Expand Down
29 changes: 14 additions & 15 deletions web/internal/application/req_trace.go
Expand Up @@ -63,7 +63,7 @@ func QueryTraces(c echo.Context) error {

searchError, _ := strconv.ParseBool(c.FormValue("search_error"))
searchTraceID := c.FormValue("search_trace_id")
raddr := c.FormValue("remote_addr")
// raddr := c.FormValue("remote_addr")
if err != nil {
limit = 50
}
Expand All @@ -74,7 +74,7 @@ func QueryTraces(c echo.Context) error {

var q *gocql.Query
if searchTraceID != "" {
q = misc.TraceCql.Query("SELECT app_name,trace_id,api,elapsed,agent_id,input_date,error,remote_addr FROM traces WHERE trace_id=?", searchTraceID)
q = misc.TraceCql.Query("SELECT app_name,trace_id,api,duration,agent_id,input_date,error,remote_addr FROM traces WHERE trace_id=?", searchTraceID)
iter := q.Iter()
var elapsed, isError int
var inputDate int64
Expand All @@ -94,7 +94,7 @@ func QueryTraces(c echo.Context) error {
} else {
// 根据查询条件,拼装查询语句和参数
// 默认条件1
qs := "SELECT trace_id,api,elapsed,agent_id,input_date,error,remote_addr FROM app_operation_index WHERE app_name=?"
qs := "SELECT trace_id,api,duration,agent_id,input_date,error,remote_addr FROM traces_index WHERE app_name=?"
args := []interface{}{appName}

// api条件
Expand All @@ -107,26 +107,25 @@ func QueryTraces(c echo.Context) error {
qs = qs + " and input_date > ? and input_date < ?"
args = append(args, start.Unix()*1000, end.Unix()*1000)

// // 查询指定的remote_addr
// if raddr != "" {
// qs = qs + " and remote_addr=?"
// args = append(args, raddr)
// }

needFiltering := false
if min > 0 {
qs = qs + " and elapsed >= ?"
qs = qs + " and duration >= ?"
args = append(args, min)
needFiltering = true
}
// 最大查询时间条件
if max > 0 {
qs = qs + " and elapsed <= ?"
qs = qs + " and duration <= ?"
args = append(args, max)
needFiltering = true
}

// 查询指定的remote_addr
if raddr != "" {
qs = qs + " and remote_addr=?"
args = append(args, raddr)
needFiltering = true
}

// 仅查询错误条件
if searchError {
// 只搜索错误
Expand Down Expand Up @@ -275,8 +274,8 @@ func (o traceSpans) Less(i, j int) bool {
}

func (spans *traceSpans) load(tid string) error {
q := misc.TraceCql.Query(`SELECT span_id,parent_id,app_name,agent_id,input_date,elapsed,api,service_type,
end_point,remote_addr,error,span_event_list,method_id,annotations,exception_info from traces where trace_id=?`, tid)
q := misc.TraceCql.Query(`SELECT span_id,parent_id,app_name,agent_id,input_date,duration,api,service_type,
end_point,remote_addr,error,event_list,method_id,annotations,exception_info from traces where trace_id=?`, tid)
iter := q.Iter()

var spanID, pid, inputDate int64
Expand Down Expand Up @@ -309,7 +308,7 @@ func (spans *traceSpans) load(tid string) error {
var spanEvents SpanEvents
json.Unmarshal([]byte(events), &spanEvents)
// 加载span chunk
q1 := misc.TraceCql.Query(`SELECT span_event_list from traces_chunk where trace_id=? and span_id=?`, tid, span.id)
q1 := misc.TraceCql.Query(`SELECT event_list from traces_chunk where trace_id=? and span_id=?`, tid, span.id)
iter1 := q1.Iter()
var eventsChunkS string
for iter1.Scan(&eventsChunkS) {
Expand Down

0 comments on commit 504524b

Please sign in to comment.