Bug 1960567 - Migrate histograms to use Glean APIs in dom/security/, r=chutten.

Differential Revision: https://phabricator.services.mozilla.com/D255548
This commit is contained in:
Florian Quèze 2025-07-08 13:35:10 +00:00 committed by fqueze@mozilla.com
parent 00313a80b6
commit e921a2f40b
2 changed files with 48 additions and 3 deletions

View file

@ -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: >

View file

@ -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,