diff --git a/service/service.go b/service/service.go index 30cdc60ca9d..1c4d9a7dccf 100644 --- a/service/service.go +++ b/service/service.go @@ -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) diff --git a/service/telemetry/attributes.go b/service/telemetry/attributes.go index 7b1b3b4ed99..60b23a34591 100644 --- a/service/telemetry/attributes.go +++ b/service/telemetry/attributes.go @@ -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) } }