Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/app_profiler/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ class Railtie < Rails::Railtie
if (Rails.env.development? || Rails.env.test?) && AppProfiler.stackprof_viewer.remote?
app.middleware.insert_before(0, AppProfiler.viewer::Middleware)
end
app.middleware.insert_before(0, AppProfiler.middleware)
if AppProfiler.otel_instrumentation_enabled
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otel gems use Rack::Events. So inserting the profiling middleware, after Rack::Events, based on the config value makes sense to me.

What do you think @gmcgibbon?

Copy link
Member

@gmcgibbon gmcgibbon Mar 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does otel itself add them events middleware? A vanilla app doesn't have it. If so, this is ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

app.middleware.insert_after(Rack::Events, AppProfiler.middleware)
else
app.middleware.insert_before(0, AppProfiler.middleware)
end
end
end

Expand Down