您好想请问下如何获取压测结果通过接口传给其他服务
Rladmsrl opened this issue · comments
您好我想把压测结果传给另外一个接口,想问下怎么获取打印在控制台的结果 谢谢
使用GetReport接口就可以
package main
import (
"fmt"
"github.com/guonaihong/gout"
"github.com/guonaihong/gout/bench"
)
const (
benchNumber = 30000
benchConcurrent = 20
)
func main() {
var r bench.Report
err := gout.
POST(":4444"). //压测本地8080端口
SetJSON(gout.H{"hello": "world"}). //设置请求body内容
Filter(). //打开过滤器
Bench(). //选择bench功能
Concurrent(benchConcurrent). //并发数
Number(20). //压测次数
GetReport(&r). //获取压测元数据
Do()
fmt.Printf("report:%v\n", r)
if err != nil {
fmt.Printf("%v\n", err)
}
}
多谢!