open-telemetry / opentelemetry-ruby

OpenTelemetry Ruby API & SDK, and related gems
https://opentelemetry.io/
Apache License 2.0
493 stars 244 forks source link

No block given error when Semantic Logger is used with the ForwardingLogger #1738

Closed kaylareopelle closed 1 month ago

kaylareopelle commented 1 month ago

This introduced a bug if the logger used is Semantic Logger.

OpenTelemetry error: no block given (yield)

Coming from: https://github.com/open-telemetry/opentelemetry-ruby/blob/main/sdk/lib/opentelemetry/sdk/forwarding_logger.rb#L41

adamk9k commented 1 month ago

Thank you @kaylareopelle for opening this in the meantime I've figured out what the issue was. It was coming from common/lib/opentelemetry/common/utilities.rb version 0.20.0 when it looked like this

def untraced
  Context.with_value(UNTRACED_KEY, true) do |ctx, _|
    yield ctx
  end
end

upgrading to 0.21.0 that includes this https://github.com/open-telemetry/opentelemetry-ruby/pull/1634 fixed it.