# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# Adding a new metric? We have docs for that!
# https://firefox-source-docs.mozilla.org/toolkit/components/glean/user/new_definitions_file.html

---
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0
$tags:
  - 'Core :: DOM: Navigation'

performance.page:
  total_content_page_load:
    type: timing_distribution
    time_unit: millisecond
    description: >
      Time to load all of a page's resources and render.
      (Migrated from the geckoview metric of the same name.)
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1580077
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1877842
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1580077#c10
    notification_emails:
      - perf-telemetry-alerts@mozilla.com
      - bdekoz@mozilla.com
    expires: never

bfcache:
  combo:
    type: labeled_counter
    description: >
      The common combinations of BFCacheStatus when we determine whether the
      page can be BFCached or not; If it's BFCached, we record BFCache_Success;
      Success_Not_Toplevel represents the number of not the only top level
      document in BrowsingContextGroup's documents that are BFCached, and
      BFCache_Success includes Success_Not_Toplevel; If it's not and it falls
      under common failure reasons combinations, we record the corresponding
      combination; Otherwise, we record Other to indicate this is not a common
      failure

      This metric was generated to correspond to the Legacy Telemetry
      categorical histogram BFCACHE_COMBO.
    labels:
      - BFCache_Success
      - Success_Not_Toplevel
      - Unload
      - Unload_Req
      - Req
      - Unload_Req_Peer
      - Unload_Req_Peer_MSE
      - Unload_Req_MSE
      - SPD_Unload_Req_Peer
      - Remote_Subframes
      - Beforeunload
      - Other
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1531917
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1531917
    notification_emails:
      - sefeng@mozilla.com
    expires: never
    telemetry_mirror: h#BFCACHE_COMBO

  page_restored:
    type: labeled_counter
    description: >
      Whether bfcache is used when loading a page from session history.
      This metric was disabled between bugs 1892551 and 2037998, so the data
      may have discontinuities over that period.

      This metric was generated to correspond to the Legacy Telemetry boolean
      histogram BFCACHE_PAGE_RESTORED.
    labels:
      - "false"
      - "true"
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1531917
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1551935
      - https://bugzilla.mozilla.org/show_bug.cgi?id=2037998
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1531917
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1551935
      - https://bugzilla.mozilla.org/show_bug.cgi?id=2037998
    notification_emails:
      - sefeng@mozilla.com
      - avandolder@mozilla.com
    expires: never

page:
  load_error:
    type: dual_labeled_counter
    description: >
      Page load errors. Match values with type of error in
      nsDocShellTelemetryUtils.cpp

      This metric was generated to correspond to the Legacy Telemetry
      categorical histogram PAGE_LOAD_ERROR.
    dual_labels:
      key:
        description: Is the error for a subframe or a top level document?
          PAGE_LOAD_ERROR.
        labels:
          - top
          - frame
      category:
        labels:
          - UNKNOWN_PROTOCOL
          - FILE_NOT_FOUND
          - FILE_ACCESS_DENIED
          - UNKNOWN_HOST
          - CONNECTION_REFUSED
          - PROXY_BAD_GATEWAY
          - NET_INTERRUPT
          - NET_TIMEOUT
          - P_GATEWAY_TIMEOUT
          - CSP_FRAME_ANCEST
          - CSP_FORM_ACTION
          - CSP_NAVIGATE_TO
          - XFO_VIOLATION
          - PHISHING_URI
          - MALWARE_URI
          - UNWANTED_URI
          - HARMFUL_URI
          - CONTENT_CRASHED
          - FRAME_CRASHED
          - BUILDID_MISMATCH
          - NET_RESET
          - MALFORMED_URI
          - REDIRECT_LOOP
          - UNKNOWN_SOCKET
          - DOCUMENT_N_CACHED
          - OFFLINE
          - DOC_PRINTMODE
          - PORT_ACCESS
          - UNKNOWN_PROXY_HOST
          - PROXY_CONNECTION
          - PROXY_FORBIDDEN
          - P_NOT_IMPLEMENTED
          - PROXY_AUTH
          - PROXY_TOO_MANY
          - CONTENT_ENCODING
          - REMOTE_XUL
          - UNSAFE_CONTENT
          - CORRUPTED_CONTENT
          - INTERCEPTION_FAIL
          - INADEQUATE_SEC
          - BLOCKED_BY_POLICY
          - HTTP2_SENT_GOAWAY
          - HTTP3_PROTOCOL
          - BINDING_FAILED
          - otherError
        description: Labels of the keyed categorical legacy telemetry histogram
          PAGE_LOAD_ERROR.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1636962
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1636962
    notification_emails:
      - seceng-telemetry@mozilla.com
    expires: never
    telemetry_mirror: PAGE_LOAD_ERROR

urlfixup:
  suffix:
    type: dual_labeled_counter
    description: >
      Counts how often a .com or other localized suffix is appended to a URL
      as a result of pressing ctrl/cmd + enter in the URL bar.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1463540
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1463540
    notification_emails:
      - eemeli@mozilla.com
    expires: 158
    dual_labels:
      key:
        description: Where the fixup happened
        labels:
          - fixup
          - smartbar
          - urlbar
      category:
        description: The added URL suffix
