Bug 1956726 - Migrate histograms to use Glean APIs for NETWORK_ID* histograms, r=chutten,necko-reviewers,jesup.
Differential Revision: https://phabricator.services.mozilla.com/D244175
This commit is contained in:
@@ -581,9 +581,10 @@ NetworkConnectivityService::OnStopRequest(nsIRequest* aRequest,
|
||||
mIPv4Channel = nullptr;
|
||||
|
||||
if (mIPv4 == nsINetworkConnectivityService::OK) {
|
||||
Telemetry::AccumulateCategorical(
|
||||
mHasNetworkId ? Telemetry::LABELS_NETWORK_ID_ONLINE::present
|
||||
: Telemetry::LABELS_NETWORK_ID_ONLINE::absent);
|
||||
glean::network::id_online
|
||||
.EnumGet(mHasNetworkId ? glean::network::IdOnlineLabel::ePresent
|
||||
: glean::network::IdOnlineLabel::eAbsent)
|
||||
.Add();
|
||||
LOG(("mHasNetworkId : %d\n", mHasNetworkId));
|
||||
}
|
||||
} else if (aRequest == mIPv6Channel) {
|
||||
|
||||
@@ -3081,3 +3081,47 @@ network.cookies:
|
||||
- necko@mozilla.com
|
||||
expires: never
|
||||
telemetry_mirror: MOZ_SQLITE_COOKIES_OPEN_READAHEAD_MS
|
||||
|
||||
network:
|
||||
id:
|
||||
type: custom_distribution
|
||||
description: >
|
||||
Network identification (0=None, 1=New Ipv4, 2=Same, 3=New IPv6, 4=New
|
||||
dual)
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry enumerated
|
||||
histogram NETWORK_ID2.
|
||||
range_min: 0
|
||||
range_max: 6
|
||||
bucket_count: 7
|
||||
histogram_type: linear
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1240932
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1395914
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1240932
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1395914
|
||||
notification_emails:
|
||||
- necko@mozilla.com
|
||||
expires: never
|
||||
telemetry_mirror: NETWORK_ID2
|
||||
|
||||
id_online:
|
||||
type: labeled_counter
|
||||
description: >
|
||||
Network ID presence when the network connectivity checker reports that we
|
||||
have connectivity
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry
|
||||
categorical histogram NETWORK_ID_ONLINE.
|
||||
labels:
|
||||
- absent
|
||||
- present
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1580130
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1580130
|
||||
notification_emails:
|
||||
- necko@mozilla.com
|
||||
expires: never
|
||||
telemetry_mirror: h#NETWORK_ID_ONLINE
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/glean/NetwerkMetrics.h"
|
||||
#include "nsNetworkLinkService.h"
|
||||
#include "../../base/IPv6Utils.h"
|
||||
#include "../LinkServiceCommon.h"
|
||||
@@ -656,18 +656,18 @@ void nsNetworkLinkService::calculateNetworkIdInternal(void) {
|
||||
if (mNetworkId != output) {
|
||||
// new id
|
||||
if (found4 && !found6) {
|
||||
Telemetry::Accumulate(Telemetry::NETWORK_ID2, 1); // IPv4 only
|
||||
glean::network::id.AccumulateSingleSample(1); // IPv4 only
|
||||
} else if (!found4 && found6) {
|
||||
Telemetry::Accumulate(Telemetry::NETWORK_ID2, 3); // IPv6 only
|
||||
glean::network::id.AccumulateSingleSample(3); // IPv6 only
|
||||
} else {
|
||||
Telemetry::Accumulate(Telemetry::NETWORK_ID2, 4); // Both!
|
||||
glean::network::id.AccumulateSingleSample(4); // Both!
|
||||
}
|
||||
mNetworkId = output;
|
||||
idChanged = true;
|
||||
} else {
|
||||
// same id
|
||||
LOG(("Same network id"));
|
||||
Telemetry::Accumulate(Telemetry::NETWORK_ID2, 2);
|
||||
glean::network::id.AccumulateSingleSample(2);
|
||||
}
|
||||
} else {
|
||||
// no id
|
||||
@@ -676,7 +676,7 @@ void nsNetworkLinkService::calculateNetworkIdInternal(void) {
|
||||
if (!mNetworkId.IsEmpty()) {
|
||||
mNetworkId.Truncate();
|
||||
idChanged = true;
|
||||
Telemetry::Accumulate(Telemetry::NETWORK_ID2, 0);
|
||||
glean::network::id.AccumulateSingleSample(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/FunctionTypeTraits.h"
|
||||
#include "mozilla/ProfilerThreadSleep.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/glean/NetwerkMetrics.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
|
||||
@@ -249,7 +249,7 @@ class NetlinkNeighbor {
|
||||
bool mHasMAC{false};
|
||||
uint8_t mMAC[ETH_ALEN]{};
|
||||
in_common_addr mAddr{};
|
||||
struct ndmsg mNeigh {};
|
||||
struct ndmsg mNeigh{};
|
||||
};
|
||||
|
||||
class NetlinkLink {
|
||||
@@ -295,7 +295,7 @@ class NetlinkLink {
|
||||
|
||||
private:
|
||||
nsCString mName;
|
||||
struct ifinfomsg mIface {};
|
||||
struct ifinfomsg mIface{};
|
||||
};
|
||||
|
||||
class NetlinkRoute {
|
||||
@@ -480,7 +480,7 @@ class NetlinkRoute {
|
||||
|
||||
uint32_t mOif{};
|
||||
uint32_t mPrio{};
|
||||
struct rtmsg mRtm {};
|
||||
struct rtmsg mRtm{};
|
||||
};
|
||||
|
||||
class NetlinkMsg {
|
||||
@@ -501,17 +501,17 @@ class NetlinkMsg {
|
||||
bool SendRequest(int aFD, void* aRequest, uint32_t aRequestLength) {
|
||||
MOZ_ASSERT(!mIsPending, "Request has been already sent!");
|
||||
|
||||
struct sockaddr_nl kernel {};
|
||||
struct sockaddr_nl kernel{};
|
||||
memset(&kernel, 0, sizeof(kernel));
|
||||
kernel.nl_family = AF_NETLINK;
|
||||
kernel.nl_groups = 0;
|
||||
|
||||
struct iovec io {};
|
||||
struct iovec io{};
|
||||
memset(&io, 0, sizeof(io));
|
||||
io.iov_base = aRequest;
|
||||
io.iov_len = aRequestLength;
|
||||
|
||||
struct msghdr rtnl_msg {};
|
||||
struct msghdr rtnl_msg{};
|
||||
memset(&rtnl_msg, 0, sizeof(rtnl_msg));
|
||||
rtnl_msg.msg_iov = &io;
|
||||
rtnl_msg.msg_iovlen = 1;
|
||||
@@ -655,17 +655,17 @@ void NetlinkService::OnNetlinkMessage(int aNetlinkSocket) {
|
||||
// for netlink messages.
|
||||
char buffer[4096];
|
||||
|
||||
struct sockaddr_nl kernel {};
|
||||
struct sockaddr_nl kernel{};
|
||||
memset(&kernel, 0, sizeof(kernel));
|
||||
kernel.nl_family = AF_NETLINK;
|
||||
kernel.nl_groups = 0;
|
||||
|
||||
struct iovec io {};
|
||||
struct iovec io{};
|
||||
memset(&io, 0, sizeof(io));
|
||||
io.iov_base = buffer;
|
||||
io.iov_len = sizeof(buffer);
|
||||
|
||||
struct msghdr rtnl_reply {};
|
||||
struct msghdr rtnl_reply{};
|
||||
memset(&rtnl_reply, 0, sizeof(rtnl_reply));
|
||||
rtnl_reply.msg_iov = &io;
|
||||
rtnl_reply.msg_iovlen = 1;
|
||||
@@ -1165,7 +1165,7 @@ NetlinkService::Run() {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
struct sockaddr_nl addr {};
|
||||
struct sockaddr_nl addr{};
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
|
||||
addr.nl_family = AF_NETLINK;
|
||||
@@ -1690,7 +1690,7 @@ void NetlinkService::ExtractDNSProperties() {
|
||||
nsTArray<NetAddr> resolvers;
|
||||
#if defined(HAVE_RES_NINIT)
|
||||
[&]() {
|
||||
struct __res_state res {};
|
||||
struct __res_state res{};
|
||||
int ret = res_ninit(&res);
|
||||
if (ret != 0) {
|
||||
LOG(("Call to res_ninit failed: %d", ret));
|
||||
@@ -1831,18 +1831,18 @@ void NetlinkService::CalculateNetworkID() {
|
||||
if (mNetworkId != output) {
|
||||
// new id
|
||||
if (found4 && !found6) {
|
||||
Telemetry::Accumulate(Telemetry::NETWORK_ID2, 1); // IPv4 only
|
||||
glean::network::id.AccumulateSingleSample(1); // IPv4 only
|
||||
} else if (!found4 && found6) {
|
||||
Telemetry::Accumulate(Telemetry::NETWORK_ID2, 3); // IPv6 only
|
||||
glean::network::id.AccumulateSingleSample(3); // IPv6 only
|
||||
} else {
|
||||
Telemetry::Accumulate(Telemetry::NETWORK_ID2, 4); // Both!
|
||||
glean::network::id.AccumulateSingleSample(4); // Both!
|
||||
}
|
||||
mNetworkId = output;
|
||||
idChanged = true;
|
||||
} else {
|
||||
// same id
|
||||
LOG(("Same network id"));
|
||||
Telemetry::Accumulate(Telemetry::NETWORK_ID2, 2);
|
||||
glean::network::id.AccumulateSingleSample(2);
|
||||
}
|
||||
} else {
|
||||
// no id
|
||||
@@ -1851,7 +1851,7 @@ void NetlinkService::CalculateNetworkID() {
|
||||
if (!mNetworkId.IsEmpty()) {
|
||||
mNetworkId.Truncate();
|
||||
idChanged = true;
|
||||
Telemetry::Accumulate(Telemetry::NETWORK_ID2, 0);
|
||||
glean::network::id.AccumulateSingleSample(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "mozilla/SHA1.h"
|
||||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/glean/NetwerkMetrics.h"
|
||||
#include "../LinkServiceCommon.h"
|
||||
#include <iptypes.h>
|
||||
#include <iphlpapi.h>
|
||||
@@ -245,7 +245,7 @@ void nsNotifyAddrListener::calculateNetworkId(void) {
|
||||
mNetworkId.Truncate();
|
||||
}
|
||||
LOG(("calculateNetworkId: no network ID - no active networks"));
|
||||
Telemetry::Accumulate(Telemetry::NETWORK_ID2, 0);
|
||||
glean::network::id.AccumulateSingleSample(0);
|
||||
if (idChanged) {
|
||||
NotifyObservers(NS_NETWORK_ID_CHANGED_TOPIC, nullptr);
|
||||
}
|
||||
@@ -264,7 +264,7 @@ void nsNotifyAddrListener::calculateNetworkId(void) {
|
||||
MutexAutoLock lock(mMutex);
|
||||
mNetworkId.Truncate();
|
||||
}
|
||||
Telemetry::Accumulate(Telemetry::NETWORK_ID2, 0);
|
||||
glean::network::id.AccumulateSingleSample(0);
|
||||
LOG(("calculateNetworkId: no network ID Base64Encode error %X",
|
||||
uint32_t(rv)));
|
||||
return;
|
||||
@@ -273,11 +273,11 @@ void nsNotifyAddrListener::calculateNetworkId(void) {
|
||||
MutexAutoLock lock(mMutex);
|
||||
if (output != mNetworkId) {
|
||||
mNetworkId = output;
|
||||
Telemetry::Accumulate(Telemetry::NETWORK_ID2, 1);
|
||||
glean::network::id.AccumulateSingleSample(1);
|
||||
LOG(("calculateNetworkId: new NetworkID: %s", output.get()));
|
||||
NotifyObservers(NS_NETWORK_ID_CHANGED_TOPIC, nullptr);
|
||||
} else {
|
||||
Telemetry::Accumulate(Telemetry::NETWORK_ID2, 2);
|
||||
glean::network::id.AccumulateSingleSample(2);
|
||||
LOG(("calculateNetworkId: same NetworkID: %s", output.get()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user