Create & Init Project...
This commit is contained in:
2
library/rate/limit/bench/stress/CHANGELOG.md
Normal file
2
library/rate/limit/bench/stress/CHANGELOG.md
Normal file
@ -0,0 +1,2 @@
|
||||
# v1.0.0
|
||||
1.
|
6
library/rate/limit/bench/stress/CONTRIBUTORS.md
Normal file
6
library/rate/limit/bench/stress/CONTRIBUTORS.md
Normal file
@ -0,0 +1,6 @@
|
||||
# Owner
|
||||
lintanghui
|
||||
|
||||
# Author
|
||||
lintanghui
|
||||
# Reviewer
|
6
library/rate/limit/bench/stress/OWNERS
Normal file
6
library/rate/limit/bench/stress/OWNERS
Normal file
@ -0,0 +1,6 @@
|
||||
# See the OWNERS docs at https://go.k8s.io/owners
|
||||
|
||||
approvers:
|
||||
- lintanghui
|
||||
reviewers:
|
||||
- lintanghui
|
14
library/rate/limit/bench/stress/README.md
Normal file
14
library/rate/limit/bench/stress/README.md
Normal file
@ -0,0 +1,14 @@
|
||||
# stress
|
||||
|
||||
# 项目简介
|
||||
1.框架压测专用
|
||||
|
||||
# 编译环境
|
||||
|
||||
|
||||
# 依赖包
|
||||
|
||||
|
||||
# 编译执行
|
||||
|
||||
|
42
library/rate/limit/bench/stress/cmd/BUILD
Normal file
42
library/rate/limit/bench/stress/cmd/BUILD
Normal file
@ -0,0 +1,42 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_binary",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name = "cmd",
|
||||
embed = [":go_default_library"],
|
||||
tags = ["automanaged"],
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["main.go"],
|
||||
data = ["stress-test.toml"],
|
||||
importpath = "go-common/library/rate/limit/bench/stress/cmd",
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//library/log:go_default_library",
|
||||
"//library/net/trace:go_default_library",
|
||||
"//library/rate/limit/bench/stress/conf:go_default_library",
|
||||
"//library/rate/limit/bench/stress/http:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
60
library/rate/limit/bench/stress/cmd/main.go
Normal file
60
library/rate/limit/bench/stress/cmd/main.go
Normal file
@ -0,0 +1,60 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"go-common/library/log"
|
||||
"go-common/library/net/trace"
|
||||
"go-common/library/rate/limit/bench/stress/conf"
|
||||
"go-common/library/rate/limit/bench/stress/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if err := conf.Init(); err != nil {
|
||||
log.Error("conf.Init() error(%v)", err)
|
||||
panic(err)
|
||||
}
|
||||
// init log
|
||||
log.Init(conf.Conf.Log)
|
||||
defer log.Close()
|
||||
log.Info("stress start")
|
||||
// init trace
|
||||
trace.Init(conf.Conf.Tracer)
|
||||
defer trace.Close()
|
||||
// ecode init
|
||||
// ecode.Init(conf.Conf.Ecode)
|
||||
// service init
|
||||
http.Init(conf.Conf)
|
||||
// init pprof conf.Conf.Perf
|
||||
go func() {
|
||||
// init signal
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
|
||||
for {
|
||||
s := <-c
|
||||
fmt.Println("go sig!!!!!!!!")
|
||||
|
||||
log.Info("stress get a signal %s", s.String())
|
||||
switch s {
|
||||
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
|
||||
log.Info("stress exit")
|
||||
os.Exit(0)
|
||||
return
|
||||
case syscall.SIGHUP:
|
||||
os.Exit(0)
|
||||
|
||||
default:
|
||||
os.Exit(0)
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
ch := make(chan struct{})
|
||||
<-ch
|
||||
}
|
121
library/rate/limit/bench/stress/cmd/stress-test.toml
Normal file
121
library/rate/limit/bench/stress/cmd/stress-test.toml
Normal file
@ -0,0 +1,121 @@
|
||||
# This is a TOML document. Boom
|
||||
|
||||
version = "1.0.0"
|
||||
user = "nobody"
|
||||
pid = "/tmp/stress.pid"
|
||||
dir = "./"
|
||||
perf = "0.0.0.0:6420"
|
||||
trace = false
|
||||
debug = false
|
||||
|
||||
|
||||
[log]
|
||||
vLevel = 1
|
||||
|
||||
[tracer]
|
||||
proto = "udp"
|
||||
addr = "172.16.33.46:5140"
|
||||
tag = "mypro"
|
||||
|
||||
[bm]
|
||||
[bm.inner]
|
||||
addr = "0.0.0.0:9001"
|
||||
timeout = "1s"
|
||||
[bm.local]
|
||||
addr = "0.0.0.0:9002"
|
||||
timeout = "1s"
|
||||
|
||||
[identify]
|
||||
whiteAccessKey = ""
|
||||
whiteMid = 0
|
||||
[identify.app]
|
||||
key = "6a29f8ed87407c11"
|
||||
secret = "d3c5a85f5b895a03735b5d20a273bc57"
|
||||
[identify.memcache]
|
||||
name = "go-business/identify"
|
||||
proto = "tcp"
|
||||
addr = "172.16.33.54:11211"
|
||||
active = 5
|
||||
idle = 10
|
||||
dialTimeout = "1s"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "80s"
|
||||
[identify.host]
|
||||
auth = "http://passport.bilibili.com"
|
||||
secret = "http://open.bilibili.com"
|
||||
[identify.httpClient]
|
||||
key = "f022126a8a365e20"
|
||||
secret = "b7b86838145d634b487e67b811b8fab2"
|
||||
dial = "30ms"
|
||||
timeout = "100ms"
|
||||
keepAlive = "60s"
|
||||
[identify.httpClient.breaker]
|
||||
window = "10s"
|
||||
sleep = "100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
[identify.httpClient.url]
|
||||
"http://passport.bilibili.co/intranet/auth/tokenInfo" = {timeout = "100ms"}
|
||||
"http://passport.bilibili.co/intranet/auth/cookieInfo" = {timeout = "100ms"}
|
||||
"http://open.bilibili.co/api/getsecret" = {timeout = "500ms"}
|
||||
|
||||
[ecode]
|
||||
domain = "uat-api.bilibili.co"
|
||||
all = "1h"
|
||||
diff = "5m"
|
||||
[ecode.clientconfig]
|
||||
key = "c1a1cb2d89c33794"
|
||||
secret = "dda47eeca111e03e6845017505baea13"
|
||||
dial = "2000ms"
|
||||
timeout = "2s"
|
||||
keepAlive = "10s"
|
||||
timer = 128
|
||||
[ecode.clientconfig.breaker]
|
||||
window ="3s"
|
||||
sleep ="100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
|
||||
[mysql]
|
||||
addr = "127.0.0.1:3306"
|
||||
dsn = "test:test@tcp(127.0.0.1:3306)/test?timeout=200ms&readTimeout=200ms&writeTimeout=200ms&parseTime=true&loc=Local&charset=utf8,utf8mb4"
|
||||
readDSN = ["test:test@tcp(127.0.0.2:3306)/test? timeout=200ms&readTimeout=200ms&writeTimeout=200ms&parseTime=true&loc=Local&charset=utf8,utf8mb4","test:test@tcp(127.0.0.3:3306)/test?timeout=200ms&readTimeout=200ms&writeTimeout=200ms&parseTime=true&loc=Local&charset=utf8,utf8mb4"]
|
||||
active = 20
|
||||
idle = 10
|
||||
idleTimeout ="4h"
|
||||
queryTimeout = "100ms"
|
||||
execTimeout = "100ms"
|
||||
tranTimeout = "200ms"
|
||||
[mysql.breaker]
|
||||
window = "3s"
|
||||
sleep = "100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
[redis]
|
||||
name = "stress"
|
||||
proto = "tcp"
|
||||
addr = ""
|
||||
idle = 10
|
||||
active = 10
|
||||
dialTimeout = "1s"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "10s"
|
||||
expire = "1m"
|
||||
|
||||
[memcache]
|
||||
name = "stress"
|
||||
proto = "tcp"
|
||||
addr = ""
|
||||
idle = 5
|
||||
active = 10
|
||||
dialTimeout = "1s"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "10s"
|
||||
expire = "24h"
|
||||
|
38
library/rate/limit/bench/stress/conf/BUILD
Normal file
38
library/rate/limit/bench/stress/conf/BUILD
Normal file
@ -0,0 +1,38 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["conf.go"],
|
||||
importpath = "go-common/library/rate/limit/bench/stress/conf",
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//library/cache/memcache:go_default_library",
|
||||
"//library/cache/redis:go_default_library",
|
||||
"//library/database/sql:go_default_library",
|
||||
"//library/ecode/tip:go_default_library",
|
||||
"//library/log:go_default_library",
|
||||
"//library/net/http/blademaster:go_default_library",
|
||||
"//library/net/trace:go_default_library",
|
||||
"//vendor/github.com/BurntSushi/toml:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
91
library/rate/limit/bench/stress/conf/conf.go
Normal file
91
library/rate/limit/bench/stress/conf/conf.go
Normal file
@ -0,0 +1,91 @@
|
||||
package conf
|
||||
|
||||
import (
|
||||
"flag"
|
||||
|
||||
"go-common/library/cache/memcache"
|
||||
"go-common/library/cache/redis"
|
||||
"go-common/library/database/sql"
|
||||
ecode "go-common/library/ecode/tip"
|
||||
"go-common/library/log"
|
||||
bm "go-common/library/net/http/blademaster"
|
||||
"go-common/library/net/trace"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
)
|
||||
|
||||
// global var
|
||||
var (
|
||||
confPath string
|
||||
// Conf config
|
||||
Conf = &Config{}
|
||||
)
|
||||
|
||||
// Config config set
|
||||
type Config struct {
|
||||
// elk
|
||||
Log *log.Config
|
||||
// http
|
||||
BM *HTTPServers
|
||||
// tracer
|
||||
Tracer *trace.Config
|
||||
// redis
|
||||
Redis *redis.Config
|
||||
// memcache
|
||||
Memcache *memcache.Config
|
||||
// MySQL
|
||||
MySQL *sql.Config
|
||||
// ecode
|
||||
Ecode *ecode.Config
|
||||
}
|
||||
|
||||
// HTTPServers Http Servers
|
||||
type HTTPServers struct {
|
||||
Outer *bm.ServerConfig
|
||||
Inner *bm.ServerConfig
|
||||
Local *bm.ServerConfig
|
||||
}
|
||||
|
||||
func init() {
|
||||
flag.StringVar(&confPath, "conf", "./stress-test.toml", "default config path")
|
||||
}
|
||||
|
||||
// Init init conf
|
||||
func Init() error {
|
||||
if confPath != "" {
|
||||
return local()
|
||||
}
|
||||
s := `# This is a TOML document. Boom
|
||||
|
||||
version = "1.0.0"
|
||||
user = "nobody"
|
||||
pid = "/tmp/stress.pid"
|
||||
dir = "./"
|
||||
perf = "0.0.0.0:6420"
|
||||
trace = false
|
||||
debug = false
|
||||
|
||||
|
||||
[log]
|
||||
#dir = "/data/log/stress"
|
||||
#[log.agent]
|
||||
# taskID = "000161"
|
||||
# proto = "unixgram"
|
||||
# addr = "/var/run/lancer/collector.sock"
|
||||
# chan = 10240
|
||||
|
||||
[bm]
|
||||
[bm.inner]
|
||||
addr = "0.0.0.0:9001"
|
||||
timeout = "1s"
|
||||
[bm.local]
|
||||
addr = "0.0.0.0:9002"
|
||||
timeout = "1s"`
|
||||
_, err := toml.Decode(s, &Conf)
|
||||
return err
|
||||
}
|
||||
|
||||
func local() (err error) {
|
||||
_, err = toml.DecodeFile(confPath, &Conf)
|
||||
return
|
||||
}
|
34
library/rate/limit/bench/stress/dao/BUILD
Normal file
34
library/rate/limit/bench/stress/dao/BUILD
Normal file
@ -0,0 +1,34 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["dao.go"],
|
||||
importpath = "go-common/library/rate/limit/bench/stress/dao",
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//library/cache/memcache:go_default_library",
|
||||
"//library/cache/redis:go_default_library",
|
||||
"//library/database/sql:go_default_library",
|
||||
"//library/rate/limit/bench/stress/conf:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
48
library/rate/limit/bench/stress/dao/dao.go
Normal file
48
library/rate/limit/bench/stress/dao/dao.go
Normal file
@ -0,0 +1,48 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go-common/library/cache/memcache"
|
||||
"go-common/library/cache/redis"
|
||||
xsql "go-common/library/database/sql"
|
||||
"go-common/library/rate/limit/bench/stress/conf"
|
||||
)
|
||||
|
||||
// Dao dao
|
||||
type Dao struct {
|
||||
c *conf.Config
|
||||
mc *memcache.Pool
|
||||
redis *redis.Pool
|
||||
db *xsql.DB
|
||||
}
|
||||
|
||||
// New init mysql db
|
||||
func New(c *conf.Config) (dao *Dao) {
|
||||
dao = &Dao{
|
||||
c: c,
|
||||
mc: memcache.NewPool(c.Memcache),
|
||||
redis: redis.NewPool(c.Redis),
|
||||
db: xsql.NewMySQL(c.MySQL),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Close close the resource.
|
||||
func (d *Dao) Close() {
|
||||
d.mc.Close()
|
||||
d.redis.Close()
|
||||
d.db.Close()
|
||||
}
|
||||
|
||||
// Ping dao ping
|
||||
func (d *Dao) Ping(c context.Context) error {
|
||||
return d.pingMC(c)
|
||||
}
|
||||
|
||||
// pingMc ping
|
||||
func (d *Dao) pingMC(c context.Context) (err error) {
|
||||
conn := d.mc.Get(c)
|
||||
defer conn.Close()
|
||||
return
|
||||
}
|
37
library/rate/limit/bench/stress/http/BUILD
Normal file
37
library/rate/limit/bench/stress/http/BUILD
Normal file
@ -0,0 +1,37 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["http.go"],
|
||||
importpath = "go-common/library/rate/limit/bench/stress/http",
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//library/log:go_default_library",
|
||||
"//library/net/http/blademaster:go_default_library",
|
||||
"//library/rate:go_default_library",
|
||||
"//library/rate/limit:go_default_library",
|
||||
"//library/rate/limit/bench/stress/conf:go_default_library",
|
||||
"//library/rate/limit/bench/stress/service:go_default_library",
|
||||
"//library/rate/vegas:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
130
library/rate/limit/bench/stress/http/http.go
Normal file
130
library/rate/limit/bench/stress/http/http.go
Normal file
@ -0,0 +1,130 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"hash/crc32"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"go-common/library/log"
|
||||
bm "go-common/library/net/http/blademaster"
|
||||
"go-common/library/rate"
|
||||
"go-common/library/rate/limit"
|
||||
"go-common/library/rate/limit/bench/stress/conf"
|
||||
"go-common/library/rate/limit/bench/stress/service"
|
||||
"go-common/library/rate/vegas"
|
||||
)
|
||||
|
||||
var (
|
||||
svc *service.Service
|
||||
req int64
|
||||
qps int64
|
||||
)
|
||||
|
||||
// Init init
|
||||
func Init(c *conf.Config) {
|
||||
rand.Seed(time.Now().Unix())
|
||||
initService(c)
|
||||
// init router
|
||||
engineInner := bm.DefaultServer(c.BM.Inner)
|
||||
outerRouter(engineInner)
|
||||
if err := engineInner.Start(); err != nil {
|
||||
log.Error("xhttp.Serve error(%v)", err)
|
||||
panic(err)
|
||||
}
|
||||
engineLocal := bm.DefaultServer(c.BM.Local)
|
||||
localRouter(engineLocal)
|
||||
if err := engineLocal.Start(); err != nil {
|
||||
log.Error("xhttp.Serve error(%v)", err)
|
||||
panic(err)
|
||||
}
|
||||
if log.V(1) {
|
||||
go calcuQPS()
|
||||
}
|
||||
}
|
||||
|
||||
// initService init services.
|
||||
func initService(c *conf.Config) {
|
||||
// idfSvc = identify.New(c.Identify)
|
||||
svc = service.New(c)
|
||||
}
|
||||
|
||||
// outerRouter init outer router api path.
|
||||
func outerRouter(e *bm.Engine) {
|
||||
v := vegas.New()
|
||||
go func() {
|
||||
ticker := time.NewTicker(time.Second * 3)
|
||||
defer ticker.Stop()
|
||||
for {
|
||||
<-ticker.C
|
||||
m := v.Stat()
|
||||
log.Info("vegas: limit(%d) inFlight(%d) minRtt(%v) rtt(%v)", m.Limit, m.InFlight, m.MinRTT, m.LastRTT)
|
||||
}
|
||||
}()
|
||||
l := limit.New(nil)
|
||||
//init api
|
||||
e.GET("/monitor/ping", ping)
|
||||
group := e.Group("/stress")
|
||||
group.GET("/normal", aqmTest)
|
||||
group.GET("/vegas", func(c *bm.Context) {
|
||||
start := time.Now()
|
||||
done, success := v.Acquire()
|
||||
if !success {
|
||||
done(time.Time{}, rate.Ignore)
|
||||
c.AbortWithStatus(509)
|
||||
return
|
||||
}
|
||||
defer done(start, rate.Success)
|
||||
c.Next()
|
||||
}, aqmTest)
|
||||
group.GET("/attack", func(c *bm.Context) {
|
||||
done, err := l.Allow(c)
|
||||
defer done(rate.Success)
|
||||
if err != nil {
|
||||
c.AbortWithStatus(509)
|
||||
return
|
||||
}
|
||||
c.Next()
|
||||
}, aqmTest)
|
||||
|
||||
}
|
||||
|
||||
func calcuQPS() {
|
||||
var creq, breq int64
|
||||
for {
|
||||
time.Sleep(time.Second * 5)
|
||||
creq = atomic.LoadInt64(&req)
|
||||
delta := creq - breq
|
||||
atomic.StoreInt64(&qps, delta/5)
|
||||
breq = creq
|
||||
log.Info("HTTP QPS:%d", atomic.LoadInt64(&qps))
|
||||
}
|
||||
|
||||
}
|
||||
func aqmTest(c *bm.Context) {
|
||||
params := c.Request.Form
|
||||
sleep, err := strconv.ParseInt(params.Get("sleep"), 10, 64)
|
||||
if err == nil {
|
||||
time.Sleep(time.Millisecond * time.Duration(sleep))
|
||||
}
|
||||
atomic.AddInt64(&req, 1)
|
||||
for i := 0; i < 3000+rand.Intn(3000); i++ {
|
||||
crc32.Checksum([]byte(`testasdwfwfsddsfgwddcscsc
|
||||
http://git.bilibili.co/platform/go-common/merge_requests/new?merge_request%5Bsource_branch%5D=stress%2Fcodel`), crc32.IEEETable)
|
||||
}
|
||||
}
|
||||
|
||||
// ping check server ok.
|
||||
func ping(c *bm.Context) {
|
||||
}
|
||||
|
||||
// innerRouter init local router api path.
|
||||
func localRouter(e *bm.Engine) {
|
||||
//init api
|
||||
e.GET("/monitor/ping", ping)
|
||||
group := e.Group("/x/main/stress")
|
||||
{
|
||||
group.GET("", aqmTest)
|
||||
}
|
||||
}
|
29
library/rate/limit/bench/stress/service/BUILD
Normal file
29
library/rate/limit/bench/stress/service/BUILD
Normal file
@ -0,0 +1,29 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["service.go"],
|
||||
importpath = "go-common/library/rate/limit/bench/stress/service",
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//library/rate/limit/bench/stress/conf:go_default_library"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
18
library/rate/limit/bench/stress/service/service.go
Normal file
18
library/rate/limit/bench/stress/service/service.go
Normal file
@ -0,0 +1,18 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"go-common/library/rate/limit/bench/stress/conf"
|
||||
)
|
||||
|
||||
// Service struct
|
||||
type Service struct {
|
||||
c *conf.Config
|
||||
}
|
||||
|
||||
// New init
|
||||
func New(c *conf.Config) (s *Service) {
|
||||
s = &Service{
|
||||
c: c,
|
||||
}
|
||||
return s
|
||||
}
|
Reference in New Issue
Block a user