collect target total number
This commit is contained in:
parent
b4ddd03691
commit
388228a631
|
@ -116,6 +116,10 @@ func buildTargetWhere(bgid int64, clusters []string, query string) *gorm.DB {
|
|||
return session
|
||||
}
|
||||
|
||||
func TargetTotalCount() (int64, error) {
|
||||
return Count(DB().Model(new(Target)))
|
||||
}
|
||||
|
||||
func TargetTotal(bgid int64, clusters []string, query string) (int64, error) {
|
||||
return Count(buildTargetWhere(bgid, clusters, query))
|
||||
}
|
||||
|
|
|
@ -59,14 +59,18 @@ func Report() {
|
|||
}
|
||||
|
||||
func report() {
|
||||
sps, _ := getSamples()
|
||||
// sps, _ := getSamples()
|
||||
tnum, err := models.TargetTotalCount()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
hostname, err := os.Hostname()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
num, err := models.UserTotal("")
|
||||
unum, err := models.UserTotal("")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -74,8 +78,8 @@ func report() {
|
|||
maintainer := "blank"
|
||||
|
||||
u := Usage{
|
||||
Samples: sps,
|
||||
Users: float64(num),
|
||||
Samples: float64(tnum),
|
||||
Users: float64(unum),
|
||||
Hostname: hostname,
|
||||
Maintainer: maintainer,
|
||||
Version: version.VERSION,
|
||||
|
|
Loading…
Reference in New Issue