(Hey there! This is my first time proposing a new Rails feature; feedback very much appreciated!)
I find the verbose_query_logs
setting extremely useful for debugging, and I’d like to propose an additional configuration setting to make it more detailed when desired.
Right now, verbose_query_logs
logs a single line, describing the specific call site where a given DB query originated. This is great, but there are times when even more detail about the call site would be useful – for example, when the DB query happens in a method that is called from many other places throughout the codebase.
verbose_query_logs_stack_depth
would allow a developer to configure how many lines of the call site stack trace should be displayed. For example, a value of 3
would display the 3 immediate ancestors of the DB query. With this setting, a developer could increase the amount of detail that is printed about each DB query, helping them to more quickly locate the source of a problematic query and thus to fix it.
It looks like a fairly simple code update, so I already have a branch ready (GitHub - rofreg/rails at add-verbose_query_logs_stack_depth), but the Rails contribution guide suggested that I share my proposed change before I open a PR, so here I am I realize this is a fairly small and specific suggestion, but I think it might be an especially useful one. Looking forward to any feedback!