Skip to content

Proposal: Improve logging format from QueryLogs #45139

Closed
@modulitos

Description

@modulitos

Update: This proposal has been implemented in this PR: #45081

I’m looking for feedback on a proposal to improve the formatting of auto-injected SQL comments in Rails 7 (via QueryLogs). It seems like the current format for SQL comments isn’t correct, because:

  1. It isn’t really machine-readable
  2. It doesn’t adhere to existing standards, like sqlcommenter

For example, auto-commented SQL queries using Marginalia/Rails look like this:
"select id from posts; /*application:Joe's app,controller:my_controller*/"

and I'm proposing a format to use the “sqlcommenter” syntax like so:
"select id from posts; /*application='Joe\\'s app',controller='my_controller'*/"

The latter can be parsed much more easily, and will also automatically report metrics by databases that support the sqlcommenter formatting.

This also feels like a good time to propose a change because it's relatively new functionality, before too many folks develop a dependency on the format.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions