FromContext gets the Stats out of the Context. Returns nil if stats have not been initialised in the context.
(ctx context.Context)
| 35 | // FromContext gets the Stats out of the Context. Returns nil if stats have not |
| 36 | // been initialised in the context. |
| 37 | func FromContext(ctx context.Context) *QueryStats { |
| 38 | o := ctx.Value(ctxKey) |
| 39 | if o == nil { |
| 40 | return nil |
| 41 | } |
| 42 | return o.(*QueryStats) |
| 43 | } |
| 44 | |
| 45 | // IsEnabled returns whether stats tracking is enabled in the context. |
| 46 | func IsEnabled(ctx context.Context) bool { |