-
Notifications
You must be signed in to change notification settings - Fork 276
Description
Description of the bug
If you add the opentelemetry-exporter-otlp-metrics gem to your Gemfile, but don't reference the opentelemetry-metrics-api gem directly, then when you configure OpenTelemetry then you will get a NoMethodError when configure is trying to call meter_provider=. This is because meter_provider= is defined in metrics_api/lib/opentelemetry-metrics-api.rb, but that file is not required, because the require statement for opentelemetry-metrics-api is in metrics_sdk/lib/opentelemetry-metrics-sdk.rb, but the opentelemetry-exporter-otlp-metrics gem has require 'opentelemetry/sdk/metrics', as seems to be the convention in the rest of the code. The require statements in metrics_sdk/lib/opentelemetry-metrics-sdk.rb should be moved to metrics_sdk/lib/opentelemetry/sdk/metrics.rb to match similar code elsewhere in the codebase.
The opentelemetry-logs-sdk and opentelemetry-logs-api gems have the same problem with the logger_provider= method, but the opentelemetry-exporter-otlp-logs gem has this line of code to work around it:
require 'opentelemetry-logs-api' # the sdk isn't loading the api, but not sure whyThe require statements being in the wrong file is why.
Share details about your runtime
Operating system details: Linux, Ubuntu 22.04 LTS, also macOS
RUBY_ENGINE: "ruby"
RUBY_VERSION: "3.4.7"
Share a simplified reproduction if possible
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
gem 'opentelemetry-exporter-otlp-metrics'
end
require 'opentelemetry-exporter-otlp-metrics'
OpenTelemetry::SDK.configure do |c|
c.use_all
endTip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.