diff --git a/dom/security/metrics.yaml b/dom/security/metrics.yaml index 4952905b828f..506bc052cb66 100644 --- a/dom/security/metrics.yaml +++ b/dom/security/metrics.yaml @@ -438,6 +438,51 @@ security: expires: never telemetry_mirror: HTTPS_ONLY_MODE_UPGRADE_TIME_MS + https_only_mode_upgrade_type: + type: dual_labeled_counter + description: > + What content type did we upgrade, and did it load successfully? + + This metric was generated to correspond to the Legacy Telemetry boolean + histogram HTTPS_ONLY_MODE_UPGRADE_TYPE. + dual_labels: + key: + labels: + - "unknown" + - "audio" + - "video" + - "script" + - "object" + - "document" + - "subdocument" + - "xmlhttprequest" + - "image" + - "dtd" + - "font" + - "fetch" + - "websocket" + - "stylesheet" + - "cspreport" + - "webmanifest" + - "ping" + - "xslt" + - "proxied-webrtc" + description: External content policy type. + category: + labels: + - "false" + - "true" + description: Boolean + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1675533 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1675533 + notification_emails: + - seceng-telemetry@mozilla.com + - julianwels@mozilla.com + expires: never + telemetry_mirror: HTTPS_ONLY_MODE_UPGRADE_TYPE + referrer_policy_count: type: custom_distribution description: > diff --git a/dom/security/nsHTTPSOnlyStreamListener.cpp b/dom/security/nsHTTPSOnlyStreamListener.cpp index 584b9a04e025..50cf1055ec1d 100644 --- a/dom/security/nsHTTPSOnlyStreamListener.cpp +++ b/dom/security/nsHTTPSOnlyStreamListener.cpp @@ -6,7 +6,6 @@ #include "NSSErrorsService.h" #include "mozilla/glean/DomSecurityMetrics.h" -#include "mozilla/Telemetry.h" #include "mozilla/TimeStamp.h" #include "mozilla/dom/WindowGlobalParent.h" #include "mozpkix/pkixnss.h" @@ -244,8 +243,9 @@ void nsHTTPSOnlyStreamListener::RecordUpgradeTelemetry(nsIRequest* request, // Needs bug 1657470 (New Metric Type: "Keyed Categorical") before // this can be migrated to Glean. - mozilla::Telemetry::Accumulate( - mozilla::Telemetry::HTTPS_ONLY_MODE_UPGRADE_TYPE, typeKey, success); + mozilla::glean::security::https_only_mode_upgrade_type + .Get(typeKey, success ? "true"_ns : "false"_ns) + .Add(); } void nsHTTPSOnlyStreamListener::LogUpgradeFailure(nsIRequest* request,