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
4c8a82af
Commit
4c8a82af
authored
Mar 04, 2019
by
Node- 门 忠鑫
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into agent
parents
a630c16e
3cd60728
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 @
4c8a82af
...
@@ -7,6 +7,7 @@ import (
...
@@ -7,6 +7,7 @@ import (
"git.quantgroup.cn/DevOps/enoch/service/job"
"git.quantgroup.cn/DevOps/enoch/service/job"
"log"
"log"
"net/http"
"net/http"
_
"net/http/pprof"
"os"
"os"
)
)
...
@@ -18,7 +19,7 @@ func main() {
...
@@ -18,7 +19,7 @@ func main() {
flag
.
BoolVar
(
&
quartz
,
"quartz"
,
false
,
"quartz"
)
flag
.
BoolVar
(
&
quartz
,
"quartz"
,
false
,
"quartz"
)
flag
.
Parse
()
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
()
}()
defer
func
()
{
_
=
file
.
Close
()
}()
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatalln
(
"create file error"
,
err
)
log
.
Fatalln
(
"create file error"
,
err
)
...
@@ -40,6 +41,10 @@ func main() {
...
@@ -40,6 +41,10 @@ func main() {
job
.
AutoEmailPerformInfo
()
job
.
AutoEmailPerformInfo
()
}
}
go
func
()
{
http
.
ListenAndServe
(
"0.0.0.0:8899"
,
nil
)
}()
http
.
HandleFunc
(
"/duration"
,
service
.
DurationInterface
)
http
.
HandleFunc
(
"/duration"
,
service
.
DurationInterface
)
http
.
HandleFunc
(
"/counter"
,
service
.
CounterInterface
)
http
.
HandleFunc
(
"/counter"
,
service
.
CounterInterface
)
...
...
service/msg_process.go
View file @
4c8a82af
...
@@ -16,6 +16,7 @@ var httpMethod = map[string]string{
...
@@ -16,6 +16,7 @@ var httpMethod = map[string]string{
}
}
func
MsgProcess
(
msg
string
)
{
func
MsgProcess
(
msg
string
)
{
traceMsg
:=
make
([]
TraceMsg
,
3
)
//[]TraceMsg{}
traceMsg
:=
make
([]
TraceMsg
,
3
)
//[]TraceMsg{}
err
:=
json
.
Unmarshal
([]
byte
(
msg
),
&
traceMsg
)
err
:=
json
.
Unmarshal
([]
byte
(
msg
),
&
traceMsg
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -32,8 +33,9 @@ var pointSlice = make([]*client.Point, 0, batchSize)
...
@@ -32,8 +33,9 @@ var pointSlice = make([]*client.Point, 0, batchSize)
func
msgInfluxProcess
(
traceMsgs
[]
TraceMsg
)
{
func
msgInfluxProcess
(
traceMsgs
[]
TraceMsg
)
{
for
_
,
traceMsg
:=
range
traceMsgs
{
for
_
,
traceMsg
:=
range
traceMsgs
{
if
traceMsg
.
Kind
!=
"SERVER"
{
if
traceMsg
.
Kind
!=
"SERVER"
{
break
continue
}
}
path
:=
traceMsg
.
Name
path
:=
traceMsg
.
Name
...
@@ -52,12 +54,11 @@ func msgInfluxProcess(traceMsgs []TraceMsg) {
...
@@ -52,12 +54,11 @@ func msgInfluxProcess(traceMsgs []TraceMsg) {
fields
[
"msg"
]
=
msg
fields
[
"msg"
]
=
msg
tags
:=
make
(
map
[
string
]
string
,
)
tags
:=
make
(
map
[
string
]
string
)
tags
[
"sys_name"
]
=
sysName
tags
[
"sys_name"
]
=
sysName
tags
[
"path"
]
=
path
tags
[
"path"
]
=
path
tags
[
"host"
]
=
traceMsg
.
LocalEndpoint
.
Ipv4
tags
[
"host"
]
=
traceMsg
.
LocalEndpoint
.
Ipv4
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
err
)
log
.
Fatal
(
err
)
}
}
...
@@ -93,11 +94,10 @@ func batchWrite(pointArray []*client.Point) {
...
@@ -93,11 +94,10 @@ func batchWrite(pointArray []*client.Point) {
points
.
AddPoints
(
pointArray
)
points
.
AddPoints
(
pointArray
)
err
=
c
.
Write
(
points
)
err
=
c
.
Write
(
points
)
fmt
.
Println
(
"写入数据"
,
len
(
pointArray
))
fmt
.
Println
(
"写入数据"
,
len
(
pointArray
))
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
err
)
log
.
Fatal
(
err
)
}
}
}
}
func
msgRedisProcess
(
traceMsg
[]
TraceMsg
)
{
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