(fullTableName string)
| 462 | TraceID: observe.TraceIDFromContext(c.ctx), |
| 463 | SpanID: observe.SpanIDFromContext(c.ctx), |
| 464 | QueryMetadata: encodedMeta, |
| 465 | AccessKinds: accessKinds, |
| 466 | MetadataComplete: metaComplete, |
| 467 | WorkerTier: c.currentWorkerTier(), |
| 468 | }) |
| 469 | } |
| 470 | |
| 471 | // logQuery builds a QueryLogEntry from the connection context and sends it to the logger. |
| 472 | func (c *clientConn) logQuery(start time.Time, query, transpiledQuery, cmdType string, |
| 473 | resultRows, writtenRows int64, errCode, errMsg, protocol string) { |
| 474 | |
| 475 | // Consume the profiling rollup left behind by the most recent |
| 476 | // EnrichSpanWithProfiling up front, so the per-org analytics event and the |
| 477 | // query-log row observe the same values and it is reset even when the |
| 478 | // query-log sink is disabled (a later logQuery without a fresh exec must not |
| 479 | // reuse stale timings from a previous query). |
| 480 | profilingSummary := c.lastProfilingSummary |
| 481 | c.lastProfilingSummary = observe.QueryProfilingSummary{} |
| 482 | |
| 483 | if isQueryLogSelfReferential(query) { |
| 484 | return |
| 485 | } |
| 486 | |
| 487 | // Per-org product analytics for the terminal event of a successful query. |
| 488 | // Failures are already captured by query_failed (logQueryError), so gate on |
| 489 | // errCode == "" to keep the lifecycle clean (initiated -> completed | failed) |
| 490 | // and avoid double-counting. Emitted independently of the query-log sink so |
| 491 | // this usage signal does not depend on query-log configuration. |
| 492 | if errCode == "" { |
| 493 | analytics.Default().Capture("query_completed", c.orgID, map[string]any{ |
| 494 | "user": c.username, |
| 495 | "team_id": c.teamID, |
| 496 | "trace_id": observe.TraceIDFromContext(c.ctx), |
| 497 | "protocol": protocol, |
no outgoing calls
no test coverage detected