Skip to content

Commit 74ae4bc

Browse files
김경남김경남
authored andcommitted
add channel
1 parent e2b64b3 commit 74ae4bc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

agent/instance/instance.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type Instance struct {
1515
User string `json:"db.user"`
1616
Password string `json:"db.password"`
1717
Slowquery string `json:"db.slowquery"`
18+
1819
}
1920

2021
func (inst *Instance) StartMonitor() {
@@ -35,6 +36,9 @@ func (inst *Instance) StartMonitor() {
3536
}
3637

3738
func (inst *Instance) run() {
39+
var wg sync.WaitGroup
40+
wg.Add(1)
41+
ch := make(chan int)
3842
dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s", inst.User, inst.Password, inst.IP, inst.Port, "mysql")
3943
db, err := sql.Open("mysql", dsn) //// Open doesn't open a connection. Validate DSN data
4044
if err != nil {
@@ -49,12 +53,16 @@ func (inst *Instance) run() {
4953

5054
var statusName string
5155
var statusValue int64
56+
57+
statusMap := make(map[string] int64)
5258
for resultRow.Next() {
59+
5360
// get RawBytes from data
5461
err = resultRow.Scan(&statusName, &statusValue)
5562
if err != nil {
5663
panic(err.Error()) // proper error handling instead of panic in your app
5764
}
65+
map[statusName]= statusValue
5866

5967
}
6068
}

0 commit comments

Comments
 (0)