Explorar el Código

switch server load log style to use underscores instead of camel case (to be more consistent with other logging)

Michael Goldberger hace 9 años
padre
commit
21005af761
Se han modificado 2 ficheros con 24 adiciones y 24 borrados
  1. 12 12
      psiphon/server/services.go
  2. 12 12
      psiphon/server/tunnelServer.go

+ 12 - 12
psiphon/server/services.go

@@ -266,18 +266,18 @@ func logServerLoad(server *TunnelServer) {
 	var memStats runtime.MemStats
 	runtime.ReadMemStats(&memStats)
 	fields := LogFields{
-		"event_name":   "server_load",
-		"BuildRev":     common.GetBuildInfo().BuildRev,
-		"HostID":       server.sshServer.support.Config.HostID,
-		"NumGoroutine": runtime.NumGoroutine(),
-		"MemStats": map[string]interface{}{
-			"Alloc":         memStats.Alloc,
-			"TotalAlloc":    memStats.TotalAlloc,
-			"Sys":           memStats.Sys,
-			"PauseTotalNs":  memStats.PauseTotalNs,
-			"PauseNs":       memStats.PauseNs,
-			"NumGC":         memStats.NumGC,
-			"GCCPUFraction": memStats.GCCPUFraction,
+		"event_name":    "server_load",
+		"build_rev":     common.GetBuildInfo().BuildRev,
+		"host_id":       server.sshServer.support.Config.HostID,
+		"num_goroutine": runtime.NumGoroutine(),
+		"mem_stats": map[string]interface{}{
+			"alloc":           memStats.Alloc,
+			"total_alloc":     memStats.TotalAlloc,
+			"sys":             memStats.Sys,
+			"pause_total_ns":  memStats.PauseTotalNs,
+			"pause_ns":        memStats.PauseNs,
+			"num_gc":          memStats.NumGC,
+			"gc_cpu_fraction": memStats.GCCPUFraction,
 		},
 	}
 

+ 12 - 12
psiphon/server/tunnelServer.go

@@ -389,28 +389,28 @@ func (sshServer *sshServer) getLoadStats() map[string]map[string]int64 {
 
 	for tunnelProtocol, _ := range sshServer.support.Config.TunnelProtocolPorts {
 		loadStats[tunnelProtocol] = make(map[string]int64)
-		loadStats[tunnelProtocol]["AcceptedClients"] = 0
-		loadStats[tunnelProtocol]["EstablishedClients"] = 0
-		loadStats[tunnelProtocol]["TCPPortForwards"] = 0
-		loadStats[tunnelProtocol]["TotalTCPPortForwards"] = 0
-		loadStats[tunnelProtocol]["UDPPortForwards"] = 0
-		loadStats[tunnelProtocol]["TotalUDPPortForwards"] = 0
+		loadStats[tunnelProtocol]["accepted_clients"] = 0
+		loadStats[tunnelProtocol]["established_clients"] = 0
+		loadStats[tunnelProtocol]["tcp_port_forwards"] = 0
+		loadStats[tunnelProtocol]["total_tcp_port_forwards"] = 0
+		loadStats[tunnelProtocol]["udp_port_forwards"] = 0
+		loadStats[tunnelProtocol]["total_udp_port_forwards"] = 0
 	}
 
 	// Note: as currently tracked/counted, each established client is also an accepted client
 
 	for tunnelProtocol, acceptedClientCount := range sshServer.acceptedClientCounts {
-		loadStats[tunnelProtocol]["AcceptedClients"] = acceptedClientCount
+		loadStats[tunnelProtocol]["accepted_clients"] = acceptedClientCount
 	}
 
 	for _, client := range sshServer.clients {
 		// Note: can't sum trafficState.peakConcurrentPortForwardCount to get a global peak
-		loadStats[client.tunnelProtocol]["EstablishedClients"] += 1
+		loadStats[client.tunnelProtocol]["established_clients"] += 1
 		client.Lock()
-		loadStats[client.tunnelProtocol]["TCPPortForwards"] += client.tcpTrafficState.concurrentPortForwardCount
-		loadStats[client.tunnelProtocol]["TotalTCPPortForwards"] += client.tcpTrafficState.totalPortForwardCount
-		loadStats[client.tunnelProtocol]["UDPPortForwards"] += client.udpTrafficState.concurrentPortForwardCount
-		loadStats[client.tunnelProtocol]["TotalUDPPortForwards"] += client.udpTrafficState.totalPortForwardCount
+		loadStats[client.tunnelProtocol]["tcp_port_forwards"] += client.tcpTrafficState.concurrentPortForwardCount
+		loadStats[client.tunnelProtocol]["total_tcp_port_forwards"] += client.tcpTrafficState.totalPortForwardCount
+		loadStats[client.tunnelProtocol]["udp_port_forwards"] += client.udpTrafficState.concurrentPortForwardCount
+		loadStats[client.tunnelProtocol]["total_udp_port_forwards"] += client.udpTrafficState.totalPortForwardCount
 		client.Unlock()
 	}