Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
enoch
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DevOps
enoch
Commits
3cd60728
Commit
3cd60728
authored
Feb 18, 2019
by
xiaoguang.xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 修正server判定为continue
2. 增加性能检测net/http/pprof 3. 日志文件创建不擦除旧日志.
parent
10c844eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
main.go
main.go
+6
-1
msg_process.go
service/msg_process.go
+5
-5
No files found.
main.go
View file @
3cd60728
...
...
@@ -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
)
...
...
service/msg_process.go
View file @
3cd60728
...
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment