Page MenuHomePhabricator

Include request_id in the comments of database queries
Closed, DuplicatePublic

Description

When MediaWiki sends SQL queries to the database, it includes a comment in the query that shows the code path which sent the query:

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 list of high-duration queries in 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.

Event Timeline

Legoktm raised the priority of this task from Medium to High.Sep 18 2021, 1:28 AM