protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

type_name method missing for Google::Protobuf::Any in Ruby

Open xuan-cao-swi opened this issue 8 months ago • 1 comments

What version of protobuf and what language are you using? Version: v4.30.2 Language: Ruby

What operating system (Linux, Windows, ...) and version? Debian GNU/Linux 11 (bullseye)

What runtime / compiler are you using (e.g., python version or gcc version) gcc version 10.2.1 20210110 (Debian 10.2.1-6)

What did you do?

body = "\b\x03\x12VHTTP 400 (gRPC: INVALID_ARGUMENT): Metric validation removed all of the passed metrics\x1A\xA0\x01\n)type.googleapis.com/google.rpc.BadRequest\x12s\n>\n\x1D.resourceMetrics.scopeMetrics\x12\x1DPath contained no usable data\n1\n\x10.resourceMetrics\x12\x1DPath contained no usable data"
status = Google::Rpc::Status.decode(body)
details = status.details.map do |detail|
  klass_or_nil = ::Google::Protobuf::DescriptorPool.generated_pool.lookup(detail.type_name).msgclass
  detail.unpack(klass_or_nil) if klass_or_nil
end.compact

What did you expect to see

What did you see instead?

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

.resourceMetricsPath contained no usable data">:Google::Protobuf::Any

              klass_or_nil = ::Google::Protobuf::DescriptorPool.generated_pool.lookup(detail.type_name).msgclass
                                                                                            ^^^^^^^^^^ - /usr/local/bundle/gems/opentelemetry-exporter-otlp-metrics-0.4.0/lib/opentelemetry/exporter/otlp/metrics/util.rb:123:in `method_missing'

Anything else we should know about your project / environment

I checked the well_known_types.rb, it seems the file still have the function to call type_name, but no sure why it will throw method missing error. I am wondering what had changed.

xuan-cao-swi avatar Apr 09 '25 16:04 xuan-cao-swi

Have you observed this in previous versions or is this a regression?

Thanks!

esrauchg avatar Apr 09 '25 16:04 esrauchg

I observe this through all version (e.g. v3.25.6). The well_known_types.rb haven't been changed for last two years.

xuan-cao-swi avatar Apr 10 '25 18:04 xuan-cao-swi

Looking into this now, ETA for a fix unknown. A workaround should be to explicitly require 'google/protobuf/well_known_types'

JasonLunn avatar Apr 16 '25 14:04 JasonLunn

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago. This issue will be closed and archived after 14 additional days without activity.

github-actions[bot] avatar Sep 05 '25 10:09 github-actions[bot]

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

github-actions[bot] avatar Sep 19 '25 10:09 github-actions[bot]