Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
Add webview fail telemetry (#3968)
Browse files Browse the repository at this point in the history
* Add webview fail telemetry

* Fix todo

* Update focus-ios/Blockzilla/metrics.yaml

Co-authored-by: Daniela Arcese <[email protected]>

---------

Co-authored-by: Nishant Bhasin <[email protected]>
Co-authored-by: Daniela Arcese <[email protected]>
  • Loading branch information
3 people authored Jan 4, 2024
1 parent bb2777a commit 875e46d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ focus-ios/focus-ios-tests/tools/Localizations

# Glean
.venv/
Blockzilla/Generated
focus-ios/Blockzilla/Generated

import-strings.log
export-strings.log
Expand Down
5 changes: 5 additions & 0 deletions focus-ios/Blockzilla/Modules/WebView/WebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import WebKit
import Telemetry
import PassKit
import Combine
import Glean

protocol BrowserState {
var url: URL? { get }
Expand Down Expand Up @@ -390,10 +391,14 @@ extension WebViewController: WKNavigationDelegate {
}

func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
GleanMetrics.Webview.fail.record()

delegate?.webController(self, didFailNavigationWithError: error)
}

func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
GleanMetrics.Webview.failProvisional.record()

let error = error as NSError
guard error.code != Int(CFNetworkErrors.cfurlErrorCancelled.rawValue), let errorUrl = error.userInfo[NSURLErrorFailingURLErrorKey] as? URL else { return }
let errorPageData = ErrorPage(error: error).data
Expand Down
24 changes: 24 additions & 0 deletions focus-ios/Blockzilla/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -754,3 +754,27 @@ search:
- baseline
no_lint:
- BASELINE_PING

webview:
fail_provisional:
type: event
description: |
Recorded when an error occurs on early webview navigation.
bugs:
- https://github.com/mozilla-mobile/firefox-ios/issues/17716
data_reviews:
- https://github.com/mozilla-mobile/focus-ios/pull/3968
notification_emails:
- [email protected]
expires: never
fail:
type: event
description: |
Recorded when an error occurred during navigation.
bugs:
- https://github.com/mozilla-mobile/firefox-ios/issues/17716
data_reviews:
- https://github.com/mozilla-mobile/focus-ios/pull/3968
notification_emails:
- [email protected]
expires: never

0 comments on commit 875e46d

Please sign in to comment.