You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following along the Readme for the Metris SDK. There's an error when running OpenTelemetry.meter_provider.add_metric_reader
# Create an exporter. This example exports metrics to the console.console_metric_exporter=OpenTelemetry::SDK::Metrics::Export::ConsoleMetricPullExporter.new# Add the exporter to the meter provider as a new metric reader.OpenTelemetry.meter_provider.add_metric_reader(console_metric_exporter)# Create a meter to generate instruments.meter=OpenTelemetry.meter_provider.meter("SAMPLE_METER_NAME")
The error is
NoMethodError:
undefined method `add_metric_reader' for an instance of OpenTelemetry::Internal::ProxyMeterProvider
When going through the code, in metrics_api/lib/opentelemetry/internal/proxy_meter_provider.rb we can see that there is indeed no method called add_metric_reader unlike what we see in metrics_sdk/lib/opentelemetry/sdk/metrics/meter_provider.rb.
The documentation should probably refer to OpenTelemetry::SDK::Metrics::MeterProvider instead of OpenTelemetry.meter_provider.
Share details about your runtime
RUBY_ENGINE: "ruby"
RUBY_VERSION: "3.3.5"
Share a simplified reproduction if possible
Exactly like the Metrics' SDK Readme
console_metric_exporter=OpenTelemetry::SDK::Metrics::Export::ConsoleMetricPullExporter.new# Add the exporter to the meter provider as a new metric reader.OpenTelemetry.meter_provider.add_metric_reader(console_metric_exporter)# Create a meter to generate instruments.meter=OpenTelemetry.meter_provider.meter("SAMPLE_METER_NAME")
The text was updated successfully, but these errors were encountered:
Hi @GBoucher42, thanks for bringing this to our attention!
This is puzzling. The OpenTelemetry::Internal::ProxyMeterProvider inherits from OpenTelemetry::SDK::Metrics::MeterProvider, so add_metric_reader should be brought in by the parent class.
I'm not able to reproduce the error locally on the latest version of the opentelemetry-metrics-sdk and and opentelemetry-metrics-api gems when I run those lines as part of the examples/metrics_sdk/metrics_collect.rb script.
I have a few questions to help us troubleshoot:
What versions of opentelemetry-related gems are you using?
Are you running the code in a script or within a web framework?
If you clone the repo on Ruby 3.3.5 and run the examples/metrics_sdk/metrics_collect.rb script, does the same error appear in your environment?
Current opentelemetry-metrics-sdk needs to work with opentelemetry-sdk, which means metrics-sdk needs to be initialized through ::OpenTelemetry::SDK.configure from opentelemetry-sdk.
e.g.
require'opentelemetry-sdk'require'opentelemetry-metrics-sdk'OpenTelemetry::SDK.configure# ... rest of your code
👋 This issue has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the keep label to hold stale off permanently, or do nothing. If you do nothing this issue will be closed eventually by the stale bot.
Following along the Readme for the Metris SDK. There's an error when running
OpenTelemetry.meter_provider.add_metric_reader
The error is
When going through the code, in
metrics_api/lib/opentelemetry/internal/proxy_meter_provider.rb
we can see that there is indeed no method called add_metric_reader unlike what we see inmetrics_sdk/lib/opentelemetry/sdk/metrics/meter_provider.rb
.The documentation should probably refer to
OpenTelemetry::SDK::Metrics::MeterProvider
instead ofOpenTelemetry.meter_provider
.Share details about your runtime
RUBY_ENGINE: "ruby"
RUBY_VERSION: "3.3.5"
Share a simplified reproduction if possible
Exactly like the Metrics' SDK Readme
The text was updated successfully, but these errors were encountered: