jaeger修改读取config字段名

This commit is contained in:
2025-12-02 18:36:51 +08:00
parent ff8257c605
commit 4581e74807

View File

@@ -3,20 +3,21 @@ package jaeger
import ( import (
"context" "context"
"encoding/json" "encoding/json"
"gitee.com/red-future---jilin-g/common/http" "strconv"
"github.com/gogf/gf/contrib/trace/otlphttp/v2" "github.com/gogf/gf/contrib/trace/otlphttp/v2"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/net/ghttp"
"github.com/gogf/gf/v2/net/gtrace" "github.com/gogf/gf/v2/net/gtrace"
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
"strconv"
) )
var ShutDown func(ctx context.Context) var ShutDown func(ctx context.Context)
func init() { func init() {
jaegerAgent := g.Cfg().MustGet(context.Background(), "jaeger.addr").String() jaegerAgent := g.Cfg().MustGet(context.Background(), "jaeger.addr").String()
shutdown, err := otlphttp.Init(http.Httpserver.GetName(), jaegerAgent, "/v1/traces") serverName := g.Cfg().MustGet(context.Background(), "server.name").String()
shutdown, err := otlphttp.Init(serverName, jaegerAgent, "/v1/traces")
if err != nil { if err != nil {
panic(err) panic(err)
} }