Skip to content

better log messages for elapsed time warns #2669

Closed
@RoloEdits

Description

@RoloEdits

Is your feature request related to a problem? Please describe.

When the elapsed time for a query goes over some amount, there is a log for a warn. The message then only contained the query itself and again in another field a truncated version of the query.

Describe the solution you'd like

A clear "query took too long" in one of those fields would help convey what might seem like a random warn. The time was already a problem, but was known, and time was spent trying to figure out if there was another issue at play.

Describe alternatives you've considered

As its the library itself that has the logging, there is nothing I can do as long query times are not an error that can be matched on.

Additional context

version 0.7.1
postgres 15

Looks like this is the line where the logic for the log happens:

pub fn finish(&self) {
let elapsed = self.start.elapsed();
let lvl = if elapsed >= self.settings.slow_statements_duration {
self.settings.slow_statements_level
} else {
self.settings.statements_level
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions