mirror of
https://github.com/torproject/metrics-lib.git
synced 2025-02-16 23:37:33 +00:00
Include previously unknown error codes in Torperf results.
As discussed on #34031, we should avoid keeping a map of known failure types in the sources and simply put together the error code in the format we want. This patch implements that change.
This commit is contained in:
parent
95771bfb9f
commit
afc57a6120
@ -1,5 +1,9 @@
|
||||
# Changes in version 2.??.? - 2020-??-??
|
||||
|
||||
* Minor changes
|
||||
- Include previously unknown error codes in Torperf results
|
||||
converted from OnionPerf analysis files.
|
||||
|
||||
|
||||
# Changes in version 2.12.2 - 2020-04-30
|
||||
|
||||
|
@ -127,18 +127,6 @@ public class OnionPerfAnalysisConverter {
|
||||
private StringBuilder formatTorperfResults(
|
||||
ParsedOnionPerfAnalysis parsedOnionPerfAnalysis) {
|
||||
StringBuilder formattedTorperfResults = new StringBuilder();
|
||||
Map<String, String> errorCodes = new HashMap<>();
|
||||
errorCodes.put("AUTH", "TGEN/AUTH");
|
||||
errorCodes.put("READ", "TGEN/READ");
|
||||
errorCodes.put("STALLOUT", "TGEN/STALLOUT");
|
||||
errorCodes.put("TIMEOUT", "TGEN/TIMEOUT");
|
||||
errorCodes.put("PROXY", "TOR");
|
||||
errorCodes.put("PROXY_CANT_ATTACH", "TOR/CANT_ATTACH");
|
||||
errorCodes.put("PROXY_DESTROY", "TOR/DESTROY");
|
||||
errorCodes.put("PROXY_END_TIMEOUT", "TOR/END/TIMEOUT");
|
||||
errorCodes.put("PROXY_END_CONNECTREFUSED", "TOR/END/CONNECTREFUSED");
|
||||
errorCodes.put("PROXY_RESOLVEFAILED", "TOR/RESOLVEFAILED");
|
||||
errorCodes.put("PROXY_TIMEOUT", "TOR/TIMEOUT");
|
||||
for (Map.Entry<String, ParsedOnionPerfAnalysis.MeasurementData> data
|
||||
: parsedOnionPerfAnalysis.data.entrySet()) {
|
||||
String nickname = data.getKey();
|
||||
@ -183,7 +171,12 @@ public class OnionPerfAnalysisConverter {
|
||||
List<String> errorCodeParts = null;
|
||||
if (transfer.isError) {
|
||||
errorCodeParts = new ArrayList<>();
|
||||
errorCodeParts.add(transfer.errorCode);
|
||||
if ("PROXY".equals(transfer.errorCode)) {
|
||||
errorCodeParts.add("TOR");
|
||||
} else {
|
||||
errorCodeParts.add("TGEN");
|
||||
errorCodeParts.add(transfer.errorCode);
|
||||
}
|
||||
}
|
||||
String sourcePort = endpointLocalParts[2];
|
||||
if (streamsBySourcePort.containsKey(sourcePort)) {
|
||||
@ -207,9 +200,8 @@ public class OnionPerfAnalysisConverter {
|
||||
}
|
||||
}
|
||||
if (null != errorCodeParts) {
|
||||
String errorCode = String.join("_", errorCodeParts);
|
||||
torperfResultsBuilder.addString("ERRORCODE",
|
||||
errorCodes.getOrDefault(errorCode, errorCode));
|
||||
String errorCode = String.join("/", errorCodeParts);
|
||||
torperfResultsBuilder.addString("ERRORCODE", errorCode);
|
||||
}
|
||||
formattedTorperfResults.append(torperfResultsBuilder.build());
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class OnionPerfAnalysisConverterTest {
|
||||
+ "ENDPOINTLOCAL=localhost:127.0.0.1:40948 "
|
||||
+ "ENDPOINTPROXY=localhost:127.0.0.1:35900 "
|
||||
+ "ENDPOINTREMOTE=37.218.245.95:37.218.245.95:443 "
|
||||
+ "ERRORCODE=PROXY_END_MISC FILESIZE=51200 HOSTNAMELOCAL=op-nl2 "
|
||||
+ "ERRORCODE=TOR/END/MISC FILESIZE=51200 HOSTNAMELOCAL=op-nl2 "
|
||||
+ "HOSTNAMEREMOTE=(null) LAUNCH=1587991454.80 NEGOTIATE=1587991580.81 "
|
||||
+ "PATH=$12CF6DB4DAE106206D6C6B09988E865C0509843B,"
|
||||
+ "$1DC17C4A52A458B5C8B1E79157F8665696210E10,"
|
||||
|
Loading…
x
Reference in New Issue
Block a user