代码拉取完成,页面将自动刷新
package main
import (
"flag"
"github.com/Runner-Go-Team/RunnerGo-collector-open/internal"
"github.com/Runner-Go-Team/RunnerGo-collector-open/internal/pkg/conf"
"github.com/Runner-Go-Team/RunnerGo-collector-open/internal/pkg/dal/redis"
log2 "github.com/Runner-Go-Team/RunnerGo-collector-open/internal/pkg/log"
"github.com/Runner-Go-Team/RunnerGo-collector-open/internal/pkg/server"
"net/http"
"os"
"os/signal"
"runtime"
"syscall"
)
var mode int
var configFile string
func main() {
flag.IntVar(&mode, "m", 0, "读取环境变量还是读取配置文件")
flag.StringVar(&configFile, "c", "./open.yaml", "配置文件")
if !flag.Parsed() {
flag.Parse()
}
internal.InitProjects(mode, configFile)
runtime.GOMAXPROCS(runtime.NumCPU())
// 性能分析
//pyroscope.Start(
// pyroscope.Config{
// ApplicationName: "RunnerGo-collector-open",
// ServerAddress: "http://192.168.1.205:4040/",
// //Logger: pyroscope.StandardLogger,
// ProfileTypes: []pyroscope.ProfileType{
// pyroscope.ProfileCPU,
// pyroscope.ProfileAllocObjects,
// pyroscope.ProfileAllocSpace,
// pyroscope.ProfileInuseObjects,
// pyroscope.ProfileInuseSpace,
// },
// })
// 发送心跳
go redis.SendHeartBeatRedis(conf.Collector, conf.Duration)
if mode != 0 {
// 检查kafka是否启动
kafkaAddress := os.Getenv("RG_KAFKA_ADDRESS")
if kafkaAddress == "" {
kafkaAddress = "kafka:9092"
}
//time.Sleep(60 * time.Second)
//// docker版本,删除上次启动是的
//redis.ExitStressBelongPartition(conf.StressBelongPartition, conf.Collector)
}
collectorService := &http.Server{
Addr: conf.Conf.Http.Host,
}
go server.Execute(conf.Conf.Kafka.Host)
go func() {
if err := collectorService.ListenAndServe(); err != nil {
log2.Logger.Error("collector:", err)
return
}
}()
/// 接收终止信号
quit := make(chan os.Signal)
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
<-quit
log2.Logger.Info("注销成功")
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。