Bug 1935420 - Migrate histograms to use Glean APIs for CANVAS_*, r=chutten,jgilbert.
Differential Revision: https://phabricator.services.mozilla.com/D234111
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "mozilla/dom/CanvasRenderingContext2D.h"
|
||||
#include "mozilla/dom/OffscreenCanvasRenderingContext2D.h"
|
||||
#include "mozilla/GfxMessageUtils.h"
|
||||
#include "mozilla/glean/DomCanvasMetrics.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/webgpu/CanvasContext.h"
|
||||
@@ -147,24 +148,26 @@ CanvasRenderingContextHelper::CreateContextHelper(
|
||||
break;
|
||||
|
||||
case CanvasContextType::Canvas2D:
|
||||
Telemetry::Accumulate(Telemetry::CANVAS_2D_USED, 1);
|
||||
glean::canvas::used_2d.EnumGet(glean::canvas::Used2dLabel::eTrue).Add();
|
||||
ret = new CanvasRenderingContext2D(aCompositorBackend);
|
||||
break;
|
||||
|
||||
case CanvasContextType::OffscreenCanvas2D:
|
||||
Telemetry::Accumulate(Telemetry::CANVAS_2D_USED, 1);
|
||||
glean::canvas::used_2d.EnumGet(glean::canvas::Used2dLabel::eTrue).Add();
|
||||
ret = new OffscreenCanvasRenderingContext2D(aCompositorBackend);
|
||||
break;
|
||||
|
||||
case CanvasContextType::WebGL1:
|
||||
Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_USED, 1);
|
||||
glean::canvas::webgl_used.EnumGet(glean::canvas::WebglUsedLabel::eTrue)
|
||||
.Add();
|
||||
|
||||
ret = new ClientWebGLContext(/*webgl2:*/ false);
|
||||
|
||||
break;
|
||||
|
||||
case CanvasContextType::WebGL2:
|
||||
Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_USED, 1);
|
||||
glean::canvas::webgl_used.EnumGet(glean::canvas::WebglUsedLabel::eTrue)
|
||||
.Add();
|
||||
|
||||
ret = new ClientWebGLContext(/*webgl2:*/ true);
|
||||
|
||||
@@ -238,18 +241,26 @@ already_AddRefed<nsISupports> CanvasRenderingContextHelper::GetOrCreateContext(
|
||||
// We want to throw only if dictionary initialization fails,
|
||||
// so only in case aRv has been set to some error value.
|
||||
if (aContextType == CanvasContextType::WebGL1) {
|
||||
Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_SUCCESS, 0);
|
||||
glean::canvas::webgl_success
|
||||
.EnumGet(glean::canvas::WebglSuccessLabel::eFalse)
|
||||
.Add();
|
||||
} else if (aContextType == CanvasContextType::WebGL2) {
|
||||
Telemetry::Accumulate(Telemetry::CANVAS_WEBGL2_SUCCESS, 0);
|
||||
glean::canvas::webgl2_success
|
||||
.EnumGet(glean::canvas::Webgl2SuccessLabel::eFalse)
|
||||
.Add();
|
||||
} else if (aContextType == CanvasContextType::WebGPU) {
|
||||
// Telemetry::Accumulate(Telemetry::CANVAS_WEBGPU_SUCCESS, 0);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
if (aContextType == CanvasContextType::WebGL1) {
|
||||
Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_SUCCESS, 1);
|
||||
glean::canvas::webgl_success
|
||||
.EnumGet(glean::canvas::WebglSuccessLabel::eTrue)
|
||||
.Add();
|
||||
} else if (aContextType == CanvasContextType::WebGL2) {
|
||||
Telemetry::Accumulate(Telemetry::CANVAS_WEBGL2_SUCCESS, 1);
|
||||
glean::canvas::webgl2_success
|
||||
.EnumGet(glean::canvas::Webgl2SuccessLabel::eTrue)
|
||||
.Add();
|
||||
} else if (aContextType == CanvasContextType::WebGPU) {
|
||||
// Telemetry::Accumulate(Telemetry::CANVAS_WEBGPU_SUCCESS, 1);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPrefs_webgl.h"
|
||||
#include "mozilla/SVGObserverUtils.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/glean/DomCanvasMetrics.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsError.h"
|
||||
@@ -561,10 +561,11 @@ RefPtr<WebGLContext> WebGLContext::Create(HostWebGLContext* host,
|
||||
for (const auto& cur : failReasons) {
|
||||
// Don't try to accumulate using an empty key if |cur.key| is empty.
|
||||
if (cur.key.IsEmpty()) {
|
||||
Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_FAILURE_ID,
|
||||
"FEATURE_FAILURE_REASON_UNKNOWN"_ns);
|
||||
glean::canvas::webgl_failure_id
|
||||
.Get("FEATURE_FAILURE_REASON_UNKNOWN"_ns)
|
||||
.Add(1);
|
||||
} else {
|
||||
Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_FAILURE_ID, cur.key);
|
||||
glean::canvas::webgl_failure_id.Get(cur.key).Add(1);
|
||||
}
|
||||
|
||||
const auto str = nsPrintfCString("\n* %s (%s)", cur.info.BeginReading(),
|
||||
@@ -608,7 +609,7 @@ RefPtr<WebGLContext> WebGLContext::Create(HostWebGLContext* host,
|
||||
if (res.isOk()) {
|
||||
failureId = "SUCCESS"_ns;
|
||||
}
|
||||
Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_FAILURE_ID, failureId);
|
||||
glean::canvas::webgl_failure_id.Get(failureId).Add(1);
|
||||
|
||||
if (!res.isOk()) {
|
||||
out->error = res.unwrapErr();
|
||||
|
||||
131
dom/canvas/metrics.yaml
Normal file
131
dom/canvas/metrics.yaml
Normal file
@@ -0,0 +1,131 @@
|
||||
# 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:
|
||||
- 'Core :: Graphics: Canvas2D'
|
||||
|
||||
canvas:
|
||||
used_2d:
|
||||
type: labeled_counter
|
||||
description: >
|
||||
2D canvas used
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry boolean
|
||||
histogram CANVAS_2D_USED.
|
||||
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:
|
||||
- gfx-telemetry-alerts@mozilla.com
|
||||
expires: never
|
||||
telemetry_mirror: h#CANVAS_2D_USED
|
||||
|
||||
webgl_accl_failure_id:
|
||||
type: labeled_counter
|
||||
description: >
|
||||
Track the failure IDs that lead us to reject attempting to create an
|
||||
accelerated context. CANVAS_WEBGL_FAILURE_ID reports the overall WebGL
|
||||
status with the attempt to fallback.
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry count
|
||||
histogram CANVAS_WEBGL_ACCL_FAILURE_ID.
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1272808
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1272808
|
||||
notification_emails:
|
||||
- gfx-telemetry-alerts@mozilla.com
|
||||
- rhunt@mozilla.com
|
||||
expires: never
|
||||
telemetry_mirror: h#CANVAS_WEBGL_ACCL_FAILURE_ID
|
||||
|
||||
webgl_failure_id:
|
||||
type: labeled_counter
|
||||
description: >
|
||||
WebGL runtime and dynamic failure IDs. This will record a count for each
|
||||
context creation success or failure. Each failure id is a unique
|
||||
identifier that can be traced back to a particular failure branch or
|
||||
blocklist rule.
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry count
|
||||
histogram CANVAS_WEBGL_FAILURE_ID.
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1272808
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1272808
|
||||
notification_emails:
|
||||
- gfx-telemetry-alerts@mozilla.com
|
||||
- rhunt@mozilla.com
|
||||
expires: never
|
||||
telemetry_mirror: h#CANVAS_WEBGL_FAILURE_ID
|
||||
|
||||
webgl_success:
|
||||
type: labeled_counter
|
||||
description: >
|
||||
WebGL1 creation success
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry boolean
|
||||
histogram CANVAS_WEBGL_SUCCESS.
|
||||
labels:
|
||||
- "false"
|
||||
- "true"
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1247327
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1529352
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1247327
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1529352
|
||||
notification_emails:
|
||||
- gfx-telemetry-alerts@mozilla.com
|
||||
- rhunt@mozilla.com
|
||||
expires: never
|
||||
telemetry_mirror: h#CANVAS_WEBGL_SUCCESS
|
||||
|
||||
webgl_used:
|
||||
type: labeled_counter
|
||||
description: >
|
||||
WebGL canvas used
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry boolean
|
||||
histogram CANVAS_WEBGL_USED.
|
||||
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:
|
||||
- gfx-telemetry-alerts@mozilla.com
|
||||
expires: never
|
||||
telemetry_mirror: h#CANVAS_WEBGL_USED
|
||||
|
||||
webgl2_success:
|
||||
type: labeled_counter
|
||||
description: >
|
||||
WebGL2 creation success
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry boolean
|
||||
histogram CANVAS_WEBGL2_SUCCESS.
|
||||
labels:
|
||||
- "false"
|
||||
- "true"
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1247327
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1247327
|
||||
notification_emails:
|
||||
- gfx-telemetry-alerts@mozilla.com
|
||||
- rhunt@mozilla.com
|
||||
expires: never
|
||||
telemetry_mirror: h#CANVAS_WEBGL2_SUCCESS
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
#include "mozilla/gfx/Logging.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/glean/DomCanvasMetrics.h"
|
||||
#include "mozilla/Tokenizer.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "mozilla/StaticPrefs_gfx.h"
|
||||
@@ -558,7 +558,9 @@ bool GLLibraryEGL::Init(nsACString* const out_failureId) {
|
||||
#define SYMBOL(X) \
|
||||
{ \
|
||||
(PRFuncPtr*)&mSymbols.f##X, { \
|
||||
{ "egl" #X } \
|
||||
{ \
|
||||
"egl" #X \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
#define END_OF_SYMBOLS \
|
||||
@@ -908,15 +910,14 @@ std::shared_ptr<EglDisplay> GLLibraryEGL::CreateDisplayLocked(
|
||||
// Report the acceleration status to telemetry
|
||||
if (!ret) {
|
||||
if (accelAngleFailureId.IsEmpty()) {
|
||||
Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_ACCL_FAILURE_ID,
|
||||
"FEATURE_FAILURE_ACCL_ANGLE_UNKNOWN"_ns);
|
||||
glean::canvas::webgl_accl_failure_id
|
||||
.Get("FEATURE_FAILURE_ACCL_ANGLE_UNKNOWN"_ns)
|
||||
.Add(1);
|
||||
} else {
|
||||
Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_ACCL_FAILURE_ID,
|
||||
accelAngleFailureId);
|
||||
glean::canvas::webgl_accl_failure_id.Get(accelAngleFailureId).Add(1);
|
||||
}
|
||||
} else {
|
||||
Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_ACCL_FAILURE_ID,
|
||||
"SUCCESS"_ns);
|
||||
glean::canvas::webgl_accl_failure_id.Get("SUCCESS"_ns).Add(1);
|
||||
}
|
||||
|
||||
// Fallback to a WARP display if ANGLE fails, or if WARP is forced
|
||||
|
||||
@@ -24,6 +24,7 @@ gecko_metrics = [
|
||||
"devtools/client/shared/metrics.yaml",
|
||||
"docshell/base/metrics.yaml",
|
||||
"dom/base/use_counter_metrics.yaml",
|
||||
"dom/canvas/metrics.yaml",
|
||||
"dom/crypto/metrics.yaml",
|
||||
"dom/geolocation/metrics.yaml",
|
||||
"dom/localstorage/metrics.yaml",
|
||||
|
||||
Reference in New Issue
Block a user