mirror of
https://github.com/linka-cloud/grpc.git
synced 2025-06-22 01:02:29 +00:00
fix(otel)!: do not use a global client
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
@ -12,6 +12,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
sdktrace "go.opentelemetry.io/otel/sdk/trace"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
|
||||
|
||||
"go.linka.cloud/grpc-toolkit/logger"
|
||||
)
|
||||
|
||||
type config struct {
|
||||
@ -62,7 +64,8 @@ func newConfig(opts []Option) *config {
|
||||
return conf
|
||||
}
|
||||
|
||||
func (conf *config) newResource() *resource.Resource {
|
||||
func (conf *config) newResource(ctx context.Context) *resource.Resource {
|
||||
log := logger.C(ctx)
|
||||
if conf.resource != nil {
|
||||
if len(conf.resourceAttributes) > 0 {
|
||||
log.Warnf("WithResource overrides WithResourceAttributes (discarding %v)",
|
||||
@ -75,8 +78,6 @@ func (conf *config) newResource() *resource.Resource {
|
||||
return conf.resource
|
||||
}
|
||||
|
||||
ctx := context.TODO()
|
||||
|
||||
res, err := resource.New(ctx,
|
||||
resource.WithFromEnv(),
|
||||
resource.WithTelemetrySDK(),
|
||||
|
Reference in New Issue
Block a user