| 2283 | } |
| 2284 | |
| 2285 | func (sc *ServerContext) SetContextLogID(parent context.Context, id string) context.Context { |
| 2286 | if sc != nil { |
| 2287 | sc.LogContextID = id |
| 2288 | // ServerLogContext is separate from standard LogContext, so this does not reset the log context |
| 2289 | return base.LogContextWith(parent, &base.ServerLogContext{LogContextID: sc.LogContextID}) |
| 2290 | } |
| 2291 | return parent |
| 2292 | } |
| 2293 | |
| 2294 | // getTotalMemory returns the total memory available on the system. If a cgroup is detected, it will use the cgroup memory max. |
| 2295 | func getTotalMemory(ctx context.Context) uint64 { |