logQueryFinished records a query terminating on the worker. Counter- part to logQueryStarted; emit once per query regardless of outcome so the start/finish pair is always balanced. On error paths logQueryError still fires for severity routing (Info vs Error based on SQLSTATE class). logQueryFinishe
(query string, start time.Time, rows int64, err error)
| 476 | func (c *clientConn) queryContextForCursor() (context.Context, func()) { |
| 477 | return c.queryContextInner(false) |
| 478 | } |
| 479 | |
| 480 | func (c *clientConn) queryContextInner(monitor bool) (context.Context, func()) { |
| 481 | c.ensureConnectionContext() |
| 482 | // Registering for cancellation is the moment the statement becomes live to |
| 483 | // the client, which makes this the one place every execution path — simple, |
| 484 | // batched, extended, COPY, cursor — passes through on its way to an engine. |
| 485 | // The QueryStart event and the ExceptionBeforeStart boundary both hang off |
| 486 | // it rather than off a call added to each path. |
| 487 | c.markExecStarted() |
| 488 | // Carry the statement's ID to the engine. The worker stamps it on its own |
| 489 | // logs, so a client complaint can be followed from this connection into the |
| 490 | // pod that ran the statement. |
| 491 | ctx, cancel := context.WithCancel(wire.WithQueryID(c.ctx, c.currentQueryID())) |
| 492 | key := c.backendKey() |
| 493 | c.server.RegisterQuery(key, cancel) |
| 494 |
no test coverage detected