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

Method beginQueryMetrics

server/query_metrics.go:30–39  ·  view source on GitHub ↗
(start time.Time)

Source from the content-addressed store, hash-verified

28var queryTotalCounter = promauto.NewCounterVec(prometheus.CounterOpts{
29 Name: "duckgres_query_total",
30 Help: "Total number of non-empty query attempts partitioned by terminal status and reason.",
31}, []string{"org", "status", "reason"})
32
33// queryMetricsScope is the per-query observation record. It began life holding
34// only the terminal Prometheus classification; it is now also where per-query
35// metadata is stamped by whichever layer knows it (protocol, transpile, exec,
36// results) and read back by logQuery. Keeping one scope per query means the
37// query log and duckgres_query_total cannot disagree about an outcome.
38//
39// Scopes nest (a batched simple query runs statements inside an outer scope),
40// so `previous` restores the parent on finish.
41type queryMetricsScope struct {
42 start time.Time

Calls

no outgoing calls