Skip to content
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

feat: add active_storage instrumentation to rails #1391

Conversation

ymtdzzz
Copy link
Contributor

@ymtdzzz ymtdzzz commented Feb 2, 2025

related: #1307, #1313

This PR adds active_storage instrumentation implemented in #1313 to rails.
After this is released, I'll create another PR to add require to all (here).

Test

Gemfile in your application

gem "opentelemetry-sdk"
gem "opentelemetry-exporter-otlp"
gem "opentelemetry-instrumentation-rails", path: "../../development/github.com/ymtdzzz/opentelemetry-ruby-contrib/instrumentation/rails" # path to this branch

config/initializers/opentelemetry.rb in your application

require "opentelemetry/sdk"

# install all compatible instrumentation with default configuration
OpenTelemetry::SDK.configure do |c|
  c.service_name = "otel-ruby-development"
  c.use_all
end
Startup logs
I, [2025-02-03T17:03:24.400701 #84276]  INFO -- : Instrumentation: OpenTelemetry::Instrumentation::Rack was successfully installed with the following options {:allowed_request_headers=>[], :allowed_response_headers=>[], :application=>nil, :record_frontend_span=>false, :untraced_endpoints=>[], :url_quantization=>nil, :untraced_requests=>nil, :response_propagators=>[], :use_rack_events=>true, :allowed_rack_request_headers=>{}, :allowed_rack_response_headers=>{}}
I, [2025-02-03T17:03:24.401840 #84276]  INFO -- : Instrumentation: OpenTelemetry::Instrumentation::ActionPack was successfully installed with the following options {:span_naming=>:semconv}
I, [2025-02-03T17:03:24.402104 #84276]  INFO -- : Instrumentation: OpenTelemetry::Instrumentation::ActiveSupport was successfully installed with the following options {}
I, [2025-02-03T17:03:24.402374 #84276]  INFO -- : Instrumentation: OpenTelemetry::Instrumentation::ActionView was successfully installed with the following options {:disallowed_notification_payload_keys=>[], :notification_payload_transform=>nil, :legacy_span_names=>false}
I, [2025-02-03T17:03:24.402648 #84276]  INFO -- : Instrumentation: OpenTelemetry::Instrumentation::ActionMailer was successfully installed with the following options {:disallowed_notification_payload_keys=>["email.to.address", "email.from.address", "email.cc.address", "email.bcc.address"], :disallowed_process_payload_keys=>[], :notification_payload_transform=>#<Proc:0x0000000114b3ee48 /Users/yosuke.matsuda/.asdf/installs/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/opentelemetry-instrumentation-action_mailer-0.4.0/lib/opentelemetry/instrumentation/action_mailer/instrumentation.rb:95 (lambda)>, :process_payload_transform=>nil, :email_address=>:omit}
I, [2025-02-03T17:03:24.403772 #84276]  INFO -- : Instrumentation: OpenTelemetry::Instrumentation::ActiveRecord was successfully installed with the following options {}
I, [2025-02-03T17:03:24.403974 #84276]  INFO -- : Instrumentation: OpenTelemetry::Instrumentation::ActiveStorage was successfully installed with the following options {:disallowed_notification_payload_keys=>["active_storage.key", "active_storage.url"], :notification_payload_transform=>#<Proc:0x0000000114b38188 /Users/yosuke.matsuda/.asdf/installs/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/opentelemetry-instrumentation-active_storage-0.1.0/lib/opentelemetry/instrumentation/active_storage/instrumentation.rb:98 (lambda)>, :key=>:omit, :url=>:omit}
I, [2025-02-03T17:03:24.404917 #84276]  INFO -- : Instrumentation: OpenTelemetry::Instrumentation::ActiveJob was successfully installed with the following options {:propagation_style=>:link, :force_flush=>false, :span_naming=>:queue}
I, [2025-02-03T17:03:24.405133 #84276]  INFO -- : Instrumentation: OpenTelemetry::Instrumentation::ConcurrentRuby was successfully installed with the following options {}
I, [2025-02-03T17:03:24.405154 #84276]  INFO -- : Instrumentation: OpenTelemetry::Instrumentation::Rails was successfully installed with the following options {}

Generated trace

image

@ymtdzzz ymtdzzz changed the title feat: add active_storage instrumentation to rails (and implicitly to all) feat: add active_storage instrumentation to rails Feb 3, 2025
@ymtdzzz ymtdzzz marked this pull request as ready for review February 3, 2025 08:59
@kaylareopelle kaylareopelle merged commit 7949291 into open-telemetry:main Feb 3, 2025
66 checks passed
@github-actions github-actions bot mentioned this pull request Feb 3, 2025
@ymtdzzz ymtdzzz deleted the feature/add_active-storage_to_rails branch February 4, 2025 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants