Преглед изворни кода

Record establishment_duration stat

Rod Hynes пре 9 година
родитељ
комит
63602d98ae
1 измењених фајлова са 12 додато и 1 уклоњено
  1. 12 1
      psiphon/server/api.go

+ 12 - 1
psiphon/server/api.go

@@ -307,6 +307,17 @@ func statusAPIRequestHandler(
 			}
 			}
 			sessionFields["tunnel_server_ip_address"] = tunnelServerIPAddress
 			sessionFields["tunnel_server_ip_address"] = tunnelServerIPAddress
 
 
+			strEstablishmentDuration, err := getStringRequestParam(tunnelStat, "establishment_duration")
+			if err != nil {
+				return nil, common.ContextError(err)
+			}
+			establishmentDuration, err := strconv.ParseInt(strEstablishmentDuration, 10, 64)
+			if err != nil {
+				return nil, common.ContextError(err)
+			}
+			// Client reports establishment_duration in nanoseconds; divide to get to milliseconds
+			sessionFields["establishment_duration"] = establishmentDuration / 1000000
+
 			serverHandshakeTimestamp, err := getStringRequestParam(tunnelStat, "server_handshake_timestamp")
 			serverHandshakeTimestamp, err := getStringRequestParam(tunnelStat, "server_handshake_timestamp")
 			if err != nil {
 			if err != nil {
 				return nil, common.ContextError(err)
 				return nil, common.ContextError(err)
@@ -321,7 +332,7 @@ func statusAPIRequestHandler(
 			if err != nil {
 			if err != nil {
 				return nil, common.ContextError(err)
 				return nil, common.ContextError(err)
 			}
 			}
-			// Client reports durations in nanoseconds; divide to get to milliseconds
+			// Client reports duration in nanoseconds; divide to get to milliseconds
 			sessionFields["duration"] = duration / 1000000
 			sessionFields["duration"] = duration / 1000000
 
 
 			totalBytesSent, err := getInt64RequestParam(tunnelStat, "total_bytes_sent")
 			totalBytesSent, err := getInt64RequestParam(tunnelStat, "total_bytes_sent")