mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-23 09:00:20 +08:00
chore: only upload metrics on mysql (#4591)
This commit is contained in:
parent
1023800b02
commit
520d2a2075
@ -27,19 +27,21 @@ func getCachedSqlConn(driverName, server string) (*sql.DB, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg, e := mysql.ParseDSN(server); e != nil {
|
if driverName != mysqlDriverName {
|
||||||
// if cannot parse, don't collect the metrics
|
if cfg, e := mysql.ParseDSN(server); e != nil {
|
||||||
logx.Error(e)
|
// if cannot parse, don't collect the metrics
|
||||||
} else {
|
logx.Error(e)
|
||||||
checksum := sha256.Sum256([]byte(server))
|
} else {
|
||||||
connCollector.registerClient(&statGetter{
|
checksum := sha256.Sum256([]byte(server))
|
||||||
host: cfg.Addr,
|
connCollector.registerClient(&statGetter{
|
||||||
dbName: cfg.DBName,
|
host: cfg.Addr,
|
||||||
hash: hex.EncodeToString(checksum[:]),
|
dbName: cfg.DBName,
|
||||||
poolStats: func() sql.DBStats {
|
hash: hex.EncodeToString(checksum[:]),
|
||||||
return conn.Stats()
|
poolStats: func() sql.DBStats {
|
||||||
},
|
return conn.Stats()
|
||||||
})
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return conn, nil
|
return conn, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user