Name transactions for the master request

Created on 17 April 2023, over 1 year ago
Updated 22 June 2023, over 1 year ago

Problem/Motivation

Routes that make sub-requests can trigger the KernelEvents::REQUEST event again, after that event had already been triggered for the original 'parent' request. This means a transaction name for the parent request gets overwritten by the sub-request. At least in my case, I found this made it harder to distinguish between some pages: I am using https://www.drupal.org/project/view_mode_page β†’ to have multiple pages for a node. So I would prefer to be able to distinguish between these and the ordinary (canonical) node/entity view page, with each to have different transaction names.

I can imagine that there might be a case for deliberately using the same transaction names on pages that make sub-requests though, so it's possible some more thought is needed here. But that might just be an imagined use case rather than a real requirement!

Steps to reproduce

Install https://www.drupal.org/project/view_mode_page β†’ and configure a view mode page for a node type, observe that traces for requests to that page use the same transaction name as for requests to the ordinary canonical page for that node.

✨ Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom james.williams

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡§United Kingdom james.williams

    I should note that the pages that the view_mode_page module makes possible, don't get nicely named transactions with this change; but the point is that they are now distinguished as separate to the ordinary canonical node pages that this module does give the nice names for. Which is enough for me, though I can of course imagine it would be even nicer to give per-bundle names for the view_mode_page pages. But there aren't going to be many people actually needing that. Of course, if there's a need, further work on top of this patch is welcome! :-D

  • πŸ‡―πŸ‡΅Japan ultrabob Japan

    Thanks for taking the time to submit this patch James! We'll review it over the next few days.

  • πŸ‡ΊπŸ‡ΈUnited States mikemccaffrey

    Is there a reason that if it is a StackedRouteMatchInterface (which I am assuming is a sub-request) that it can't simple return out of the function, since the transaction has already be named by the parent transaction?

  • πŸ‡―πŸ‡΅Japan ultrabob Japan

    Actually looking into it a bit further, all currentRouteMatch are instances of StackedRouteMatchInterface. The patch is there because the event is fired multiple times in the case of a sub request, so I'll adjust this patch to return whenever the event is not firing on the master request.

  • @ultrabob opened merge request.
  • @ultrabob opened merge request.
  • Issue was unassigned.
  • Status changed to RTBC over 1 year ago
  • πŸ‡¬πŸ‡§United Kingdom james.williams

    That looks to fix the situation I originally reported, and I'm fine with its effect on others I'm aware of. Thanks! The indentation of the change is a little off still, but otherwise I'm happy. Not sure whether I'm the right person to set this to RTBC, but if you're happy, I'm happy!

  • First commit to issue fork.
  • Status changed to Fixed over 1 year ago
  • πŸ‡¨πŸ‡¦Canada RobLoach Earth

    Thanks James and Bob for pushing this forwards! Fixed up the whitespace, and merged. +1

    Should be available in the next version.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024