Skip to content

Commit

Permalink
chore: minor code cleanup (open-telemetry#11472)
Browse files Browse the repository at this point in the history
Came across these in the work to support v0.3.0 of the configuration
schema, split them into a separate PR to reduce complexity of the
review.

Signed-off-by: Alex Boten <[email protected]>
  • Loading branch information
codeboten authored Oct 16, 2024
1 parent 4f79e0d commit 20c28ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func New(ctx context.Context, set Settings, cfg Config) (*Service, error) {

mp, err := telFactory.CreateMeterProvider(ctx, telset, &cfg.Telemetry)
if err != nil {
return nil, fmt.Errorf("failed to create metric provider: %w", err)
return nil, fmt.Errorf("failed to create meter provider: %w", err)
}

logsAboutMeterProvider(logger, cfg.Telemetry.Metrics, mp)
Expand Down
6 changes: 2 additions & 4 deletions service/telemetry/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ func attributes(set Settings, cfg Config) map[string]interface{} {
for k, v := range cfg.Resource {
if v != nil {
attrs[k] = *v
}

// the new value is nil, delete the existing key
if _, ok := attrs[k]; ok && v == nil {
} else {
// the new value is nil, delete the existing key
delete(attrs, k)
}
}
Expand Down

0 comments on commit 20c28ba

Please sign in to comment.