Commit 3cd60728 authored by xiaoguang.xu's avatar xiaoguang.xu

1. 修正server判定为continue

2. 增加性能检测net/http/pprof
3. 日志文件创建不擦除旧日志.
parent 10c844eb
......@@ -7,6 +7,7 @@ import (
"git.quantgroup.cn/DevOps/enoch/service/job"
"log"
"net/http"
_ "net/http/pprof"
"os"
)
......@@ -18,7 +19,7 @@ func main() {
flag.BoolVar(&quartz, "quartz", false, "quartz")
flag.Parse()
file, err := os.Create("quantgroup.log")
file, err := os.OpenFile("quantgroup.log", os.O_RDWR|os.O_CREATE, 0666)
defer func() { _ = file.Close() }()
if err != nil {
log.Fatalln("create file error", err)
......@@ -39,6 +40,10 @@ func main() {
job.AutoEmailPerformInfo()
}
go func() {
http.ListenAndServe("0.0.0.0:8899", nil)
}()
http.HandleFunc("/duration", service.DurationInterface)
http.HandleFunc("/counter", service.CounterInterface)
......
......@@ -16,6 +16,7 @@ var httpMethod = map[string]string{
}
func MsgProcess(msg string) {
traceMsg := make([]TraceMsg, 3) //[]TraceMsg{}
err := json.Unmarshal([]byte(msg), &traceMsg)
if err != nil {
......@@ -32,8 +33,9 @@ var pointSlice = make([]*client.Point, 0, batchSize)
func msgInfluxProcess(traceMsgs []TraceMsg) {
for _, traceMsg := range traceMsgs {
if traceMsg.Kind != "SERVER" {
break
continue
}
path := traceMsg.Name
......@@ -52,12 +54,11 @@ func msgInfluxProcess(traceMsgs []TraceMsg) {
fields["msg"] = msg
tags := make(map[string]string, )
tags := make(map[string]string)
tags["sys_name"] = sysName
tags["path"] = path
tags["host"] = traceMsg.LocalEndpoint.Ipv4
if err != nil {
log.Fatal(err)
}
......@@ -93,11 +94,10 @@ func batchWrite(pointArray []*client.Point) {
points.AddPoints(pointArray)
err = c.Write(points)
fmt.Println("写入数据",len(pointArray))
fmt.Println("写入数据", len(pointArray))
if err != nil {
log.Fatal(err)
}
}
func msgRedisProcess(traceMsg []TraceMsg) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment