-
type Tracer struct{
startTime time.Time
}
func (t *Tracer) TraceQueryStart(...) {
t.startTime = time.Now()
}
func (t *Tracer) TraceQueryEnd(...) {
// log time taken by query
} Is it safe to use? |
Beta Was this translation helpful? Give feedback.
Answered by
jackc
Sep 16, 2023
Replies: 1 comment
-
Only if one See the tracelog package for a concurrency-safe example of tracking query time. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
S-YOU
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Only if one
Tracer
is only ever used by oneConn
at a time.See the tracelog package for a concurrency-safe example of tracking query time.