-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metrics feedback #1662
Comments
👋 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 |
Hi there 👋 I've started some prototype implementation of metrics in a Rails app, and I could get some metrics exported from the SDK example. However, From the README it is not clear where and when I should pull the metrics and shutdown the provider? OpenTelemetry.meter_provider.metric_readers.each(&:pull)
OpenTelemetry.meter_provider.shutdown What we'd want to do is adding a counter metric each time a specific controller action is called. I can do this with a standard |
Hi @chloe-meister! Thanks for reaching out! The README provides an example for a script that would run once, pull the metric, and exit the program. If you're open to it, I think a periodic metric reader is a better fit for a Rails application. It'll collect the metrics and pass them to the exporter on a set interval. The process will live as long as the Rails application does, or until Assuming you're using the OTLP exporter, rather than calling: opentelemetry-ruby/examples/metrics_sdk/metrics_collect_otlp.rb Lines 23 to 25 in 2f87a1d
You would call something like: # config/initializers/opentelemetry.rb
reader = OpenTelemetry::SDK::Metrics::Export::PeriodicMetricReader.new(
exporter: OpenTelemetry::Exporter::OTLP::Metrics::MetricsExporter.new,
export_interval_millis: 3000,
export_timeout_millis: 10000)
OpenTelemetry.meter_provider.add_metric_reader(reader) You can create the meter and the counter the same way as in the example. Using arguments above, your metrics would be exported every three seconds and would have a 10-second timeout. Keep in mind that if you're using the OTLP exporter, you also need to install the |
Hi @kaylareopelle! Thank you very much for the detailed answer. This helps a lot 🙏 |
We want your feedback on the
opentelemetry-metrics-sdk
andopentelemetry-metrics-api
gems! Understanding how these libraries are used by the community will help us prioritize future work on Metrics.The text was updated successfully, but these errors were encountered: