MCPcopy Index your code
hub / github.com/GoEdgeLab/EdgeNode / update

Method update

internal/nodes/node_status_executor.go:72–165  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70}
71
72func (this *NodeStatusExecutor) update() {
73 if sharedNodeConfig == nil {
74 return
75 }
76
77 var tr = trackers.Begin("UPLOAD_NODE_STATUS")
78 defer tr.End()
79
80 var status = &nodeconfigs.NodeStatus{}
81 status.BuildVersion = teaconst.Version
82 status.BuildVersionCode = utils.VersionToLong(teaconst.Version)
83 status.OS = runtime.GOOS
84 status.Arch = runtime.GOARCH
85 status.ExePath, _ = os.Executable()
86 status.ConfigVersion = sharedNodeConfig.Version
87 status.IsActive = true
88 status.ConnectionCount = sharedListenerManager.TotalActiveConnections()
89 status.CacheTotalDiskSize = caches.SharedManager.TotalDiskSize()
90 status.CacheTotalMemorySize = caches.SharedManager.TotalMemorySize()
91 status.TrafficInBytes = teaconst.InTrafficBytes
92 status.TrafficOutBytes = teaconst.OutTrafficBytes
93
94 apiSuccessPercent, apiAvgCostSeconds := this.apiCallStat.Sum()
95 status.APISuccessPercent = apiSuccessPercent
96 status.APIAvgCostSeconds = apiAvgCostSeconds
97
98 var localFirewall = firewalls.Firewall()
99 if localFirewall != nil && !localFirewall.IsMock() {
100 status.LocalFirewallName = localFirewall.Name()
101 }
102
103 // 记录监控数据
104 monitor.SharedValueQueue.Add(nodeconfigs.NodeValueItemConnections, maps.Map{
105 "total": status.ConnectionCount,
106 })
107
108 hostname, _ := os.Hostname()
109 status.Hostname = hostname
110
111 var cpuTR = tr.Begin("cpu")
112 this.updateCPU(status)
113 cpuTR.End()
114
115 var memTR = tr.Begin("memory")
116 this.updateMem(status)
117 memTR.End()
118
119 var loadTR = tr.Begin("load")
120 this.updateLoad(status)
121 loadTR.End()
122
123 var diskTR = tr.Begin("disk")
124 this.updateDisk(status)
125 diskTR.End()
126
127 var cacheSpaceTR = tr.Begin("cache space")
128 this.updateCacheSpace(status)
129 cacheSpaceTR.End()

Callers 1

ListenMethod · 0.95

Calls 15

updateCPUMethod · 0.95
updateMemMethod · 0.95
updateLoadMethod · 0.95
updateDiskMethod · 0.95
updateCacheSpaceMethod · 0.95
updateAllTrafficMethod · 0.95
BeginFunction · 0.92
VersionToLongFunction · 0.92
FirewallFunction · 0.92
ErrorFunction · 0.92
SharedRPCFunction · 0.92
IsConnErrorFunction · 0.92

Tested by

no test coverage detected