Skip to content

Add ViewComponent render tracking to ViewTracker#641

Open
dkniffin wants to merge 1 commit intodanmayer:mainfrom
dkniffin:viewcomponent-notifications
Open

Add ViewComponent render tracking to ViewTracker#641
dkniffin wants to merge 1 commit intodanmayer:mainfrom
dkniffin:viewcomponent-notifications

Conversation

@dkniffin
Copy link
Copy Markdown
Contributor

@dkniffin dkniffin commented Apr 17, 2026

This is a followup on the conversation on #591. The solution is now possible, since ViewComponent/view_component#2572 was merged

Subscribe to render.view_component notifications in ViewTracker#railtie! so that ViewComponent template renders are tracked alongside standard Rails view renders. The ViewComponent payload uses view_identifier (not identifier) for the template path, so the subscription maps it accordingly.

Requires ViewComponent >= 4.6.0 (which added view_identifier to the payload) and config.view_component.instrumentation_enabled = true in the host app.

Also updated the tests and docs.

Subscribe to render.view_component notifications in ViewTracker#railtie!
so that ViewComponent template renders are tracked alongside standard
Rails view renders. The ViewComponent payload uses view_identifier
(not identifier) for the template path, so the subscription maps it
accordingly.

Requires ViewComponent >= 4.6.0 (which added view_identifier to the
payload) and config.view_component.instrumentation_enabled = true in
the host app.

Also updated the tests and docs.
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.

1 participant