mirror of
https://github.com/xinliangnote/go-gin-api.git
synced 2024-04-21 12:31:46 +00:00
upgrade
This commit is contained in:
@@ -384,10 +384,11 @@ func (c *context) URI() string {
|
||||
return uri
|
||||
}
|
||||
|
||||
// RequestContext 获取请求的 context (当client关闭后,会自动canceled)
|
||||
// RequestContext (包装 Trace + Logger) 获取请求的 context (当client关闭后,会自动canceled)
|
||||
func (c *context) RequestContext() StdContext {
|
||||
return StdContext{
|
||||
c.ctx.Request.Context(),
|
||||
//c.ctx.Request.Context(),
|
||||
stdctx.Background(),
|
||||
c.Trace(),
|
||||
c.Logger(),
|
||||
}
|
||||
|
||||
@@ -70,9 +70,14 @@ func (h *handler) View() core.HandlerFunc {
|
||||
obj.HostOS = fmt.Sprintf("%s(%s) %s", hostInfo.Platform, hostInfo.PlatformFamily, hostInfo.PlatformVersion)
|
||||
obj.HostName = hostInfo.Hostname
|
||||
|
||||
obj.CpuName = cpuInfo[0].ModelName
|
||||
obj.CpuCores = cpuInfo[0].Cores
|
||||
obj.CpuUsedPercent, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", cpuPercent[0]), 64)
|
||||
if len(cpuInfo) > 0 {
|
||||
obj.CpuName = cpuInfo[0].ModelName
|
||||
obj.CpuCores = cpuInfo[0].Cores
|
||||
}
|
||||
|
||||
if len(cpuPercent) > 0 {
|
||||
obj.CpuUsedPercent, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", cpuPercent[0]), 64)
|
||||
}
|
||||
|
||||
obj.GoPath = runtime.GOROOT()
|
||||
obj.GoVersion = runtime.Version()
|
||||
|
||||
Reference in New Issue
Block a user