When Mediawiki sends SQL queries to the database, it includes a comment in the query that shows the code path which sent the query:
```lang=sql
SELECT /* IndexPager::buildQueryInfo (LogPager) */ log_id, log_type, log_action, log_timestamp, [...] ```
This is very useful for diagnosing database load issues, as these comments are visible in the [[ https://tendril.wikimedia.org/activity?research=0&labsusers=0 | list of high-duration queries ]] in [[ https://wikitech.wikimedia.org/wiki/Tendril | Tendril ]].
However, in instances of an overload due to external traffic, it is still often challenging to backtrack from one method name to the actual traffic that is causing impact.
It would be helpful if we could include some more metadata in a comment in a query. In particular the request_id would be a nice one, as it means it becomes possible to start with a database query and go directly to logstash messages from MW, or to find more details about the request in Traffic analytics.