Skip to content

Commit

Permalink
feat(minipipeline): add DNS and HTTP unexplained failures (#1453)
Browse files Browse the repository at this point in the history
We need to know about all possible unexplained failures. With this
information and information about ControlFinalResponseExpectations
introduced in #1451 and #1452, we are able to transform unexplained
failures (i.e., failures occurring during redirects) into explained
failures when we have a control-based expectation to compare to.

Part of ooni/probe#2640
  • Loading branch information
bassosimone committed Jan 19, 2024
1 parent 64255d5 commit bdb519d
Show file tree
Hide file tree
Showing 69 changed files with 167 additions and 7 deletions.
2 changes: 2 additions & 0 deletions internal/cmd/minipipeline/testdata/analysis.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
3
],
"DNSLookupUnexpectedFailure": [],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": null,
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -32,6 +33,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": null,
"HTTPFinalResponseSuccessTLSWithControl": 4,
"HTTPFinalResponseSuccessTCPWithoutControl": null,
Expand Down
2 changes: 2 additions & 0 deletions internal/cmd/minipipeline/testdata/analysis_classic.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
2
],
"DNSLookupUnexpectedFailure": [],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": null,
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -29,6 +30,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": null,
"HTTPFinalResponseSuccessTLSWithControl": 4,
"HTTPFinalResponseSuccessTCPWithoutControl": null,
Expand Down
33 changes: 26 additions & 7 deletions internal/minipipeline/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ type WebAnalysis struct {
// DNSLookupUnexpectedFailure contains DNS transactions with unexpected failures.
DNSLookupUnexpectedFailure Set[int64]

// DNSLookupUnexplainedFailure contains DNS transactions with unexplained failures (i.e.,
// failures for which there's no corresponding control information).
DNSLookupUnexplainedFailure Set[int64]

// DNSExperimentFailure is the first failure experienced by any resolver
// before hitting redirects (i.e., when TagDepth==0).
DNSExperimentFailure optional.Value[string]
Expand All @@ -169,7 +173,8 @@ type WebAnalysis struct {
// while checking for connectivity, as opposed to fetching a webpage.
TCPConnectUnexpectedFailureDuringConnectivityCheck Set[int64]

// TCPConnectUnexplainedFailure contains failures occurring during redirects.
// TCPConnectUnexplainedFailure contains failures occurring during redirects, i.e.,
// failures for which there's no corresponding control info.
TCPConnectUnexplainedFailure Set[int64]

// TCPConnectUnexplainedFailureDuringWebFetch contains failures occurring during redirects
Expand All @@ -191,7 +196,8 @@ type WebAnalysis struct {
// while checking for connectivity, as opposed to fetching a webpage.
TLSHandshakeUnexpectedFailureDuringConnectivityCheck Set[int64]

// TLSHandshakeUnexplainedFailure contains failures occurring during redirects.
// TLSHandshakeUnexplainedFailure contains failures occurring during redirects, i.e.,
// failures for which there's no corresponding control info.
TLSHandshakeUnexplainedFailure Set[int64]

// TLSHandshakeUnexplainedFailureDuringWebFetch contains failures occurring during redirects
Expand All @@ -205,6 +211,10 @@ type WebAnalysis struct {
// HTTPRoundTripUnexpectedFailure contains HTTP endpoint transactions with unexpected failures.
HTTPRoundTripUnexpectedFailure Set[int64]

// HTTPRoundTripUnexplainedFailure contains failures occurring during redirects, i.e.,
// failures for which there's no corresponding control info.
HTTPRoundTripUnexplainedFailure Set[int64]

// HTTPFinalResponseSuccessTLSWithoutControl contains the ID of the final response
// transaction when the final response succeeded without control and with TLS.
HTTPFinalResponseSuccessTLSWithoutControl optional.Value[int64]
Expand Down Expand Up @@ -356,11 +366,6 @@ func (wa *WebAnalysis) dnsComputeFailureMetrics(c *WebObservationsContainer) {
}
already.Add(obs.DNSTransactionID.Unwrap())

// lookups once we started following redirects should not be considered
if obs.TagDepth.IsNone() || obs.TagDepth.Unwrap() != 0 {
continue
}

// Implementation note: a DoH failure is not information about the URL we're
// measuring but about the DoH service being blocked.
//
Expand All @@ -377,6 +382,16 @@ func (wa *WebAnalysis) dnsComputeFailureMetrics(c *WebObservationsContainer) {
// TODO(bassosimone): if we set an IPv6 address as the resolver address, we
// end up with false positive errors when there's no IPv6 support

// lookups once we started following redirects does not have corresponding
// control information, so failures end up being unexplained
if obs.TagDepth.IsNone() || obs.TagDepth.Unwrap() != 0 {
if obs.DNSLookupFailure.Unwrap() != "" {
wa.DNSLookupUnexplainedFailure.Add(obs.DNSTransactionID.Unwrap())
continue
}
continue
}

// honor the DNSExperimentFailure by assigning the first
// probe error that we see with depth==0
if obs.DNSLookupFailure.Unwrap() != "" && wa.DNSExperimentFailure.IsNone() {
Expand Down Expand Up @@ -533,6 +548,10 @@ func (wa *WebAnalysis) httpComputeFailureMetrics(c *WebObservationsContainer) {

// handle the case where there is no control information
if obs.ControlHTTPFailure.IsNone() {
if obs.HTTPFailure.Unwrap() != "" {
wa.HTTPRoundTripUnexplainedFailure.Add(obs.EndpointTransactionID.Unwrap())
continue
}
continue
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
2
],
"DNSLookupUnexpectedFailure": [],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": null,
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -30,6 +31,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": null,
"HTTPFinalResponseSuccessTLSWithControl": null,
"HTTPFinalResponseSuccessTCPWithoutControl": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
1
],
"DNSLookupUnexpectedFailure": [],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": null,
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -28,6 +29,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": null,
"HTTPFinalResponseSuccessTLSWithControl": null,
"HTTPFinalResponseSuccessTCPWithoutControl": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
3
],
"DNSLookupUnexpectedFailure": [],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": null,
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -32,6 +33,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": null,
"HTTPFinalResponseSuccessTLSWithControl": null,
"HTTPFinalResponseSuccessTCPWithoutControl": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
1
],
"DNSLookupUnexpectedFailure": [],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": null,
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -28,6 +29,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": null,
"HTTPFinalResponseSuccessTLSWithControl": null,
"HTTPFinalResponseSuccessTCPWithoutControl": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
],
"DNSLookupSuccessWithValidAddressClassic": [],
"DNSLookupUnexpectedFailure": [],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": null,
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -30,6 +31,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": null,
"HTTPFinalResponseSuccessTLSWithControl": 4,
"HTTPFinalResponseSuccessTCPWithoutControl": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
],
"DNSLookupSuccessWithValidAddressClassic": [],
"DNSLookupUnexpectedFailure": [],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": null,
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -28,6 +29,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": null,
"HTTPFinalResponseSuccessTLSWithControl": null,
"HTTPFinalResponseSuccessTCPWithoutControl": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
2
],
"DNSLookupUnexpectedFailure": [],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": null,
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -30,6 +31,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": null,
"HTTPFinalResponseSuccessTLSWithControl": null,
"HTTPFinalResponseSuccessTCPWithoutControl": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
1
],
"DNSLookupUnexpectedFailure": [],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": null,
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -28,6 +29,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": null,
"HTTPFinalResponseSuccessTLSWithControl": null,
"HTTPFinalResponseSuccessTCPWithoutControl": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"DNSLookupSuccessWithInvalidAddressesClassic": [],
"DNSLookupSuccessWithValidAddressClassic": [],
"DNSLookupUnexpectedFailure": [],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": null,
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -24,6 +25,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": 3,
"HTTPFinalResponseSuccessTLSWithControl": null,
"HTTPFinalResponseSuccessTCPWithoutControl": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"DNSLookupSuccessWithInvalidAddressesClassic": [],
"DNSLookupSuccessWithValidAddressClassic": [],
"DNSLookupUnexpectedFailure": [],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": null,
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -24,6 +25,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": 3,
"HTTPFinalResponseSuccessTLSWithControl": null,
"HTTPFinalResponseSuccessTCPWithoutControl": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"DNSLookupSuccessWithInvalidAddressesClassic": [],
"DNSLookupSuccessWithValidAddressClassic": [],
"DNSLookupUnexpectedFailure": [],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": null,
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -24,6 +25,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": null,
"HTTPFinalResponseSuccessTLSWithControl": null,
"HTTPFinalResponseSuccessTCPWithoutControl": 3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"DNSLookupSuccessWithInvalidAddressesClassic": [],
"DNSLookupSuccessWithValidAddressClassic": [],
"DNSLookupUnexpectedFailure": [],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": null,
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -22,6 +23,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": null,
"HTTPFinalResponseSuccessTLSWithControl": null,
"HTTPFinalResponseSuccessTCPWithoutControl": 3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"DNSLookupUnexpectedFailure": [
1
],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": "android_dns_cache_no_data",
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -30,6 +31,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": null,
"HTTPFinalResponseSuccessTLSWithControl": 3,
"HTTPFinalResponseSuccessTCPWithoutControl": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"DNSLookupUnexpectedFailure": [
1
],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": "android_dns_cache_no_data",
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -26,6 +27,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": null,
"HTTPFinalResponseSuccessTLSWithControl": null,
"HTTPFinalResponseSuccessTCPWithoutControl": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
2
],
"DNSLookupUnexpectedFailure": [],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": null,
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -34,6 +35,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": null,
"HTTPFinalResponseSuccessTLSWithControl": 3,
"HTTPFinalResponseSuccessTCPWithoutControl": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
],
"DNSLookupSuccessWithValidAddressClassic": [],
"DNSLookupUnexpectedFailure": [],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": null,
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -30,6 +31,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": null,
"HTTPFinalResponseSuccessTLSWithControl": null,
"HTTPFinalResponseSuccessTCPWithoutControl": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"DNSLookupUnexpectedFailure": [
2
],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": "dns_nxdomain_error",
"DNSLookupExpectedFailure": [],
"DNSLookupExpectedSuccess": [],
Expand All @@ -30,6 +31,7 @@
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": null,
"HTTPFinalResponseSuccessTLSWithControl": 3,
"HTTPFinalResponseSuccessTCPWithoutControl": null,
Expand Down
Loading

0 comments on commit bdb519d

Please sign in to comment.