Bug 1935420 - Migrate histograms to use Glean APIs in toolkit/components/reputationservice, r=chutten.
Differential Revision: https://phabricator.services.mozilla.com/D233764
This commit is contained in:
@@ -70,6 +70,7 @@ gecko_metrics = [
|
||||
"toolkit/components/printing/metrics.yaml",
|
||||
"toolkit/components/processtools/metrics.yaml",
|
||||
"toolkit/components/reader/metrics.yaml",
|
||||
"toolkit/components/reputationservice/metrics.yaml",
|
||||
"toolkit/components/resistfingerprinting/metrics.yaml",
|
||||
"toolkit/components/startup/metrics.yaml",
|
||||
"toolkit/components/translations/metrics.yaml",
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/glean/ReputationserviceMetrics.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/intl/LocaleService.h"
|
||||
@@ -65,7 +66,6 @@ using mozilla::OriginAttributes;
|
||||
using mozilla::Preferences;
|
||||
using mozilla::TimeStamp;
|
||||
using mozilla::intl::LocaleService;
|
||||
using mozilla::Telemetry::Accumulate;
|
||||
using mozilla::Telemetry::AccumulateCategorical;
|
||||
using safe_browsing::ClientDownloadRequest;
|
||||
using safe_browsing::ClientDownloadRequest_CertificateChain;
|
||||
@@ -866,7 +866,8 @@ PendingDBLookup::HandleEvent(const nsACString& tables) {
|
||||
if ((mLookupType != LookupType::AllowlistOnly) &&
|
||||
FindInReadable(blockList, tables)) {
|
||||
mPendingLookup->mBlocklistCount++;
|
||||
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_LOCAL, BLOCK_LIST);
|
||||
mozilla::glean::application_reputation::local.AccumulateSingleSample(
|
||||
BLOCK_LIST);
|
||||
LOG(("Found principal %s on blocklist [this = %p]", mSpec.get(), this));
|
||||
return mPendingLookup->OnComplete(
|
||||
nsIApplicationReputationService::VERDICT_DANGEROUS,
|
||||
@@ -878,14 +879,15 @@ PendingDBLookup::HandleEvent(const nsACString& tables) {
|
||||
if ((mLookupType != LookupType::BlocklistOnly) &&
|
||||
FindInReadable(allowList, tables)) {
|
||||
mPendingLookup->mAllowlistCount++;
|
||||
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_LOCAL, ALLOW_LIST);
|
||||
mozilla::glean::application_reputation::local.AccumulateSingleSample(
|
||||
ALLOW_LIST);
|
||||
LOG(("Found principal %s on allowlist [this = %p]", mSpec.get(), this));
|
||||
// Don't call onComplete, since blocklisting trumps allowlisting
|
||||
return mPendingLookup->LookupNext();
|
||||
}
|
||||
|
||||
LOG(("Didn't find principal %s on any list [this = %p]", mSpec.get(), this));
|
||||
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_LOCAL, NO_LIST);
|
||||
mozilla::glean::application_reputation::local.AccumulateSingleSample(NO_LIST);
|
||||
return mPendingLookup->LookupNext();
|
||||
}
|
||||
|
||||
@@ -1054,49 +1056,58 @@ nsresult PendingLookup::LookupNext() {
|
||||
|
||||
if (!mFileName.IsEmpty()) {
|
||||
if (IsBinary(mFileName)) {
|
||||
AccumulateCategorical(
|
||||
mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_BINARY_TYPE::
|
||||
BinaryFile);
|
||||
mozilla::glean::application_reputation::binary_type
|
||||
.EnumGet(mozilla::glean::application_reputation::BinaryTypeLabel::
|
||||
eBinaryfile)
|
||||
.Add();
|
||||
} else if (IsFileType(mFileName, kSafeFileExtensions,
|
||||
std::size(kSafeFileExtensions))) {
|
||||
AccumulateCategorical(
|
||||
mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_BINARY_TYPE::
|
||||
NonBinaryFile);
|
||||
mozilla::glean::application_reputation::binary_type
|
||||
.EnumGet(mozilla::glean::application_reputation::BinaryTypeLabel::
|
||||
eNonbinaryfile)
|
||||
.Add();
|
||||
} else if (IsFileType(mFileName, kMozNonBinaryExecutables,
|
||||
std::size(kMozNonBinaryExecutables))) {
|
||||
AccumulateCategorical(
|
||||
mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_BINARY_TYPE::
|
||||
MozNonBinaryFile);
|
||||
mozilla::glean::application_reputation::binary_type
|
||||
.EnumGet(mozilla::glean::application_reputation::BinaryTypeLabel::
|
||||
eMoznonbinaryfile)
|
||||
.Add();
|
||||
} else {
|
||||
AccumulateCategorical(
|
||||
mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_BINARY_TYPE::
|
||||
UnknownFile);
|
||||
mozilla::glean::application_reputation::binary_type
|
||||
.EnumGet(mozilla::glean::application_reputation::BinaryTypeLabel::
|
||||
eUnknownfile)
|
||||
.Add();
|
||||
}
|
||||
} else {
|
||||
AccumulateCategorical(
|
||||
mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_BINARY_TYPE::
|
||||
MissingFilename);
|
||||
mozilla::glean::application_reputation::binary_type
|
||||
.EnumGet(mozilla::glean::application_reputation::BinaryTypeLabel::
|
||||
eMissingfilename)
|
||||
.Add();
|
||||
}
|
||||
|
||||
if (IsFileType(mFileName, kDmgFileExtensions,
|
||||
std::size(kDmgFileExtensions))) {
|
||||
AccumulateCategorical(
|
||||
mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_BINARY_ARCHIVE::
|
||||
DmgFile);
|
||||
mozilla::glean::application_reputation::binary_archive
|
||||
.EnumGet(mozilla::glean::application_reputation::BinaryArchiveLabel::
|
||||
eDmgfile)
|
||||
.Add();
|
||||
} else if (IsFileType(mFileName, kRarFileExtensions,
|
||||
std::size(kRarFileExtensions))) {
|
||||
AccumulateCategorical(
|
||||
mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_BINARY_ARCHIVE::
|
||||
RarFile);
|
||||
mozilla::glean::application_reputation::binary_archive
|
||||
.EnumGet(mozilla::glean::application_reputation::BinaryArchiveLabel::
|
||||
eRarfile)
|
||||
.Add();
|
||||
} else if (IsFileType(mFileName, kZipFileExtensions,
|
||||
std::size(kZipFileExtensions))) {
|
||||
AccumulateCategorical(
|
||||
mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_BINARY_ARCHIVE::
|
||||
ZipFile);
|
||||
mozilla::glean::application_reputation::binary_archive
|
||||
.EnumGet(mozilla::glean::application_reputation::BinaryArchiveLabel::
|
||||
eZipfile)
|
||||
.Add();
|
||||
} else if (mIsBinaryFile) {
|
||||
AccumulateCategorical(
|
||||
mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_BINARY_ARCHIVE::
|
||||
OtherBinaryFile);
|
||||
mozilla::glean::application_reputation::binary_archive
|
||||
.EnumGet(mozilla::glean::application_reputation::BinaryArchiveLabel::
|
||||
eOtherbinaryfile)
|
||||
.Add();
|
||||
}
|
||||
|
||||
// There are no more URIs to check against local list. If the file is
|
||||
@@ -1518,8 +1529,11 @@ nsresult PendingLookup::OnComplete(uint32_t aVerdict, Reason aReason,
|
||||
}
|
||||
|
||||
AccumulateCategorical(aReason);
|
||||
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SHOULD_BLOCK,
|
||||
shouldBlock);
|
||||
mozilla::glean::application_reputation::should_block
|
||||
.EnumGet(
|
||||
static_cast<mozilla::glean::application_reputation::ShouldBlockLabel>(
|
||||
shouldBlock))
|
||||
.Add();
|
||||
|
||||
double t = (TimeStamp::Now() - mStartTime).ToMilliseconds();
|
||||
LOG(("Application Reputation verdict is %u, obtained in %f ms [this = %p]",
|
||||
@@ -1712,8 +1726,10 @@ NS_IMETHODIMP
|
||||
PendingLookup::Notify(nsITimer* aTimer) {
|
||||
LOG(("Remote lookup timed out [this = %p]", this));
|
||||
MOZ_ASSERT(aTimer == mTimeoutTimer);
|
||||
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_REMOTE_LOOKUP_TIMEOUT,
|
||||
true);
|
||||
mozilla::glean::application_reputation::remote_lookup_timeout
|
||||
.EnumGet(mozilla::glean::application_reputation::
|
||||
RemoteLookupTimeoutLabel::eTrue)
|
||||
.Add();
|
||||
mChannel->Cancel(NS_ERROR_NET_TIMEOUT_EXTERNAL);
|
||||
mTimeoutTimer->Cancel();
|
||||
return NS_OK;
|
||||
@@ -1769,17 +1785,18 @@ PendingLookup::OnStopRequest(nsIRequest* aRequest, nsresult aResult) {
|
||||
NS_ENSURE_STATE(mCallback);
|
||||
|
||||
if (aResult != NS_ERROR_NET_TIMEOUT_EXTERNAL) {
|
||||
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_REMOTE_LOOKUP_TIMEOUT,
|
||||
false);
|
||||
mozilla::glean::application_reputation::remote_lookup_timeout
|
||||
.EnumGet(mozilla::glean::application_reputation::
|
||||
RemoteLookupTimeoutLabel::eFalse)
|
||||
.Add();
|
||||
|
||||
MOZ_ASSERT(mTelemetryRemoteRequestStartMs > 0);
|
||||
int32_t msecs = PR_IntervalToMilliseconds(PR_IntervalNow() -
|
||||
mTelemetryRemoteRequestStartMs);
|
||||
|
||||
MOZ_ASSERT(msecs >= 0);
|
||||
mozilla::Telemetry::Accumulate(
|
||||
mozilla::Telemetry::APPLICATION_REPUTATION_REMOTE_LOOKUP_RESPONSE_TIME,
|
||||
msecs);
|
||||
mozilla::glean::application_reputation::remote_lookup_response_time
|
||||
.AccumulateRawDuration(mozilla::TimeDuration::FromMilliseconds(msecs));
|
||||
}
|
||||
|
||||
uint32_t verdict = nsIApplicationReputationService::VERDICT_SAFE;
|
||||
@@ -1801,38 +1818,44 @@ nsresult PendingLookup::OnStopRequestInternal(nsIRequest* aRequest,
|
||||
});
|
||||
|
||||
if (NS_FAILED(aResult)) {
|
||||
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER,
|
||||
mozilla::glean::application_reputation::server.AccumulateSingleSample(
|
||||
SERVER_RESPONSE_FAILED);
|
||||
AccumulateCategorical(NSErrorToLabel(aResult));
|
||||
mozilla::glean::application_reputation::server_2
|
||||
.EnumGet(NSErrorToLabel(aResult))
|
||||
.Add();
|
||||
return aResult;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIHttpChannel> channel = do_QueryInterface(aRequest, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER,
|
||||
mozilla::glean::application_reputation::server.AccumulateSingleSample(
|
||||
SERVER_RESPONSE_FAILED);
|
||||
AccumulateCategorical(
|
||||
mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_SERVER_2::
|
||||
FailGetChannel);
|
||||
mozilla::glean::application_reputation::server_2
|
||||
.EnumGet(mozilla::glean::application_reputation::Server2Label::
|
||||
eFailgetchannel)
|
||||
.Add();
|
||||
return rv;
|
||||
}
|
||||
|
||||
uint32_t status = 0;
|
||||
rv = channel->GetResponseStatus(&status);
|
||||
if (NS_FAILED(rv)) {
|
||||
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER,
|
||||
mozilla::glean::application_reputation::server.AccumulateSingleSample(
|
||||
SERVER_RESPONSE_FAILED);
|
||||
AccumulateCategorical(
|
||||
mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_SERVER_2::
|
||||
FailGetResponse);
|
||||
mozilla::glean::application_reputation::server_2
|
||||
.EnumGet(mozilla::glean::application_reputation::Server2Label::
|
||||
eFailgetresponse)
|
||||
.Add();
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (status != 200) {
|
||||
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER,
|
||||
mozilla::glean::application_reputation::server.AccumulateSingleSample(
|
||||
SERVER_RESPONSE_FAILED);
|
||||
AccumulateCategorical(HTTPStatusToLabel(status));
|
||||
mozilla::glean::application_reputation::server_2
|
||||
.EnumGet(HTTPStatusToLabel(status))
|
||||
.Add();
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
@@ -1841,19 +1864,20 @@ nsresult PendingLookup::OnStopRequestInternal(nsIRequest* aRequest,
|
||||
if (!response.ParseFromString(buf)) {
|
||||
LOG(("Invalid protocol buffer response [this = %p]: %s", this,
|
||||
buf.c_str()));
|
||||
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER,
|
||||
mozilla::glean::application_reputation::server.AccumulateSingleSample(
|
||||
SERVER_RESPONSE_INVALID);
|
||||
return NS_ERROR_CANNOT_CONVERT_DATA;
|
||||
}
|
||||
|
||||
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER,
|
||||
mozilla::glean::application_reputation::server.AccumulateSingleSample(
|
||||
SERVER_RESPONSE_VALID);
|
||||
AccumulateCategorical(
|
||||
mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_SERVER_2::
|
||||
ResponseValid);
|
||||
mozilla::glean::application_reputation::server_2
|
||||
.EnumGet(
|
||||
mozilla::glean::application_reputation::Server2Label::eResponsevalid)
|
||||
.Add();
|
||||
|
||||
// Clamp responses 0-7, we only know about 0-4 for now.
|
||||
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER_VERDICT,
|
||||
mozilla::glean::application_reputation::server_verdict.AccumulateSingleSample(
|
||||
std::min<uint32_t>(response.verdict(), 7));
|
||||
const char* ext = GetFileExt(mFileName);
|
||||
AccumulateCategoricalKeyed(nsCString(ext), VerdictToLabel(std::min<uint32_t>(
|
||||
@@ -1931,7 +1955,10 @@ ApplicationReputationService::QueryReputation(
|
||||
: Reason::InternalError;
|
||||
|
||||
AccumulateCategorical(reason);
|
||||
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SHOULD_BLOCK, false);
|
||||
mozilla::glean::application_reputation::should_block
|
||||
.EnumGet(
|
||||
mozilla::glean::application_reputation::ShouldBlockLabel::eFalse)
|
||||
.Add();
|
||||
|
||||
aCallback->OnComplete(false, rv,
|
||||
nsIApplicationReputationService::VERDICT_SAFE);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "chrome/common/safe_browsing/csd.pb.h"
|
||||
|
||||
using ServerLabel = mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_SERVER_2;
|
||||
using ServerLabel = mozilla::glean::application_reputation::Server2Label;
|
||||
using ServerVerdictLabel =
|
||||
mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_SERVER_VERDICT_2;
|
||||
|
||||
@@ -18,64 +18,63 @@ struct NSErrorTelemetryResult {
|
||||
static const NSErrorTelemetryResult sResult[] = {
|
||||
{
|
||||
NS_ERROR_ALREADY_CONNECTED,
|
||||
ServerLabel::ErrAlreadyConnected,
|
||||
ServerLabel::eErralreadyconnected,
|
||||
},
|
||||
{
|
||||
NS_ERROR_NOT_CONNECTED,
|
||||
ServerLabel::ErrNotConnected,
|
||||
ServerLabel::eErrnotconnected,
|
||||
},
|
||||
{
|
||||
NS_ERROR_CONNECTION_REFUSED,
|
||||
ServerLabel::ErrConnectionRefused,
|
||||
ServerLabel::eErrconnectionrefused,
|
||||
},
|
||||
{
|
||||
NS_ERROR_NET_TIMEOUT,
|
||||
ServerLabel::ErrNetTimeout,
|
||||
ServerLabel::eErrnettimeout,
|
||||
},
|
||||
{
|
||||
NS_ERROR_OFFLINE,
|
||||
ServerLabel::ErrOffline,
|
||||
ServerLabel::eErroffline,
|
||||
},
|
||||
{
|
||||
NS_ERROR_PORT_ACCESS_NOT_ALLOWED,
|
||||
ServerLabel::ErrPortAccess,
|
||||
ServerLabel::eErrportaccess,
|
||||
},
|
||||
{
|
||||
NS_ERROR_NET_RESET,
|
||||
ServerLabel::ErrNetReset,
|
||||
ServerLabel::eErrnetreset,
|
||||
},
|
||||
{
|
||||
NS_ERROR_NET_INTERRUPT,
|
||||
ServerLabel::ErrNetInterrupt,
|
||||
ServerLabel::eErrnetinterrupt,
|
||||
},
|
||||
{
|
||||
NS_ERROR_PROXY_CONNECTION_REFUSED,
|
||||
ServerLabel::ErrProxyConnection,
|
||||
ServerLabel::eErrproxyconnection,
|
||||
},
|
||||
{
|
||||
NS_ERROR_NET_PARTIAL_TRANSFER,
|
||||
ServerLabel::ErrNetPartial,
|
||||
ServerLabel::eErrnetpartial,
|
||||
},
|
||||
{
|
||||
NS_ERROR_NET_INADEQUATE_SECURITY,
|
||||
ServerLabel::ErrNetInadequate,
|
||||
ServerLabel::eErrnetinadequate,
|
||||
},
|
||||
{
|
||||
NS_ERROR_UNKNOWN_HOST,
|
||||
ServerLabel::ErrUnknownHost,
|
||||
ServerLabel::eErrunknownhost,
|
||||
},
|
||||
{
|
||||
NS_ERROR_DNS_LOOKUP_QUEUE_FULL,
|
||||
ServerLabel::ErrDNSLookupQueue,
|
||||
ServerLabel::eErrdnslookupqueue,
|
||||
},
|
||||
{
|
||||
NS_ERROR_UNKNOWN_PROXY_HOST,
|
||||
ServerLabel::ErrUnknownProxyHost,
|
||||
ServerLabel::eErrunknownproxyhost,
|
||||
},
|
||||
};
|
||||
|
||||
mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_SERVER_2 NSErrorToLabel(
|
||||
nsresult aRv) {
|
||||
ServerLabel NSErrorToLabel(nsresult aRv) {
|
||||
MOZ_ASSERT(aRv != NS_OK);
|
||||
|
||||
for (const auto& p : sResult) {
|
||||
@@ -83,28 +82,27 @@ mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_SERVER_2 NSErrorToLabel(
|
||||
return p.mLabel;
|
||||
}
|
||||
}
|
||||
return ServerLabel::ErrOthers;
|
||||
return ServerLabel::eErrothers;
|
||||
}
|
||||
|
||||
mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_SERVER_2 HTTPStatusToLabel(
|
||||
uint32_t aStatus) {
|
||||
ServerLabel HTTPStatusToLabel(uint32_t aStatus) {
|
||||
MOZ_ASSERT(aStatus != 200);
|
||||
|
||||
switch (aStatus) {
|
||||
case 100:
|
||||
case 101:
|
||||
// Unexpected 1xx return code
|
||||
return ServerLabel::HTTP1xx;
|
||||
return ServerLabel::eHttp1xx;
|
||||
case 201:
|
||||
case 202:
|
||||
case 203:
|
||||
case 205:
|
||||
case 206:
|
||||
// Unexpected 2xx return code
|
||||
return ServerLabel::HTTP2xx;
|
||||
return ServerLabel::eHttp2xx;
|
||||
case 204:
|
||||
// No Content
|
||||
return ServerLabel::HTTP204;
|
||||
return ServerLabel::eHttp204;
|
||||
case 300:
|
||||
case 301:
|
||||
case 302:
|
||||
@@ -114,11 +112,11 @@ mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_SERVER_2 HTTPStatusToLabel(
|
||||
case 307:
|
||||
case 308:
|
||||
// Unexpected 3xx return code
|
||||
return ServerLabel::HTTP3xx;
|
||||
return ServerLabel::eHttp3xx;
|
||||
case 400:
|
||||
// Bad Request - The HTTP request was not correctly formed.
|
||||
// The client did not provide all required CGI parameters.
|
||||
return ServerLabel::HTTP400;
|
||||
return ServerLabel::eHttp400;
|
||||
case 401:
|
||||
case 402:
|
||||
case 405:
|
||||
@@ -139,40 +137,40 @@ mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_SERVER_2 HTTPStatusToLabel(
|
||||
case 431:
|
||||
case 451:
|
||||
// Unexpected 4xx return code
|
||||
return ServerLabel::HTTP4xx;
|
||||
return ServerLabel::eHttp4xx;
|
||||
case 403:
|
||||
// Forbidden - The client id is invalid.
|
||||
return ServerLabel::HTTP403;
|
||||
return ServerLabel::eHttp403;
|
||||
case 404:
|
||||
// Not Found
|
||||
return ServerLabel::HTTP404;
|
||||
return ServerLabel::eHttp404;
|
||||
case 408:
|
||||
// Request Timeout
|
||||
return ServerLabel::HTTP408;
|
||||
return ServerLabel::eHttp408;
|
||||
case 413:
|
||||
// Request Entity Too Large
|
||||
return ServerLabel::HTTP413;
|
||||
return ServerLabel::eHttp413;
|
||||
case 500:
|
||||
case 501:
|
||||
case 510:
|
||||
// Unexpected 5xx return code
|
||||
return ServerLabel::HTTP5xx;
|
||||
return ServerLabel::eHttp5xx;
|
||||
case 502:
|
||||
case 504:
|
||||
case 511:
|
||||
// Local network errors, we'll ignore these.
|
||||
return ServerLabel::HTTP502_504_511;
|
||||
return ServerLabel::eHttp502504511;
|
||||
case 503:
|
||||
// Service Unavailable - The server cannot handle the request.
|
||||
// Clients MUST follow the backoff behavior specified in the
|
||||
// Request Frequency section.
|
||||
return ServerLabel::HTTP503;
|
||||
return ServerLabel::eHttp503;
|
||||
case 505:
|
||||
// HTTP Version Not Supported - The server CANNOT handle the requested
|
||||
// protocol major version.
|
||||
return ServerLabel::HTTP505;
|
||||
return ServerLabel::eHttp505;
|
||||
default:
|
||||
return ServerLabel::HTTPOthers;
|
||||
return ServerLabel::eHttpothers;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#ifndef ApplicationReputationTelemetryUtils_h__
|
||||
#define ApplicationReputationTelemetryUtils_h__
|
||||
|
||||
#include "mozilla/glean/ReputationserviceMetrics.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
/**
|
||||
@@ -27,13 +28,13 @@
|
||||
* NS_ERROR_DNS_LOOKUP_QUEUE_FULL
|
||||
* NS_ERROR_UNKNOWN_PROXY_HOST
|
||||
*/
|
||||
mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_SERVER_2 NSErrorToLabel(
|
||||
mozilla::glean::application_reputation::Server2Label NSErrorToLabel(
|
||||
nsresult aRv);
|
||||
|
||||
/**
|
||||
* Convert http response status to telemetry labels
|
||||
*/
|
||||
mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_SERVER_2 HTTPStatusToLabel(
|
||||
mozilla::glean::application_reputation::Server2Label HTTPStatusToLabel(
|
||||
uint32_t aStatus);
|
||||
|
||||
/**
|
||||
|
||||
241
toolkit/components/reputationservice/metrics.yaml
Normal file
241
toolkit/components/reputationservice/metrics.yaml
Normal file
@@ -0,0 +1,241 @@
|
||||
# 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:
|
||||
- 'Toolkit :: Safe Browsing'
|
||||
|
||||
application_reputation:
|
||||
binary_type:
|
||||
type: labeled_counter
|
||||
description: >
|
||||
Whether or not the file examined by download protection is a binary type
|
||||
(or it's not possible to tell because the filename is missing).
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry
|
||||
categorical histogram APPLICATION_REPUTATION_BINARY_TYPE.
|
||||
labels:
|
||||
- BinaryFile
|
||||
- NonBinaryFile
|
||||
- MozNonBinaryFile
|
||||
- UnknownFile
|
||||
- MissingFilename
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=156404
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=156404
|
||||
notification_emails:
|
||||
- dlee@mozilla.com
|
||||
- safebrowsing-telemetry@mozilla.org
|
||||
expires: never
|
||||
telemetry_mirror: h#APPLICATION_REPUTATION_BINARY_TYPE
|
||||
|
||||
binary_archive:
|
||||
type: labeled_counter
|
||||
description: >
|
||||
Whether a binary file examined by download protection is one of the common
|
||||
archive formats.
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry
|
||||
categorical histogram APPLICATION_REPUTATION_BINARY_ARCHIVE.
|
||||
labels:
|
||||
- OtherBinaryFile
|
||||
- DmgFile
|
||||
- RarFile
|
||||
- ZipFile
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1480639
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1531034
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1480639
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1531034
|
||||
notification_emails:
|
||||
- dlee@mozilla.com
|
||||
- safebrowsing-telemetry@mozilla.org
|
||||
expires: never
|
||||
telemetry_mirror: h#APPLICATION_REPUTATION_BINARY_ARCHIVE
|
||||
|
||||
should_block:
|
||||
type: labeled_counter
|
||||
description: >
|
||||
Overall (local or remote) application reputation verdict
|
||||
(shouldBlock=false is OK).
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry boolean
|
||||
histogram APPLICATION_REPUTATION_SHOULD_BLOCK.
|
||||
labels:
|
||||
- "false"
|
||||
- "true"
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1935420
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1935420
|
||||
notification_emails:
|
||||
- dlee@mozilla.com
|
||||
- safebrowsing-telemetry@mozilla.org
|
||||
expires: never
|
||||
telemetry_mirror: h#APPLICATION_REPUTATION_SHOULD_BLOCK
|
||||
|
||||
local:
|
||||
type: custom_distribution
|
||||
description: >
|
||||
Application reputation local results (0=ALLOW, 1=BLOCK, 2=NONE)
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry enumerated
|
||||
histogram APPLICATION_REPUTATION_LOCAL.
|
||||
range_min: 0
|
||||
range_max: 3
|
||||
bucket_count: 4
|
||||
histogram_type: linear
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1935420
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1935420
|
||||
notification_emails:
|
||||
- dlee@mozilla.com
|
||||
- safebrowsing-telemetry@mozilla.org
|
||||
expires: never
|
||||
telemetry_mirror: APPLICATION_REPUTATION_LOCAL
|
||||
|
||||
server:
|
||||
type: custom_distribution
|
||||
description: >
|
||||
Status of the application reputation remote lookup (0=OK, 1=failed,
|
||||
2=invalid protobuf response)
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry enumerated
|
||||
histogram APPLICATION_REPUTATION_SERVER.
|
||||
range_min: 0
|
||||
range_max: 3
|
||||
bucket_count: 4
|
||||
histogram_type: linear
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1935420
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1935420
|
||||
notification_emails:
|
||||
- dlee@mozilla.com
|
||||
- safebrowsing-telemetry@mozilla.org
|
||||
expires: never
|
||||
telemetry_mirror: APPLICATION_REPUTATION_SERVER
|
||||
|
||||
server_2:
|
||||
type: labeled_counter
|
||||
description: >
|
||||
Network status of the application reputation remote lookup
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry
|
||||
categorical histogram APPLICATION_REPUTATION_SERVER_2.
|
||||
labels:
|
||||
- ErrOthers
|
||||
- ResponseValid
|
||||
- FailGetChannel
|
||||
- FailGetResponse
|
||||
- HTTP1xx
|
||||
- HTTP2xx
|
||||
- HTTP204
|
||||
- HTTP3xx
|
||||
- HTTP400
|
||||
- HTTP4xx
|
||||
- HTTP403
|
||||
- HTTP404
|
||||
- HTTP408
|
||||
- HTTP413
|
||||
- HTTP5xx
|
||||
- HTTP502_504_511
|
||||
- HTTP503
|
||||
- HTTP505
|
||||
- HTTPOthers
|
||||
- ErrAlreadyConnected
|
||||
- ErrNotConnected
|
||||
- ErrConnectionRefused
|
||||
- ErrNetTimeout
|
||||
- ErrOffline
|
||||
- ErrPortAccess
|
||||
- ErrNetReset
|
||||
- ErrNetInterrupt
|
||||
- ErrProxyConnection
|
||||
- ErrNetPartial
|
||||
- ErrNetInadequate
|
||||
- ErrUnknownHost
|
||||
- ErrDNSLookupQueue
|
||||
- ErrUnknownProxyHost
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1479901
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1479901
|
||||
notification_emails:
|
||||
- dlee@mozilla.com
|
||||
- safebrowsing-telemetry@mozilla.org
|
||||
expires: never
|
||||
telemetry_mirror: h#APPLICATION_REPUTATION_SERVER_2
|
||||
|
||||
server_verdict:
|
||||
type: custom_distribution
|
||||
description: >
|
||||
Application reputation remote verdict (0=SAFE, 1=DANGEROUS, 2=UNCOMMON,
|
||||
3=POTENTIALLY_UNWANTED, 4=DANGEROUS_HOST, 5=UNKNOWN)
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry enumerated
|
||||
histogram APPLICATION_REPUTATION_SERVER_VERDICT.
|
||||
range_min: 0
|
||||
range_max: 8
|
||||
bucket_count: 9
|
||||
histogram_type: linear
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1272788
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1531034
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1272788
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1531034
|
||||
notification_emails:
|
||||
- dlee@mozilla.com
|
||||
- safebrowsing-telemetry@mozilla.org
|
||||
expires: never
|
||||
telemetry_mirror: APPLICATION_REPUTATION_SERVER_VERDICT
|
||||
|
||||
remote_lookup_response_time:
|
||||
type: timing_distribution
|
||||
description: >
|
||||
Server response time to remote lookup request (ms).
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry linear
|
||||
histogram APPLICATION_REPUTATION_REMOTE_LOOKUP_RESPONSE_TIME.
|
||||
time_unit: millisecond
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1479898
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1479898
|
||||
notification_emails:
|
||||
- dlee@mozilla.com
|
||||
- safebrowsing-telemetry@mozilla.org
|
||||
expires: never
|
||||
telemetry_mirror: APPLICATION_REPUTATION_REMOTE_LOOKUP_RESPONSE_TIME
|
||||
|
||||
remote_lookup_timeout:
|
||||
type: labeled_counter
|
||||
description: >
|
||||
Recorded when application reputation remote lookup is performed, `true` is
|
||||
recorded if the lookup times out.
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry boolean
|
||||
histogram APPLICATION_REPUTATION_REMOTE_LOOKUP_TIMEOUT.
|
||||
labels:
|
||||
- "false"
|
||||
- "true"
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1172689
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1531034
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1172689
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1531034
|
||||
notification_emails:
|
||||
- dlee@mozilla.com
|
||||
- safebrowsing-telemetry@mozilla.org
|
||||
expires: never
|
||||
telemetry_mirror: h#APPLICATION_REPUTATION_REMOTE_LOOKUP_TIMEOUT
|
||||
Reference in New Issue
Block a user