MCPcopy Create free account
hub / github.com/PostHog/duckgres / logQueryFinished

Method logQueryFinished

server/conn.go:478–491  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

476func (c *clientConn) queryContextForCursor() (context.Context, func()) {
477 return c.queryContextInner(false)
478}
479
480func (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

Callers 13

handleExecuteMethod · 0.95
handleCopyMethod · 0.95
handleCopyOutMethod · 0.95
handleCopyInMethod · 0.95
batchInsertRowsMethod · 0.95
openCursorMethod · 0.95
execUserSecretDDLMethod · 0.95
executeQueryDirectMethod · 0.95
executeSelectQueryMethod · 0.95
executeMultiStatementMethod · 0.95

Calls 5

loggerMethod · 0.95
RedactForLogFunction · 0.92
TraceIDFromContextFunction · 0.92
RedactErrorForLogFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected