From 80b8da733d5a94f7e1bab889f77308b7cc24a341 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Tue, 3 Oct 2023 16:37:51 +1000 Subject: [PATCH] refactor: Simplify NewResource function --- pkg/observability/tracing.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/pkg/observability/tracing.go b/pkg/observability/tracing.go index 4ef63227..bf511bea 100644 --- a/pkg/observability/tracing.go +++ b/pkg/observability/tracing.go @@ -46,17 +46,7 @@ func SetupOTelSDK(ctx context.Context, tracerProvider *trace.TracerProvider) (sh } func NewResource(serviceName, serviceVersion string) (*resource.Resource, error) { - res, err := resource.New(context.Background(), - resource.WithFromEnv(), - resource.WithProcess(), - resource.WithOS(), - resource.WithContainer(), - resource.WithHost()) - if err != nil { - return nil, fmt.Errorf("creating resource: %w", err) - } - - return resource.Merge(res, + return resource.Merge(resource.Default(), resource.NewWithAttributes(semconv.SchemaURL, semconv.ServiceName(serviceName), semconv.ServiceVersion(serviceVersion),