增加服务流量统计

This commit is contained in:
GoEdgeLab
2021-06-08 11:18:27 +08:00
parent 64daf215f6
commit ec91e06d91
7 changed files with 134 additions and 42 deletions

View File

@@ -4,6 +4,7 @@ import (
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
_ "github.com/go-sql-driver/mysql"
"github.com/iwind/TeaGo/dbs"
"github.com/iwind/TeaGo/logs"
timeutil "github.com/iwind/TeaGo/utils/time"
"testing"
)
@@ -51,3 +52,14 @@ func TestServerDailyStatDAO_SumUserMonthly(t *testing.T) {
}
t.Log("bytes:", bytes)
}
func TestServerDailyStatDAO_SumHourlyRequests(t *testing.T) {
dbs.NotifyReady()
var tx *dbs.Tx
stats, err := NewServerDailyStatDAO().SumHourlyStats(tx, 23, timeutil.Format("YmdH"))
if err != nil {
t.Fatal(err)
}
logs.PrintAsJSON(stats, t)
}