classifyQuery maps a command type string to a query_kind value.
(cmdType string)
| 537 | |
| 538 | clientAddr, clientPort := c.clientAddrPort() |
| 539 | |
| 540 | pgScanMs := int64(profilingSummary.PostgresScanSeconds * 1000) |
| 541 | |
| 542 | parentQueryID, statementIndex := "", 0 |
| 543 | if scope != nil { |
| 544 | parentQueryID, statementIndex = scope.parentQueryID, scope.statementIndex |
| 545 | } |
| 546 | // The terminal event carries the same extraction as the start event. When |
| 547 | // the scope has none (a path that logs without one), fall back to the |
| 548 | // statement text this call was handed so the row still says what was |
| 549 | // touched. |
| 550 | meta := c.queryMetadata(scope) |
| 551 | if scope == nil && c.server != nil && c.server.cfg.QueryLog.Metadata { |
| 552 | meta = extractQueryMetadata(query) |
| 553 | } |
| 554 | encodedMeta, accessKinds, metaComplete := queryMetadataColumns(meta) |
| 555 | ql.Log(QueryLogEntry{ |
| 556 | QueryID: c.currentQueryID(), |
| 557 | ParentQueryID: parentQueryID, |
| 558 | StatementIndex: statementIndex, |
| 559 | EventTime: start, |
| 560 | QueryDurationMs: time.Since(start).Milliseconds(), |
| 561 | Type: entryType, |
no outgoing calls