forked from mirrors/gecko-dev
Most are brought over straightforwardly, their Telemetry callsites reworded to use Glean, with mirroring to the Telemetry probes taken care of by the Glean Interface For Firefox Telemetry (see the telemetry_mirror property). There were some special cases: * HistogramStopwatch becomes GleanStopwatch. After migration it was only serving Glean consumers. Could've used standard Glean APIs, but having something to hold the TimerIds was convenient. * GV_STARTUP_MODULES_MS was removed. It was configured to only report for the `firefox` product, but could only have a value in `geckoview_streaming`, so never reported data. * MEDIA_DECODING_PROCESS_CRASH was removed. It was configured to only report for the `firefox` product, but could only have a value in `geckoview_streaming`, so never reported data. * GV_CONTENT_PROCESS_LIFETIME_MS was removed. It was configured to only report for the `geckoview_streaming` product, meaning it only reported data when used with GVST to reach the Glean `geckoview.content_process_lifetime` metric. This is now accomplished directly. * GV_STARTUP_RUNTIME_MS was removed. Though it was configured to report data for both `firefox` and `geckoview_streaming` products, it only ever had values in geckoview. Its data continues to be reported via `geckoview.startup_runtime`. * gecko.version and gecko.build_id (Scalars) were removed. In Firefox Desktop this information is available in the `application` section of the Environment. In geckoview-using products, this information continues to be available via `geckoview.version` and `geckoview.build_id`. * GV_STARTUP_RUNTIME_MS and GV_CONTENT_PROCESS_LIFETIME_MS are handled oddly. Since those probes were recorded in the Java portion of the code, and that portion doesn't include Glean, we use `nativeAddHistogram` to relay the samples for those two pieces of instrumentation. If there will be more instrumentation landing in that part of the code, I recommend you review the instructions for including the Glean SDK in a library, and retire this use of JNI. Differential Revision: https://phabricator.services.mozilla.com/D200094
39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
/* -*- Mode: c++; c-basic-offset: 2; tab-width: 20; indent-tabs-mode: nil; -*-
|
|
* 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/. */
|
|
|
|
#ifndef mozilla_widget_Telemetry_h__
|
|
#define mozilla_widget_Telemetry_h__
|
|
|
|
#include "mozilla/java/TelemetryUtilsNatives.h"
|
|
#include "nsAppShell.h"
|
|
#include "nsIAndroidBridge.h"
|
|
|
|
#include "mozilla/TimeStamp.h"
|
|
#include "mozilla/glean/GleanMetrics.h"
|
|
|
|
namespace mozilla {
|
|
namespace widget {
|
|
|
|
class Telemetry final : public java::TelemetryUtils::Natives<Telemetry> {
|
|
Telemetry() = delete;
|
|
|
|
public:
|
|
static void AddHistogram(jni::String::Param aName, int32_t aValue) {
|
|
MOZ_ASSERT(aName);
|
|
nsCString name = aName->ToCString();
|
|
if (name.EqualsLiteral("GV_STARTUP_RUNTIME_MS")) {
|
|
glean::geckoview::startup_runtime.AccumulateRawDuration(
|
|
TimeDuration::FromMilliseconds(aValue));
|
|
} else if (name.EqualsLiteral("GV_CONTENT_PROCESS_LIFETIME_MS")) {
|
|
glean::geckoview::content_process_lifetime.AccumulateRawDuration(
|
|
TimeDuration::FromMilliseconds(aValue));
|
|
}
|
|
}
|
|
};
|
|
|
|
} // namespace widget
|
|
} // namespace mozilla
|
|
|
|
#endif // mozilla_widget_Telemetry_h__
|