Skip to content

Improve logging for slow queries #13

Description

@ngudkov

Hello!
When db4bix performs slow query (slower than connectionTimeoutMillis) the session will be terminated with result:
Query returned no data

Log example:

db4bix_1  | [2020/05/20 - 12:19:14] db4bix:TimerProcessor:warning DB: NAME Query returned no data Prod, 11183, 80000, 60, {"query":"select client_addr from pg_stat_replication","time":"60","item":"pgsql.DB4bix.config[streaming,NAME]","names":"HOTSTANDBY","status":"run"} connection properties: [

db4bix_1  |   [ 'type', 'postgres' ],
db4bix_1  |   [ 'instance', 'db_name' ],
db4bix_1  |   [ 'host', 'hostname' ],
db4bix_1  |   [ 'port', 'port' ],
db4bix_1  |   [ 'user', 'user' ],
db4bix_1  |   [
db4bix_1  |     'pool',
db4bix_1  |     {
db4bix_1  |       max: '10',
db4bix_1  |       min: '0',
db4bix_1  |       idleTimeoutMillis: '30000',
db4bix_1  |       connectionTimeoutMillis: '30000'
db4bix_1  |     }
db4bix_1  |   ],
db4bix_1  |   [ 'name', 'NAME' ]
db4bix_1  | ] query: {
db4bix_1  |   query: 'select client_addr from pg_stat_replication',
db4bix_1  |   time: '60',
db4bix_1  |   item: 'pgsql.DB4bix.config[streaming,NAME]',
db4bix_1  |   names: 'HOTSTANDBY',
db4bix_1  |   status: 'run'
db4bix_1  | } +0ms

I think that if the session was terminated by timeout, it should be logged clearly.
Example:
Query session was terminated before db NAME answered, connectionTimeoutMillis=[CURRENT_VALUE]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions