зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1533363 - Part 2: Add HTTP Traffic category Telemetry; r=chutten
Differential Revision: https://phabricator.services.mozilla.com/D25135 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
87aef68061
Коммит
b56c857b8e
|
@ -7,6 +7,7 @@
|
|||
#include "HttpLog.h"
|
||||
|
||||
#include "mozilla/StaticPrefs.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/Unused.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -102,6 +103,9 @@ nsresult HttpTrafficAnalyzer::IncrementHttpTransaction(
|
|||
LOG(("HttpTrafficAnalyzer::IncrementHttpTransaction [%s] [this=%p]\n",
|
||||
gKeyName[aCategory].get(), this));
|
||||
|
||||
Telemetry::AccumulateCategoricalKeyed(
|
||||
gKeyName[aCategory],
|
||||
Telemetry::LABELS_HTTP_TRAFFIC_ANALYSIS::Transaction);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -114,6 +118,8 @@ nsresult HttpTrafficAnalyzer::IncrementHttpConnection(
|
|||
LOG(("HttpTrafficAnalyzer::IncrementHttpConnection [%s] [this=%p]\n",
|
||||
gKeyName[aCategory].get(), this));
|
||||
|
||||
Telemetry::AccumulateCategoricalKeyed(
|
||||
gKeyName[aCategory], Telemetry::LABELS_HTTP_TRAFFIC_ANALYSIS::Connection);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -145,6 +151,9 @@ nsresult HttpTrafficAnalyzer::IncrementHttpConnection(
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#define CLAMP_U32(num) \
|
||||
Clamp<uint32_t>(num, 0, std::numeric_limits<uint32_t>::max())
|
||||
|
||||
nsresult HttpTrafficAnalyzer::AccumulateHttpTransferredSize(
|
||||
HttpTrafficCategory aCategory, uint64_t aBytesRead, uint64_t aBytesSent) {
|
||||
MOZ_ASSERT(OnSocketThread(), "not on socket thread");
|
||||
|
@ -155,6 +164,10 @@ nsresult HttpTrafficAnalyzer::AccumulateHttpTransferredSize(
|
|||
"sb=%" PRIu64 " [this=%p]\n",
|
||||
gKeyName[aCategory].get(), aBytesRead, aBytesSent, this));
|
||||
|
||||
// Telemetry supports uint32_t only.
|
||||
auto total = CLAMP_U32(CLAMP_U32(aBytesRead) + CLAMP_U32(aBytesSent));
|
||||
Telemetry::ScalarAdd(Telemetry::ScalarID::NETWORKING_DATA_TRANSFERRED,
|
||||
NS_ConvertUTF8toUTF16(gKeyName[aCategory]), total);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -14563,5 +14563,19 @@
|
|||
],
|
||||
"keyed": true,
|
||||
"description": "Getting the number of errors in QuotaManager initialization."
|
||||
},
|
||||
"HTTP_TRAFFIC_ANALYSIS": {
|
||||
"record_in_processes": ["main"],
|
||||
"alert_emails": ["gachen@mozilla.com"],
|
||||
"bug_numbers": [1533363],
|
||||
"expires_in_version": "73",
|
||||
"kind": "categorical",
|
||||
"n_values": 8,
|
||||
"labels": [
|
||||
"Connection",
|
||||
"Transaction"
|
||||
],
|
||||
"keyed": true,
|
||||
"description": "Numbers of HTTP transactions and connections by type. There are some categories separated by keys based on 4 parameters: 1. normal browsing or private browsing 2. first party or third party 3. class of service 4. tracking classification. Available keys are: ['Y=0|NormalFirstParty', 'Y=1|NormalThirdPartyOther', 'Y=2|NormalThirdPartyContentLeader', 'Y=3|NormalThirdPartyContentBackground', 'Y=4|NormalThirdPartyContentOther', 'Y=5|NormalThirdPartyBasicLeader', 'Y=6|NormalThirdPartyBasicBackground', 'Y=7|NormalThirdPartyBasicOther', 'Y=8|NormalThirdPartyFingerprintingLeader', 'Y=9|NormalThirdPartyFingerprintingBackground', 'Y=10|NormalThirdPartyFingerprintingOther', 'Y=11|PrivateFirstParty', 'Y=12|PrivateThirdPartyOther', 'Y=13|PrivateThirdPartyContentLeader', 'Y=14|PrivateThirdPartyContentBackground', 'Y=15|PrivateThirdPartyContentOther', 'Y=16|PrivateThirdPartyBasicLeader', 'Y=17|PrivateThirdPartyBasicBackground', 'Y=18|PrivateThirdPartyBasicOther', 'Y=19|PrivateThirdPartyFingerprintingLeader', 'Y=20|PrivateThirdPartyFingerprintingBackground', 'Y=21|PrivateThirdPartyFingerprintingOther']."
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2698,6 +2698,49 @@ script.preloader:
|
|||
- 'main'
|
||||
- 'content'
|
||||
|
||||
networking:
|
||||
data_transferred:
|
||||
bug_numbers:
|
||||
- 1533363
|
||||
description: >
|
||||
How many bytes of HTTP data transferred by type, there are some categories
|
||||
separated by keys based on 4 parameters:
|
||||
1. normal browsing or private browsing
|
||||
2. first party or third party
|
||||
3. class of service
|
||||
4. tracking classification
|
||||
|
||||
Available keys are:
|
||||
Y=0|NormalFirstParty
|
||||
Y=1|NormalThirdPartyOther
|
||||
Y=2|NormalThirdPartyContentLeader
|
||||
Y=3|NormalThirdPartyContentBackground
|
||||
Y=4|NormalThirdPartyContentOther
|
||||
Y=5|NormalThirdPartyBasicLeader
|
||||
Y=6|NormalThirdPartyBasicBackground
|
||||
Y=7|NormalThirdPartyBasicOther
|
||||
Y=8|NormalThirdPartyFingerprintingLeader
|
||||
Y=9|NormalThirdPartyFingerprintingBackground
|
||||
Y=10|NormalThirdPartyFingerprintingOther
|
||||
Y=11|PrivateFirstParty
|
||||
Y=12|PrivateThirdPartyOther
|
||||
Y=13|PrivateThirdPartyContentLeader
|
||||
Y=14|PrivateThirdPartyContentBackground
|
||||
Y=15|PrivateThirdPartyContentOther
|
||||
Y=16|PrivateThirdPartyBasicLeader
|
||||
Y=17|PrivateThirdPartyBasicBackground
|
||||
Y=18|PrivateThirdPartyBasicOther
|
||||
Y=19|PrivateThirdPartyFingerprintingLeader
|
||||
Y=20|PrivateThirdPartyFingerprintingBackground
|
||||
Y=21|PrivateThirdPartyFingerprintingOther
|
||||
expires: "73"
|
||||
keyed: true
|
||||
kind: uint
|
||||
notification_emails:
|
||||
- gachen@mozilla.com
|
||||
record_in_processes:
|
||||
- 'main'
|
||||
|
||||
# The following section is for probes testing the Telemetry system. They will not be
|
||||
# submitted in pings and are only used for testing.
|
||||
telemetry.test:
|
||||
|
|
Загрузка…
Ссылка в новой задаче