Possible to instrument ViewComponent renders with Sentry traces? #2240
-
I'd like to instrument my ViewComponents with Sentry Traces so I know how long things are taking. Sentry hooks into the stock Rails stuff amazingly well, and you can add your own custom timing entries. The Sentry docs have you surround your code in a ![]() I've got an The first syntax I came up with off the top of my head was something like: class ApplicationComponent < ViewComponent::Base
around_render :trace
def trace
Sentry.with_child_span op: "render.view_component", description: self.class.name do |span|
yield
span.set_data("metadata", foo: "bar")
end
end
end |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Closing in favor of #2344 |
Beta Was this translation helpful? Give feedback.
Closing in favor of #2344