fix: opentelemetry traceid not correct (#1108)
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/tal-tech/go-zero/core/logx"
|
||||
"github.com/tal-tech/go-zero/core/prometheus"
|
||||
"github.com/tal-tech/go-zero/core/stat"
|
||||
"github.com/tal-tech/go-zero/core/trace/opentelemetry"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -26,11 +27,10 @@ const (
|
||||
type ServiceConf struct {
|
||||
Name string
|
||||
Log logx.LogConf
|
||||
Mode string `json:",default=pro,options=dev|test|rt|pre|pro"`
|
||||
MetricsUrl string `json:",optional"`
|
||||
Prometheus prometheus.Config `json:",optional"`
|
||||
// TODO: enable it in v1.2.2
|
||||
// Telemetry opentelemetry.Config `json:",optional"`
|
||||
Mode string `json:",default=pro,options=dev|test|rt|pre|pro"`
|
||||
MetricsUrl string `json:",optional"`
|
||||
Prometheus prometheus.Config `json:",optional"`
|
||||
Telemetry opentelemetry.Config `json:",optional"`
|
||||
}
|
||||
|
||||
// MustSetUp sets up the service, exits on error.
|
||||
@@ -52,11 +52,10 @@ func (sc ServiceConf) SetUp() error {
|
||||
sc.initMode()
|
||||
prometheus.StartAgent(sc.Prometheus)
|
||||
|
||||
// TODO: enable it in v1.2.2
|
||||
// if len(sc.Telemetry.Name) == 0 {
|
||||
// sc.Telemetry.Name = sc.Name
|
||||
// }
|
||||
// opentelemetry.StartAgent(sc.Telemetry)
|
||||
if len(sc.Telemetry.Name) == 0 {
|
||||
sc.Telemetry.Name = sc.Name
|
||||
}
|
||||
opentelemetry.StartAgent(sc.Telemetry)
|
||||
|
||||
if len(sc.MetricsUrl) > 0 {
|
||||
stat.SetReportWriter(stat.NewRemoteWriter(sc.MetricsUrl))
|
||||
|
||||
Reference in New Issue
Block a user