feat 模块删除bind函数
This commit is contained in:
@@ -15,16 +15,16 @@ import (
|
||||
// Tracer 链路追踪模块
|
||||
type Tracer struct {
|
||||
DefaultModule
|
||||
MetricCfg *config.MetricConfig
|
||||
ServiceName string
|
||||
tp *sdktrace.TracerProvider
|
||||
metricCfg *config.MetricConfig
|
||||
serviceName string
|
||||
}
|
||||
|
||||
func (m *Tracer) Init() error {
|
||||
exporter, err := otlptracegrpc.New(
|
||||
context.Background(),
|
||||
otlptracegrpc.WithInsecure(),
|
||||
otlptracegrpc.WithEndpoint(m.metricCfg.Jaeger.Endpoint),
|
||||
otlptracegrpc.WithEndpoint(m.MetricCfg.Jaeger.Endpoint),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -34,7 +34,7 @@ func (m *Tracer) Init() error {
|
||||
sdktrace.WithBatcher(exporter),
|
||||
sdktrace.WithResource(resource.NewWithAttributes(
|
||||
semconv.SchemaURL,
|
||||
semconv.ServiceNameKey.String(m.serviceName),
|
||||
semconv.ServiceNameKey.String(m.ServiceName),
|
||||
)),
|
||||
)
|
||||
otel.SetTracerProvider(m.tp)
|
||||
@@ -51,16 +51,3 @@ func (m *Tracer) Stop() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Tracer) Bind(data ...any) Module {
|
||||
if data == nil || len(data) == 0 {
|
||||
return m
|
||||
}
|
||||
if mc, ok := data[0].(*config.MetricConfig); ok {
|
||||
m.metricCfg = mc
|
||||
}
|
||||
if name, ok := data[1].(string); ok {
|
||||
m.serviceName = name
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user