Просмотр исходного кода

Record establishment_duration stat

Rod Hynes 9 лет назад
Родитель
Сommit
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
 
+			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")
 			if err != nil {
 				return nil, common.ContextError(err)
@@ -321,7 +332,7 @@ func statusAPIRequestHandler(
 			if err != nil {
 				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
 
 			totalBytesSent, err := getInt64RequestParam(tunnelStat, "total_bytes_sent")