复用http.go里面的 g.client(),更新config.yml的注册方式, 更新jaeger链路追踪

This commit is contained in:
Cold
2025-12-15 17:27:10 +08:00
committed by 张斌
parent 8830091e7d
commit 8218487ed0
4 changed files with 102 additions and 59 deletions

View File

@@ -92,31 +92,13 @@ func NeedES() bool {
// 如果配置文件中没有 startup 配置,则默认全部启动
func loadFromConfig() *Components {
ctx := context.Background()
// 检查是否有 startup 配置节
startupCfg := g.Cfg().MustGet(ctx, "startup")
if startupCfg.IsEmpty() {
// 没有配置 startup默认全部启动
glog.Debug(ctx, "未找到 startup 配置,默认启动所有组件")
return &Components{
Consul: true,
Jaeger: true,
Redis: true,
RabbitMQ: true,
MongoDB: true,
RAGFlow: true,
ES: true,
}
}
// 有配置则按配置来,未配置的项默认 true
return &Components{
Consul: g.Cfg().MustGet(ctx, "startup.consul", true).Bool(),
Jaeger: g.Cfg().MustGet(ctx, "startup.jaeger", true).Bool(),
Redis: g.Cfg().MustGet(ctx, "startup.redis", true).Bool(),
RabbitMQ: g.Cfg().MustGet(ctx, "startup.rabbitmq", true).Bool(),
MongoDB: g.Cfg().MustGet(ctx, "startup.mongodb", true).Bool(),
RAGFlow: g.Cfg().MustGet(ctx, "startup.ragflow", true).Bool(),
ES: g.Cfg().MustGet(ctx, "startup.es", true).Bool(),
Consul: !g.Cfg().MustGet(ctx, "consul").IsEmpty(),
Jaeger: !g.Cfg().MustGet(ctx, "jaeger").IsEmpty(),
Redis: !g.Cfg().MustGet(ctx, "redis").IsEmpty(),
RabbitMQ: !g.Cfg().MustGet(ctx, "rabbitmq").IsEmpty(),
MongoDB: !g.Cfg().MustGet(ctx, "mongo").IsEmpty(),
RAGFlow: !g.Cfg().MustGet(ctx, "ragflow").IsEmpty(),
ES: !g.Cfg().MustGet(ctx, "elasticsearch").IsEmpty(),
}
}