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

Function NewQueryLogger

server/querylog.go:112–133  ·  view source on GitHub ↗

NewQueryLogger opens a dedicated :memory: DuckDB, attaches DuckLake, creates the system.query_log table, and starts the background flush goroutine.

(cfg Config)

Source from the content-addressed store, hash-verified

110// close it to unblock shutdown.
111func (ql *QueryLogger) StopContext(ctx context.Context) error {
112 if ql == nil {
113 return nil
114 }
115 if ctx == nil {
116 ctx = context.Background()
117 }
118 var stopErr error
119 ql.stopOnce.Do(func() {
120 if ql.ch != nil {
121 close(ql.ch)
122 }
123 if ql.done != nil {
124 select {
125 case <-ql.done:
126 case <-ctx.Done():
127 stopErr = ctx.Err()
128 if ql.cancel != nil {
129 ql.cancel()
130 }
131 }
132 }
133 if ql.cancel != nil {
134 ql.cancel()
135 }
136 if ql.db != nil && ql.closeDB {

Callers 1

NewQueryLogSinkFunction · 0.85

Calls 2

flushLoopMethod · 0.95
openQueryLogDuckLakeDBFunction · 0.85

Tested by

no test coverage detected