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

Revert client_app_id metrics field

- client_platform parsing will continue to be done in aggregation
Rod Hynes 5 лет назад
Родитель
Сommit
5f086f5037
2 измененных файлов с 2 добавлено и 30 удалено
  1. 0 21
      psiphon/server/api.go
  2. 2 9
      psiphon/server/server_test.go

+ 0 - 21
psiphon/server/api.go

@@ -1035,27 +1035,6 @@ func getRequestLogFields(
 				// the field in this case.
 				// the field in this case.
 
 
 			default:
 			default:
-
-				// Add a distinct app ID field when the value is present in
-				// client_platform.
-				if expectedParam.name == "client_platform" {
-					index := -1
-					clientPlatform := strValue
-					if strings.HasPrefix(clientPlatform, "iOS") {
-						index = 3
-					} else if strings.HasPrefix(clientPlatform, "Android") {
-						index = 2
-						clientPlatform = strings.TrimSuffix(clientPlatform, "_playstore")
-						clientPlatform = strings.TrimSuffix(clientPlatform, "_rooted")
-					}
-					if index > 0 {
-						components := strings.Split(clientPlatform, "_")
-						if index < len(components) {
-							logFields["client_app_id"] = components[index]
-						}
-					}
-				}
-
 				if expectedParam.flags&requestParamLogStringAsInt != 0 {
 				if expectedParam.flags&requestParamLogStringAsInt != 0 {
 					intValue, _ := strconv.Atoi(strValue)
 					intValue, _ := strconv.Atoi(strValue)
 					logFields[expectedParam.name] = intValue
 					logFields[expectedParam.name] = intValue

+ 2 - 9
psiphon/server/server_test.go

@@ -544,7 +544,6 @@ var (
 	testSSHClientVersions = []string{"SSH-2.0-A", "SSH-2.0-B", "SSH-2.0-C"}
 	testSSHClientVersions = []string{"SSH-2.0-A", "SSH-2.0-B", "SSH-2.0-C"}
 	testUserAgents        = []string{"ua1", "ua2", "ua3"}
 	testUserAgents        = []string{"ua1", "ua2", "ua3"}
 	testNetworkType       = "WIFI"
 	testNetworkType       = "WIFI"
-	testAppID             = "com.test.app"
 )
 )
 
 
 var serverRuns = 0
 var serverRuns = 0
@@ -827,7 +826,7 @@ func runServer(t *testing.T, runConfig *runServerConfig) {
 
 
 	clientConfigJSON := fmt.Sprintf(`
 	clientConfigJSON := fmt.Sprintf(`
     {
     {
-        "ClientPlatform" : "Android_10_%s",
+        "ClientPlatform" : "Android_10_com.test.app",
         "ClientVersion" : "0",
         "ClientVersion" : "0",
         "SponsorId" : "0",
         "SponsorId" : "0",
         "PropagationChannelId" : "0",
         "PropagationChannelId" : "0",
@@ -839,7 +838,7 @@ func runServer(t *testing.T, runConfig *runServerConfig) {
         "LimitTunnelProtocols" : ["%s"]
         "LimitTunnelProtocols" : ["%s"]
         %s
         %s
         %s
         %s
-    }`, testAppID, numTunnels, runConfig.tunnelProtocol, jsonLimitTLSProfiles, jsonNetworkID)
+    }`, numTunnels, runConfig.tunnelProtocol, jsonLimitTLSProfiles, jsonNetworkID)
 
 
 	clientConfig, err := psiphon.LoadConfig([]byte(clientConfigJSON))
 	clientConfig, err := psiphon.LoadConfig([]byte(clientConfigJSON))
 	if err != nil {
 	if err != nil {
@@ -1222,7 +1221,6 @@ func checkExpectedServerTunnelLogFields(
 		"established_tunnels_count",
 		"established_tunnels_count",
 		"network_latency_multiplier",
 		"network_latency_multiplier",
 		"network_type",
 		"network_type",
-		"client_app_id",
 	} {
 	} {
 		if fields[name] == nil || fmt.Sprintf("%s", fields[name]) == "" {
 		if fields[name] == nil || fmt.Sprintf("%s", fields[name]) == "" {
 			return fmt.Errorf("missing expected field '%s'", name)
 			return fmt.Errorf("missing expected field '%s'", name)
@@ -1374,10 +1372,6 @@ func checkExpectedServerTunnelLogFields(
 		return fmt.Errorf("unexpected network_type '%s'", fields["network_type"])
 		return fmt.Errorf("unexpected network_type '%s'", fields["network_type"])
 	}
 	}
 
 
-	if fields["client_app_id"].(string) != testAppID {
-		return fmt.Errorf("unexpected client_app_id '%s'", fields["client_app_id"])
-	}
-
 	return nil
 	return nil
 }
 }
 
 
@@ -1393,7 +1387,6 @@ func checkExpectedUniqueUserLogFields(
 		"client_platform",
 		"client_platform",
 		"tunnel_whole_device",
 		"tunnel_whole_device",
 		"device_region",
 		"device_region",
-		"client_app_id",
 	} {
 	} {
 		if fields[name] == nil || fmt.Sprintf("%s", fields[name]) == "" {
 		if fields[name] == nil || fmt.Sprintf("%s", fields[name]) == "" {
 			return fmt.Errorf("missing expected field '%s'", name)
 			return fmt.Errorf("missing expected field '%s'", name)