Skip to content

Commit

Permalink
refactor: Simplify NewResource function
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Oct 3, 2023
1 parent 96d030f commit 80b8da7
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions pkg/observability/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 80b8da7

Please sign in to comment.