mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 01:35:35 +00:00
Bug 1513057 - P8: Report telemetry from socket process to parent process r=dragana,mayhemer,janerik
Differential Revision: https://phabricator.services.mozilla.com/D14362 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
f66295c49c
commit
562055d29e
@ -9,6 +9,12 @@ include protocol PProfiler;
|
||||
include PrefsTypes;
|
||||
|
||||
using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h";
|
||||
using mozilla::Telemetry::HistogramAccumulation from "mozilla/TelemetryComms.h";
|
||||
using mozilla::Telemetry::KeyedHistogramAccumulation from "mozilla/TelemetryComms.h";
|
||||
using mozilla::Telemetry::ScalarAction from "mozilla/TelemetryComms.h";
|
||||
using mozilla::Telemetry::KeyedScalarAction from "mozilla/TelemetryComms.h";
|
||||
using mozilla::Telemetry::ChildEventData from "mozilla/TelemetryComms.h";
|
||||
using mozilla::Telemetry::DiscardedData from "mozilla/TelemetryComms.h";
|
||||
using base::ProcessId from "base/process.h";
|
||||
|
||||
namespace mozilla {
|
||||
@ -20,6 +26,13 @@ parent:
|
||||
async InitCrashReporter(Shmem shmem, NativeThreadId threadId);
|
||||
async AddMemoryReport(MemoryReport aReport);
|
||||
async FinishMemoryReport(uint32_t aGeneration);
|
||||
// Messages for sending telemetry to parent process.
|
||||
async AccumulateChildHistograms(HistogramAccumulation[] accumulations);
|
||||
async AccumulateChildKeyedHistograms(KeyedHistogramAccumulation[] accumulations);
|
||||
async UpdateChildScalars(ScalarAction[] actions);
|
||||
async UpdateChildKeyedScalars(KeyedScalarAction[] actions);
|
||||
async RecordChildEvents(ChildEventData[] events);
|
||||
async RecordDiscardedData(DiscardedData data);
|
||||
|
||||
child:
|
||||
async PreferenceUpdate(Pref pref);
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
#include "SocketProcessHost.h"
|
||||
#include "mozilla/ipc/CrashReporterHost.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/TelemetryIPC.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
@ -82,6 +84,47 @@ mozilla::ipc::IPCResult SocketProcessParent::RecvFinishMemoryReport(
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult SocketProcessParent::RecvAccumulateChildHistograms(
|
||||
InfallibleTArray<HistogramAccumulation>&& aAccumulations) {
|
||||
TelemetryIPC::AccumulateChildHistograms(Telemetry::ProcessID::Socket,
|
||||
aAccumulations);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult SocketProcessParent::RecvAccumulateChildKeyedHistograms(
|
||||
InfallibleTArray<KeyedHistogramAccumulation>&& aAccumulations) {
|
||||
TelemetryIPC::AccumulateChildKeyedHistograms(Telemetry::ProcessID::Socket,
|
||||
aAccumulations);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult SocketProcessParent::RecvUpdateChildScalars(
|
||||
InfallibleTArray<ScalarAction>&& aScalarActions) {
|
||||
TelemetryIPC::UpdateChildScalars(Telemetry::ProcessID::Socket,
|
||||
aScalarActions);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult SocketProcessParent::RecvUpdateChildKeyedScalars(
|
||||
InfallibleTArray<KeyedScalarAction>&& aScalarActions) {
|
||||
TelemetryIPC::UpdateChildKeyedScalars(Telemetry::ProcessID::Socket,
|
||||
aScalarActions);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult SocketProcessParent::RecvRecordChildEvents(
|
||||
nsTArray<mozilla::Telemetry::ChildEventData>&& aEvents) {
|
||||
TelemetryIPC::RecordChildEvents(Telemetry::ProcessID::Socket, aEvents);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult SocketProcessParent::RecvRecordDiscardedData(
|
||||
const mozilla::Telemetry::DiscardedData& aDiscardedData) {
|
||||
TelemetryIPC::RecordDiscardedData(Telemetry::ProcessID::Socket,
|
||||
aDiscardedData);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
// To ensure that IPDL is finished before SocketParent gets deleted.
|
||||
class DeferredDeleteSocketProcessParent : public Runnable {
|
||||
public:
|
||||
|
@ -41,6 +41,18 @@ class SocketProcessParent final : public PSocketProcessParent {
|
||||
const MemoryReport& aReport) override;
|
||||
mozilla::ipc::IPCResult RecvFinishMemoryReport(
|
||||
const uint32_t& aGeneration) override;
|
||||
mozilla::ipc::IPCResult RecvAccumulateChildHistograms(
|
||||
InfallibleTArray<HistogramAccumulation>&& aAccumulations) override;
|
||||
mozilla::ipc::IPCResult RecvAccumulateChildKeyedHistograms(
|
||||
InfallibleTArray<KeyedHistogramAccumulation>&& aAccumulations) override;
|
||||
mozilla::ipc::IPCResult RecvUpdateChildScalars(
|
||||
InfallibleTArray<ScalarAction>&& aScalarActions) override;
|
||||
mozilla::ipc::IPCResult RecvUpdateChildKeyedScalars(
|
||||
InfallibleTArray<KeyedScalarAction>&& aScalarActions) override;
|
||||
mozilla::ipc::IPCResult RecvRecordChildEvents(
|
||||
nsTArray<ChildEventData>&& events) override;
|
||||
mozilla::ipc::IPCResult RecvRecordDiscardedData(
|
||||
const DiscardedData& aDiscardedData) override;
|
||||
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
bool SendRequestMemoryReport(const uint32_t& aGeneration,
|
||||
|
@ -24,3 +24,6 @@ dynamic:
|
||||
description: >
|
||||
This is not a real process, it is used to logically group add-on probes.
|
||||
It contains data of any probes registered at runtime by add-ons.
|
||||
socket:
|
||||
gecko_enum: GeckoProcessType_Socket
|
||||
description: This is the process that handles networking requests.
|
||||
|
@ -2521,6 +2521,17 @@ telemetry.test:
|
||||
record_in_processes:
|
||||
- 'content'
|
||||
|
||||
socket_only_uint:
|
||||
bug_numbers:
|
||||
- 1486033
|
||||
description: A testing uint scalar; not meant to be touched.
|
||||
expires: never
|
||||
kind: uint
|
||||
notification_emails:
|
||||
- telemetry-client-dev@mozilla.com
|
||||
record_in_processes:
|
||||
- 'socket'
|
||||
|
||||
all_processes_uint:
|
||||
bug_numbers:
|
||||
- 1278556
|
||||
|
@ -19,6 +19,7 @@ KNOWN_PROCESS_FLAGS = {
|
||||
'main': 'Main',
|
||||
'content': 'Content',
|
||||
'gpu': 'Gpu',
|
||||
'socket': 'Socket',
|
||||
# Historical Values
|
||||
'all_childs': 'AllChildren', # Supporting files from before bug 1363725
|
||||
}
|
||||
|
@ -1162,7 +1162,8 @@ already_AddRefed<nsITelemetry> TelemetryImpl::CreateTelemetryInstance() {
|
||||
"CreateTelemetryInstance may only be called once, via GetService()");
|
||||
|
||||
bool useTelemetry = false;
|
||||
if ((XRE_IsParentProcess() || XRE_IsContentProcess() || XRE_IsGPUProcess()) &&
|
||||
if ((XRE_IsParentProcess() || XRE_IsContentProcess() || XRE_IsGPUProcess() ||
|
||||
XRE_IsSocketProcess()) &&
|
||||
// Telemetry is never accumulated when recording or replaying, both
|
||||
// because the resulting measurements might be biased and because
|
||||
// measurements might occur at non-deterministic points in execution
|
||||
|
@ -20,12 +20,13 @@ namespace Common {
|
||||
|
||||
typedef nsTHashtable<nsCStringHashKey> StringHashSet;
|
||||
|
||||
enum class RecordedProcessType : uint8_t {
|
||||
enum class RecordedProcessType : uint16_t {
|
||||
Main = (1 << GeckoProcessType_Default), // Also known as "parent process"
|
||||
Content = (1 << GeckoProcessType_Content),
|
||||
Gpu = (1 << GeckoProcessType_GPU),
|
||||
AllChildren = 0xFF - 1, // All the child processes (i.e. content, gpu, ...)
|
||||
All = 0xFF // All the processes
|
||||
Socket = (1 << GeckoProcessType_Socket),
|
||||
AllChildren = 0xFFFF - 1, // All the child processes (i.e. content, gpu, ...)
|
||||
All = 0xFFFF // All the processes
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(RecordedProcessType);
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/gfx/GPUParent.h"
|
||||
#include "mozilla/gfx/GPUProcessManager.h"
|
||||
#include "mozilla/net/SocketProcessChild.h"
|
||||
#include "mozilla/StaticMutex.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/SystemGroup.h"
|
||||
@ -327,6 +328,9 @@ void TelemetryIPCAccumulator::IPCTimerFired(nsITimer* aTimer, void* aClosure) {
|
||||
case GeckoProcessType_GPU:
|
||||
SendAccumulatedData(mozilla::gfx::GPUParent::GetSingleton());
|
||||
break;
|
||||
case GeckoProcessType_Socket:
|
||||
SendAccumulatedData(mozilla::net::SocketProcessChild::GetSingleton());
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unsupported process type");
|
||||
break;
|
||||
|
@ -923,12 +923,19 @@ var Impl = {
|
||||
.keys(measurements)
|
||||
.some(key => "gpu" in measurements[key]);
|
||||
|
||||
let measurementsContainSocket = Object
|
||||
.keys(measurements)
|
||||
.some(key => "socket" in measurements[key]);
|
||||
|
||||
payloadObj.processes = {};
|
||||
let processTypes = ["parent", "content", "extension", "dynamic"];
|
||||
// Only include the GPU process if we've accumulated data for it.
|
||||
if (measurementsContainGPU) {
|
||||
processTypes.push("gpu");
|
||||
}
|
||||
if (measurementsContainSocket) {
|
||||
processTypes.push("socket");
|
||||
}
|
||||
|
||||
// Collect per-process measurements.
|
||||
for (const processType of processTypes) {
|
||||
|
@ -21,7 +21,7 @@ class TestParser(unittest.TestCase):
|
||||
def test_valid_histogram(self):
|
||||
SAMPLE_HISTOGRAM = {
|
||||
"TEST_VALID_HISTOGRAM": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"record_in_processes": ["main", "content", "socket"],
|
||||
"alert_emails": ["team@mozilla.xyz"],
|
||||
"bug_numbers": [1383793],
|
||||
"expires_in_version": "never",
|
||||
|
Loading…
Reference in New Issue
Block a user