Skip to content

Commit

Permalink
Fix(cannon): Fix nil next panic (#222)
Browse files Browse the repository at this point in the history
* Fix(cannon): Fix nil next panic

* refactor: Simplify NewResource function
  • Loading branch information
samcm authored Oct 3, 2023
1 parent fc5c93c commit 5abfb4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
10 changes: 5 additions & 5 deletions pkg/cannon/iterator/checkpoint_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ func (c *CheckpointIterator) Next(ctx context.Context) (next *xatu.CannonLocatio
defer func() {
if err != nil {
span.RecordError(err)
}

epoch, err := c.getEpochFromLocation(next)
if err == nil {
span.SetAttributes(attribute.Int64("next", int64(epoch)))
} else {
epoch, err := c.getEpochFromLocation(next)
if err == nil {
span.SetAttributes(attribute.Int64("next", int64(epoch)))
}
}

span.End()
Expand Down
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 5abfb4f

Please sign in to comment.