Backed out 4 changesets (bug 1955429) for causing xpc failures. CLOSED TREE

Backed out changeset 8793ee7ac873 (bug 1955429)
Backed out changeset e1cf811b7274 (bug 1955429)
Backed out changeset 79bf1547f82b (bug 1955429)
Backed out changeset c451dfbfb59f (bug 1955429)
This commit is contained in:
Goloman Adrian
2025-04-15 21:57:40 +03:00
parent cbc6dca88b
commit efcf0aaa0a
60 changed files with 195 additions and 1196 deletions

8
Cargo.lock generated
View File

@@ -2581,9 +2581,9 @@ dependencies = [
[[package]]
name = "glean"
version = "64.1.1"
version = "64.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95024f4707705270208e36983976cbac235dd7fc33c9f1cb0dee396ec1ce295d"
checksum = "251b9cb685554b96dcf785dba69ce90447006dd6d9229db783336c981c3777e1"
dependencies = [
"crossbeam-channel",
"glean-core",
@@ -2595,9 +2595,9 @@ dependencies = [
[[package]]
name = "glean-core"
version = "64.1.1"
version = "64.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ca0df94fb37669287b77e8aa300913ad1d14426d7f9e443b0ce1185349c817e"
checksum = "a49d1d62648ddeed8cb996373046ea45de93f1d1ff956aba054b9304bc305753"
dependencies = [
"android_logger",
"bincode",

View File

@@ -67,7 +67,7 @@ uniffi_bindgen = "0.29.1"
# Shared across multiple application-services consumers.
rusqlite = "0.31.0"
# Shared across multiple glean consumers.
glean = "=64.1.1"
glean = "=64.0.1"
# Explicitly specify what our profiles use. The opt-level setting here is
# a total fiction; see the setup of MOZ_RUST_DEFAULT_FLAGS for what the

View File

@@ -1,102 +0,0 @@
# 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:
- 'Toolkit :: Telemetry'
glean.attribution:
ext:
type: object
lifetime: user
# Permit long description lines
# yamllint disable
description: |
Extended attribution information.
Mapped to client_info.attribution.ext in datasets.
* `experiment`: name/id of the enrolled funnel experiment
* `variation`: name/id of the variation cohort used in the enrolled funnel experiment
* `ua`: identifier derived from the user agent downloading the installer
e.g. chrome, Google Chrome 123
* `dltoken`: Unique token created at Firefox download time.
e.g. c18f86a3-f228-4d98-91bb-f90135c0aa9c
* `msstoresignedin`: only present if the installation was done through the Microsoft Store,
and was able to retrieve the "campaign ID" it was first installed with.
This value is "true" if the user was signed into the Microsoft Store
when they first installed, and false otherwise.
* `dlsource`: identifier that indicate where installations of Firefox originate
# yamllint enable
bugs:
- https://bugzilla.mozilla.org/1955429
data_reviews:
- https://bugzilla.mozilla.org/1955429
notification_emails:
- chutten@mozilla.com
send_in_pings:
- metrics
- baseline
- events
expires: never
no_lint:
- BASELINE_PING
structure:
type: object
properties:
experiment:
type: string
variation:
type: string
ua:
type: string
dltoken:
type: string
msstoresignedin:
type: boolean
dlsource:
type: string
glean.distribution:
ext:
type: object
lifetime: user
description: |
Extended distribution information.
Mapped to client_info.distribution.ext in datasets.
* `distributionVersion`: pref `distribution.version`, `null` on failure
* `partnerId`: pref `mozilla.partner.id`, `null` on failure
* `distributor`: pref `app.distributor`, `null` on failure
* `distributorChannel`: pref `app.distributor.channel`, `null` on failure
* `partnerNames`: list from prefs `app.partner.<name>=<name>`
bugs:
- https://bugzilla.mozilla.org/1955429
data_reviews:
- https://bugzilla.mozilla.org/1955429
notification_emails:
- chutten@mozilla.com
send_in_pings:
- metrics
- baseline
- events
expires: never
no_lint:
- BASELINE_PING
structure:
type: object
properties:
distributionVersion:
type: string
partnerId:
type: string
distributor:
type: string
distributorChannel:
type: string
partnerNames:
type: array
items:
type: string

8
gfx/wr/Cargo.lock generated
View File

@@ -982,9 +982,9 @@ dependencies = [
[[package]]
name = "glean"
version = "64.1.1"
version = "64.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95024f4707705270208e36983976cbac235dd7fc33c9f1cb0dee396ec1ce295d"
checksum = "251b9cb685554b96dcf785dba69ce90447006dd6d9229db783336c981c3777e1"
dependencies = [
"crossbeam-channel",
"glean-core",
@@ -996,9 +996,9 @@ dependencies = [
[[package]]
name = "glean-core"
version = "64.1.1"
version = "64.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ca0df94fb37669287b77e8aa300913ad1d14426d7f9e443b0ce1185349c817e"
checksum = "a49d1d62648ddeed8cb996373046ea45de93f1d1ff956aba054b9304bc305753"
dependencies = [
"android_logger",
"bincode",

View File

@@ -9,7 +9,7 @@ members = [
resolver = "2"
[workspace.dependencies]
glean = "=64.1.1"
glean = "=64.0.1"
[profile.release]
debug = true

View File

@@ -81,7 +81,7 @@ serialization = "1.8.1"
# Mozilla versions
apilint = "0.5.4"
mozilla-glean = "64.1.1"
mozilla-glean = "64.0.1"
# Testing versions
androidx-test = "1.6.1"

View File

@@ -104,7 +104,7 @@ vendored:third_party/python/wheel
vendored:third_party/python/zipp
# glean-sdk may not be installable if a wheel isn't available
# and it has to be built from source.
pypi-optional:glean-sdk==64.1.1:telemetry will not be collected
pypi-optional:glean-sdk==64.0.1:telemetry will not be collected
# Mach gracefully handles the case where `psutil` is unavailable.
# We aren't (yet) able to pin packages in automation, so we have to
# support down to the oldest locally-installed version (5.4.2).

View File

@@ -3690,6 +3690,16 @@ who = "Erich Gubler <erichdongubler@gmail.com>"
criteria = "safe-to-deploy"
delta = "23.1.0 -> 24.0.0"
[[audits.naga]]
who = [
"Teodor Tanasoaia <ttanasoaia@mozilla.com>",
"Erich Gubler <erichdongubler@gmail.com>",
"Jim Blandy <jimb@red-bean.com>",
]
criteria = "safe-to-deploy"
delta = "24.0.0 -> 24.0.0@git:a0dbe5ebc6fa24422fb84b2e0fea1cc94dee5109"
importable = false
[[audits.naga]]
who = "Erich Gubler <erichdongubler@gmail.com>"
criteria = "safe-to-deploy"
@@ -5956,6 +5966,16 @@ who = "Erich Gubler <erichdongubler@gmail.com>"
criteria = "safe-to-deploy"
delta = "23.0.1 -> 24.0.0"
[[audits.wgpu-core]]
who = [
"Teodor Tanasoaia <ttanasoaia@mozilla.com>",
"Erich Gubler <erichdongubler@gmail.com>",
"Jim Blandy <jimb@red-bean.com>",
]
criteria = "safe-to-deploy"
delta = "24.0.0 -> 24.0.0@git:a0dbe5ebc6fa24422fb84b2e0fea1cc94dee5109"
importable = false
[[audits.wgpu-core]]
who = "Erich Gubler <erichdongubler@gmail.com>"
criteria = "safe-to-deploy"
@@ -6067,6 +6087,16 @@ who = "Erich Gubler <erichdongubler@gmail.com>"
criteria = "safe-to-deploy"
delta = "23.0.1 -> 24.0.0"
[[audits.wgpu-hal]]
who = [
"Teodor Tanasoaia <ttanasoaia@mozilla.com>",
"Erich Gubler <erichdongubler@gmail.com>",
"Jim Blandy <jimb@red-bean.com>",
]
criteria = "safe-to-deploy"
delta = "24.0.0 -> 24.0.0@git:a0dbe5ebc6fa24422fb84b2e0fea1cc94dee5109"
importable = false
[[audits.wgpu-hal]]
who = "Erich Gubler <erichdongubler@gmail.com>"
criteria = "safe-to-deploy"
@@ -6151,6 +6181,16 @@ who = "Erich Gubler <erichdongubler@gmail.com>"
criteria = "safe-to-deploy"
delta = "23.0.0 -> 24.0.0"
[[audits.wgpu-types]]
who = [
"Teodor Tanasoaia <ttanasoaia@mozilla.com>",
"Erich Gubler <erichdongubler@gmail.com>",
"Jim Blandy <jimb@red-bean.com>",
]
criteria = "safe-to-deploy"
delta = "24.0.0 -> 24.0.0@git:a0dbe5ebc6fa24422fb84b2e0fea1cc94dee5109"
importable = false
[[audits.wgpu-types]]
who = "Erich Gubler <erichdongubler@gmail.com>"
criteria = "safe-to-deploy"

View File

@@ -289,6 +289,10 @@ notes = "Local override of the crates.io crate that uses a non-vendored local co
[policy.wr_malloc_size_of]
audit-as-crates-io = false
[[exemptions.ahash]]
version = "0.7.6"
criteria = "safe-to-deploy"
[[exemptions.alsa]]
version = "0.4.3"
criteria = "safe-to-deploy"

View File

@@ -258,15 +258,15 @@ user-login = "jrmuizel"
user-name = "Jeff Muizelaar"
[[publisher.glean]]
version = "64.1.1"
when = "2025-04-10"
version = "64.0.1"
when = "2025-04-01"
user-id = 48
user-login = "badboy"
user-name = "Jan-Erik Rediger"
[[publisher.glean-core]]
version = "64.1.1"
when = "2025-04-10"
version = "64.0.1"
when = "2025-04-01"
user-id = 48
user-login = "badboy"
user-name = "Jan-Erik Rediger"
@@ -970,6 +970,20 @@ criteria = "safe-to-deploy"
version = "1.0.2"
notes = "This is a small crate which forbids unsafe code and is a straightforward implementation of the adler hashing algorithm."
[[audits.bytecode-alliance.audits.ahash]]
who = "Chris Fallin <chris@cfallin.org>"
criteria = "safe-to-deploy"
delta = "0.7.6 -> 0.8.2"
[[audits.bytecode-alliance.audits.ahash]]
who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy"
delta = "0.8.2 -> 0.8.7"
notes = """
Shuffling of features in this update and while there are updates to `unsafe`
code it's no different than before and the usage remains the same.
"""
[[audits.bytecode-alliance.audits.allocator-api2]]
who = "Chris Fallin <chris@cfallin.org>"
criteria = "safe-to-deploy"

View File

@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: glean_parser
Version: 17.1.0
Version: 17.0.1
Summary: Parser tools for Mozilla's Glean telemetry
Home-page: https://github.com/mozilla/glean_parser
Author: The Glean Team
@@ -79,10 +79,6 @@ $ glean_parser check < ping.json
## Unreleased
## 17.1.0
- Permit object metrics named 'glean.attribution.ext' or 'glean.distribution.ext' even if allow_reserved is false ([bug 1955428](https://bugzilla.mozilla.org/show_bug.cgi?id=1955428))
## 17.0.1
- BUGFIX: Fix missing `ping_arg` "`uploader_capabilities`" in util.py ([#786](https://github.com/mozilla/glean_parser/pull/786))

View File

@@ -6,10 +6,10 @@ glean_parser/go_server.py,sha256=NOx66OpNDVIos6n3ejoJeFM5Dk4u7E3u86XV2G54tww,558
glean_parser/javascript.py,sha256=w4ZhNBHBKWYk0h3t7G0Ud2tR__hRqzn9dlEXNKLdQrA,11230
glean_parser/javascript_server.py,sha256=BJpVFuKG3tKFP0_xVyrR9Pn0UrvhumObCEgLeE0Lxhk,9028
glean_parser/kotlin.py,sha256=X2YNmx4boQ6Yb5CPoCIyRFDADrXPKIcIC-AyjkaSLtM,9519
glean_parser/lint.py,sha256=XqNsb_Km6I1AlAdJuIcaoykoL7bGPXTQoz62icIPHNY,20827
glean_parser/lint.py,sha256=ktdkR2GjR0wuR4IpLTiZ-q17vI4dk_Nebp4XU3pqzsk,21103
glean_parser/markdown.py,sha256=GkCr1CrV6mnRQseT6FO1-JJ7Eup8X3lxUfRMBTxXpe4,9066
glean_parser/metrics.py,sha256=3_ERPI63CsH_QvXVKNBVKIQTv4KWir2SfSbtn6J8a9Q,15842
glean_parser/parser.py,sha256=IsDMTOLpt_H5GRPXX3G0HQdjeRIPeYFs3TGpVjH1ubA,19383
glean_parser/parser.py,sha256=3bJwUGYhnzIHYJ7UBdO63Oi0_n1_Twvr2IOUUe_koME,18132
glean_parser/pings.py,sha256=l4hKmnKigS46vlHFI4aWueKVHcZQL36QfhK0VC8OiFA,3924
glean_parser/python_server.py,sha256=ERpYcbSwF19xKFagxX0mZAvlR1y6D7Ah5DSvW8LipCY,4791
glean_parser/ruby_server.py,sha256=e5lkfcLQAUMUBQDCjqNU82LkdUzT5x-G6HOnsUInbsU,5190
@@ -22,7 +22,7 @@ glean_parser/translation_options.py,sha256=Lxzr6G7MP0tC_ZYlZXftS4j0SLiqO-5mGVTEc
glean_parser/util.py,sha256=yTx_-Q8w8rNNSZ_xbno0B90WR7pZZptG2bUWU0sCHZk,16580
glean_parser/validate_ping.py,sha256=0TNvILH6dtzJDys3W8Kqorw6kk03me73OCUDtpoHcXU,2118
glean_parser/schemas/metrics.1-0-0.schema.yaml,sha256=cND3cvi6iBfPUVmtfIBQfGJV9AALpbvN7nu8E33_J-o,19566
glean_parser/schemas/metrics.2-0-0.schema.yaml,sha256=7BrN0qON_j8x9xm4TubGOluViGTG-gIqPyEmYPtKgf4,26716
glean_parser/schemas/metrics.2-0-0.schema.yaml,sha256=ieFMxezBuySCvUorx8eGqXRUcoeTql4Z9FxkbkG9XFQ,26715
glean_parser/schemas/pings.1-0-0.schema.yaml,sha256=hwCnsKpEysmrmVp-QHGBArEkVY3vaU1rVsxlTwhAzws,4315
glean_parser/schemas/pings.2-0-0.schema.yaml,sha256=FQBsEt8Eg_ypBUnhJ1THZWXIgtuiYfyXcp_J9pGJUnE,7001
glean_parser/schemas/tags.1-0-0.schema.yaml,sha256=OGXIJlvvVW1vaqB_NVZnwKeZ-sLlfH57vjBSHbj6DNI,1231
@@ -40,10 +40,10 @@ glean_parser/templates/ruby_server.jinja2,sha256=B0pbuld3j_0s7uMjoaCo8_6ehJUZeTX
glean_parser/templates/rust.jinja2,sha256=hX8p5HXQNEeVz_sF6SDIyUNus6CcaCG9KWLl6uQLiOU,7285
glean_parser/templates/rust_server.jinja2,sha256=JJdeU5jiWx9aWpF0qiXIYztJ14OQKxV3VFdAbCrtR_0,12841
glean_parser/templates/swift.jinja2,sha256=L_JpwGLVzmOf1FYLoCzFu_RnGTExCIDup7iR1tWzD3o,6912
glean_parser-17.1.0.dist-info/AUTHORS.md,sha256=yxgj8MioO4wUnrh0gmfb8l3DJJrf-l4HmmEDbQsbbNI,455
glean_parser-17.1.0.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
glean_parser-17.1.0.dist-info/METADATA,sha256=8JtbrOR7bidnVKiBahDVVmNSQj1cLb-wyKicTA2U4hw,36957
glean_parser-17.1.0.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
glean_parser-17.1.0.dist-info/entry_points.txt,sha256=mf9d3sv8BwSjjR58x9KDnpVkONCnv3fPQC2NjJl15Xg,68
glean_parser-17.1.0.dist-info/top_level.txt,sha256=q7T3duD-9tYZFyDry6Wv2LcdMsK2jGnzdDFhxWcT2Z8,13
glean_parser-17.1.0.dist-info/RECORD,,
glean_parser-17.0.1.dist-info/AUTHORS.md,sha256=yxgj8MioO4wUnrh0gmfb8l3DJJrf-l4HmmEDbQsbbNI,455
glean_parser-17.0.1.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
glean_parser-17.0.1.dist-info/METADATA,sha256=fX3p807Z0tgo8pjTGNX4Fxw3gPXT6dJrW_Cw7lnAE_4,36761
glean_parser-17.0.1.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
glean_parser-17.0.1.dist-info/entry_points.txt,sha256=mf9d3sv8BwSjjR58x9KDnpVkONCnv3fPQC2NjJl15Xg,68
glean_parser-17.0.1.dist-info/top_level.txt,sha256=q7T3duD-9tYZFyDry6Wv2LcdMsK2jGnzdDFhxWcT2Z8,13
glean_parser-17.0.1.dist-info/RECORD,,

View File

@@ -134,6 +134,7 @@ def check_unit_in_name(
time_unit = getattr(metric, "time_unit", None)
memory_unit = getattr(metric, "memory_unit", None)
unit = getattr(metric, "unit", None)
if time_unit is not None:
if (
@@ -174,6 +175,14 @@ def check_unit_in_name(
"Confirm the unit is correct and only include memory_unit."
)
elif unit is not None:
if unit_in_name == unit:
yield (
f"Suffix '{unit_in_name}' is redundant with unit param "
f"'{unit}'. "
"Only include unit."
)
def check_category_generic(
category_name: str, metrics: Iterable[metrics.Metric]

View File

@@ -188,32 +188,19 @@ def _instantiate_metrics(
if category_key == "no_lint":
continue
if not config.get("allow_reserved") and category_key.split(".")[0] == "glean":
if category_key not in ("glean.attribution", "glean.distribution"):
yield util.format_error(
filepath,
f"For category '{category_key}'",
"Categories beginning with 'glean' are reserved for "
"Glean internal use.",
)
continue
yield util.format_error(
filepath,
f"For category '{category_key}'",
"Categories beginning with 'glean' are reserved for "
"Glean internal use.",
)
continue
all_objects.setdefault(category_key, DictWrapper())
if not isinstance(category_val, dict):
raise TypeError(f"Invalid content for {category_key}")
for metric_key, metric_val in sorted(category_val.items()):
if (
not config.get("allow_reserved")
and category_key in ("glean.attribution", "glean.distribution")
and metric_key != "ext"
):
yield util.format_error(
filepath,
f"For {category_key}.{metric_key}",
f"May only use semi-reserved category {category_key} with metric name 'ext'",
metric_val.defined_in["line"],
)
continue
try:
metric_obj = Metric.make_metric(
category_key, metric_key, metric_val, validated=True, config=config
@@ -227,28 +214,18 @@ def _instantiate_metrics(
)
metric_obj = None
else:
if not config.get("allow_reserved"):
if "all-pings" in metric_obj.send_in_pings:
yield util.format_error(
filepath,
f"On instance {category_key}.{metric_key}",
'Only internal metrics may specify "all-pings" '
'in "send_in_pings"',
metric_val.defined_in["line"],
)
metric_obj = None
elif (
metric_obj.identifier()
in ("glean.attribution.ext", "glean.distribution.ext")
and metric_obj.type != "object"
):
yield util.format_error(
filepath,
f"On instance {category_key}.{metric_key}",
"Extended attribution/distribution metrics must be of type 'object'",
metric_val.defined_in["line"],
)
metric_obj = None
if (
not config.get("allow_reserved")
and "all-pings" in metric_obj.send_in_pings
):
yield util.format_error(
filepath,
f"On instance {category_key}.{metric_key}",
'Only internal metrics may specify "all-pings" '
'in "send_in_pings"',
metric_val.defined_in["line"],
)
metric_obj = None
if metric_obj is not None:
metric_obj.no_lint = sorted(set(metric_obj.no_lint + global_no_lint))
@@ -504,16 +481,16 @@ def parse_objects(
raise TypeError(f"Invalid content for {filepath}")
for category_key, category_val in sorted(content.items()):
if category_key.startswith("$"):
continue
if category_key.startswith("$"):
continue
interesting_metrics_dict.setdefault(category_key, DictWrapper())
interesting_metrics_dict.setdefault(category_key, DictWrapper())
if not isinstance(category_val, dict):
raise TypeError(f"Invalid category_val for {category_key}")
if not isinstance(category_val, dict):
raise TypeError(f"Invalid category_val for {category_key}")
for metric_key, metric_val in sorted(category_val.items()):
interesting_metrics_dict[category_key][metric_key] = metric_val
for metric_key, metric_val in sorted(category_val.items()):
interesting_metrics_dict[category_key][metric_key] = metric_val
for category_key, category_val in all_objects.items():
if category_key == "tags":

View File

@@ -565,7 +565,7 @@ definitions:
Use is limited to Firefox Desktop only.
Has no effect when used with non-FOG outputters.
See FOG's documentation on mirroring for details -
https://firefox-source-docs.mozilla.org/toolkit/components/glean/user/gifft.html
https://firefox-source-docs.mozilla.org/toolkit/components/glean/mirroring.html
type: string
minLength: 6

View File

@@ -21,7 +21,7 @@ dependencies = [
"filelock~=3.6",
"fluent-migrate==0.13.2",
"fluent-syntax==0.19.0",
"glean-parser==17.1.0",
"glean-parser==17.0.1",
"importlib-metadata==6.0.0",
# Required for compatibility with Flask >= 2 in tools/tryselect/selectors/chooser
"jinja2==3.1.2",

View File

@@ -358,9 +358,9 @@ gitignorant==0.3.1 \
giturlparse==0.12.0 \
--hash=sha256:c0fff7c21acc435491b1779566e038757a205c1ffdcb47e4f81ea52ad8c3859a \
--hash=sha256:412b74f2855f1da2fefa89fd8dde62df48476077a72fc19b62039554d27360eb
glean-parser==17.1.0 \
--hash=sha256:a59ab66dd734a8bea7d7a2cb632276602dd899411ee1c1cb89f439a833ba1598 \
--hash=sha256:d353c7eae4f369f6ec198cb61432e7c24d1d06b14aecc05b367f6c498053defc
glean-parser==17.0.1 \
--hash=sha256:764a3b5aaa22d6100100d97a6ce58515687f4e0d06660180024e3101a507f580 \
--hash=sha256:922b75be353461875802a50dfd052215414dbc2965d153b95ff31d85081c40b7
idna==3.10 \
--hash=sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9 \
--hash=sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3

8
third_party/python/uv.lock generated vendored
View File

@@ -598,7 +598,7 @@ wheels = [
[[package]]
name = "glean-parser"
version = "17.1.0"
version = "17.0.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "click" },
@@ -608,9 +608,9 @@ dependencies = [
{ name = "platformdirs" },
{ name = "pyyaml" },
]
sdist = { url = "https://files.pythonhosted.org/packages/5c/5e/a2c499e871398869372361a733dc612bb108079c3113ea35f67b6846e58d/glean_parser-17.1.0.tar.gz", hash = "sha256:a59ab66dd734a8bea7d7a2cb632276602dd899411ee1c1cb89f439a833ba1598", size = 291725 }
sdist = { url = "https://files.pythonhosted.org/packages/7d/fd/895160c0fbc1ced0803bd19a2c2473f537efd8e6afa38aae2af12d5535b9/glean_parser-17.0.1.tar.gz", hash = "sha256:764a3b5aaa22d6100100d97a6ce58515687f4e0d06660180024e3101a507f580", size = 290273 }
wheels = [
{ url = "https://files.pythonhosted.org/packages/8a/bd/be94c7243ff7666ee6c3170fc52791323b0b4d70d9522a9da1911dbbe40d/glean_parser-17.1.0-py3-none-any.whl", hash = "sha256:d353c7eae4f369f6ec198cb61432e7c24d1d06b14aecc05b367f6c498053defc", size = 124309 },
{ url = "https://files.pythonhosted.org/packages/2d/02/dcc2f155ef74fb2c83d51b7170236f4648adb49f645bac4e5786dc3ac77c/glean_parser-17.0.1-py3-none-any.whl", hash = "sha256:922b75be353461875802a50dfd052215414dbc2965d153b95ff31d85081c40b7", size = 124106 },
]
[[package]]
@@ -925,7 +925,7 @@ requires-dist = [
{ name = "filelock", specifier = "~=3.6" },
{ name = "fluent-migrate", specifier = "==0.13.2" },
{ name = "fluent-syntax", specifier = "==0.19.0" },
{ name = "glean-parser", specifier = "==17.1.0" },
{ name = "glean-parser", specifier = "==17.0.1" },
{ name = "importlib-metadata", specifier = "==6.0.0" },
{ name = "jinja2", specifier = "==3.1.2" },
{ name = "jsmin", specifier = "==3.0.0" },

View File

@@ -1 +1 @@
bef15c648652b3186718606fe950f1a885a86c4abb19b28d8a95f2ad60e2e039
6811e7a47781ee2d8b491fa59de0ad7a40375d04beeab0f203d5e423f0db5e48

File diff suppressed because one or more lines are too long

View File

@@ -13,7 +13,7 @@
edition = "2021"
rust-version = "1.82"
name = "glean-core"
version = "64.1.1"
version = "64.0.1"
authors = [
"Jan-Erik Rediger <jrediger@mozilla.com>",
"The Glean Team <glean-team@mozilla.com>",
@@ -40,7 +40,7 @@ license = "MPL-2.0"
repository = "https://github.com/mozilla/glean"
[package.metadata.glean]
glean-parser = "17.1.0"
glean-parser = "17.0.1"
[lib]
name = "glean_core"

View File

@@ -24,9 +24,8 @@ use crate::storage::{StorageManager, INTERNAL_STORAGE};
use crate::upload::{PingUploadManager, PingUploadTask, UploadResult, UploadTaskAction};
use crate::util::{local_now_with_offset, sanitize_application_id};
use crate::{
scheduler, system, AttributionMetrics, CommonMetricData, DistributionMetrics, ErrorKind,
InternalConfiguration, Lifetime, PingRateLimit, Result, DEFAULT_MAX_EVENTS,
GLEAN_SCHEMA_VERSION, GLEAN_VERSION, KNOWN_CLIENT_ID,
scheduler, system, CommonMetricData, ErrorKind, InternalConfiguration, Lifetime, PingRateLimit,
Result, DEFAULT_MAX_EVENTS, GLEAN_SCHEMA_VERSION, GLEAN_VERSION, KNOWN_CLIENT_ID,
};
static GLEAN: OnceCell<Mutex<Glean>> = OnceCell::new();
@@ -1085,76 +1084,4 @@ impl Glean {
scheduler::schedule(self);
}
}
/// Updates attribution fields with new values.
/// AttributionMetrics fields with `None` values will not overwrite older values.
pub fn update_attribution(&self, attribution: AttributionMetrics) {
if let Some(source) = attribution.source {
self.core_metrics.attribution_source.set_sync(self, source);
}
if let Some(medium) = attribution.medium {
self.core_metrics.attribution_medium.set_sync(self, medium);
}
if let Some(campaign) = attribution.campaign {
self.core_metrics
.attribution_campaign
.set_sync(self, campaign);
}
if let Some(term) = attribution.term {
self.core_metrics.attribution_term.set_sync(self, term);
}
if let Some(content) = attribution.content {
self.core_metrics
.attribution_content
.set_sync(self, content);
}
}
/// **TEST-ONLY Method**
///
/// Returns the current attribution metrics.
pub fn test_get_attribution(&self) -> AttributionMetrics {
AttributionMetrics {
source: self
.core_metrics
.attribution_source
.get_value(self, Some("glean_client_info")),
medium: self
.core_metrics
.attribution_medium
.get_value(self, Some("glean_client_info")),
campaign: self
.core_metrics
.attribution_campaign
.get_value(self, Some("glean_client_info")),
term: self
.core_metrics
.attribution_term
.get_value(self, Some("glean_client_info")),
content: self
.core_metrics
.attribution_content
.get_value(self, Some("glean_client_info")),
}
}
/// Updates distribution fields with new values.
/// DistributionMetrics fields with `None` values will not overwrite older values.
pub fn update_distribution(&self, distribution: DistributionMetrics) {
if let Some(name) = distribution.name {
self.core_metrics.distribution_name.set_sync(self, name);
}
}
/// **TEST-ONLY Method**
///
/// Returns the current distribution metrics.
pub fn test_get_distribution(&self) -> DistributionMetrics {
DistributionMetrics {
name: self
.core_metrics
.distribution_name
.get_value(self, Some("glean_client_info")),
}
}
}

View File

@@ -42,58 +42,6 @@ pub struct ClientInfoMetrics {
pub locale: Option<String>,
}
/// Optional product attribution metrics carried in `client_info.attribution`.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AttributionMetrics {
/// The attribution source (e.g. "google-play").
pub source: Option<String>,
/// The attribution medium (e.g. "organic" for a search engine).
pub medium: Option<String>,
/// The attribution campaign (e.g. "mozilla-org").
pub campaign: Option<String>,
/// The attribution term (e.g. "browser with developer tools for android").
pub term: Option<String>,
/// The attribution content (e.g. "firefoxview").
pub content: Option<String>,
}
impl AttributionMetrics {
/// Update self with any non-`None` fields from `other`.
pub fn update(&mut self, other: AttributionMetrics) {
if let Some(source) = other.source {
self.source = Some(source);
}
if let Some(medium) = other.medium {
self.medium = Some(medium);
}
if let Some(campaign) = other.campaign {
self.campaign = Some(campaign);
}
if let Some(term) = other.term {
self.term = Some(term);
}
if let Some(content) = other.content {
self.content = Some(content);
}
}
}
/// Optional product distribution metrics carried in `client_info.distribution`.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct DistributionMetrics {
/// The distribution name (e.g. "MozillaOnline").
pub name: Option<String>,
}
impl DistributionMetrics {
/// Update self with any non-`None` fields from `other`.
pub fn update(&mut self, other: DistributionMetrics) {
if let Some(name) = other.name {
self.name = Some(name);
}
}
}
/// Metrics included in every ping as `client_info`.
impl ClientInfoMetrics {
/// Creates the client info with dummy values for all.
@@ -256,62 +204,3 @@ pub mod internal_metrics {
)
});
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn update_attribution() {
let mut attr: AttributionMetrics = Default::default();
let empty: AttributionMetrics = Default::default();
// Ensure the identity operation works.
attr.update(empty.clone());
assert_eq!(None, attr.source);
// Ensure simple updates work.
attr.update(AttributionMetrics {
source: Some("a source".into()),
..Default::default()
});
assert_eq!(Some("a source".into()), attr.source);
// Ensure None doesn't overwrite.
attr.update(empty);
assert_eq!(Some("a source".into()), attr.source);
// Ensure updates of Some work.
attr.update(AttributionMetrics {
source: Some("another source".into()),
..Default::default()
});
assert_eq!(Some("another source".into()), attr.source);
}
#[test]
fn update_distribution() {
let mut dist: DistributionMetrics = Default::default();
let empty: DistributionMetrics = Default::default();
// Ensure the identity operation works.
dist.update(empty.clone());
assert_eq!(None, dist.name);
// Ensure simple updates work.
dist.update(DistributionMetrics {
name: Some("a name".into()),
});
assert_eq!(Some("a name".into()), dist.name);
// Ensure None doesn't overwrite.
dist.update(empty);
assert_eq!(Some("a name".into()), dist.name);
// Ensure updates of Some work.
dist.update(DistributionMetrics {
name: Some("another name".into()),
});
assert_eq!(Some("another name".into()), dist.name);
}
}

View File

@@ -71,18 +71,6 @@ namespace glean {
PingUploadTask glean_get_upload_task();
UploadTaskAction glean_process_ping_upload_response(string uuid, UploadResult result);
// Updates attribution fields with new values.
// AttributionMetrics fields with no values will not overwrite older values.
void glean_update_attribution(AttributionMetrics attribution);
// Returns the current attribution metrics, if any.
AttributionMetrics glean_test_get_attribution();
// Updates distribution fields with new values.
// DistributionMetrics fields with no values will not overwrite older values.
void glean_update_distribution(DistributionMetrics distribution);
// Returns the current distribution metrics, if any.
DistributionMetrics glean_test_get_distribution();
};
// A `Cow<'static, str>`, but really it's always the owned part.
@@ -150,18 +138,6 @@ dictionary ClientInfoMetrics {
i64? windows_build_number = null;
};
dictionary AttributionMetrics {
string? source = null;
string? medium = null;
string? campaign = null;
string? term = null;
string? content = null;
};
dictionary DistributionMetrics {
string? name = null;
};
[Error]
enum CallbackError {
"UnexpectedError",

View File

@@ -11,12 +11,6 @@ pub struct CoreMetrics {
pub client_id: UuidMetric,
pub first_run_date: DatetimeMetric,
pub os: StringMetric,
pub attribution_source: StringMetric,
pub attribution_medium: StringMetric,
pub attribution_campaign: StringMetric,
pub attribution_term: StringMetric,
pub attribution_content: StringMetric,
pub distribution_name: StringMetric,
}
#[derive(Debug)]
@@ -71,60 +65,6 @@ impl CoreMetrics {
disabled: false,
dynamic_label: None,
}),
attribution_source: StringMetric::new(CommonMetricData {
name: "source".into(),
category: "attribution".into(),
send_in_pings: vec!["glean_client_info".into()],
lifetime: Lifetime::User,
disabled: false,
dynamic_label: None,
}),
attribution_medium: StringMetric::new(CommonMetricData {
name: "medium".into(),
category: "attribution".into(),
send_in_pings: vec!["glean_client_info".into()],
lifetime: Lifetime::User,
disabled: false,
dynamic_label: None,
}),
attribution_campaign: StringMetric::new(CommonMetricData {
name: "campaign".into(),
category: "attribution".into(),
send_in_pings: vec!["glean_client_info".into()],
lifetime: Lifetime::User,
disabled: false,
dynamic_label: None,
}),
attribution_term: StringMetric::new(CommonMetricData {
name: "term".into(),
category: "attribution".into(),
send_in_pings: vec!["glean_client_info".into()],
lifetime: Lifetime::User,
disabled: false,
dynamic_label: None,
}),
attribution_content: StringMetric::new(CommonMetricData {
name: "content".into(),
category: "attribution".into(),
send_in_pings: vec!["glean_client_info".into()],
lifetime: Lifetime::User,
disabled: false,
dynamic_label: None,
}),
distribution_name: StringMetric::new(CommonMetricData {
name: "name".into(),
category: "distribution".into(),
send_in_pings: vec!["glean_client_info".into()],
lifetime: Lifetime::User,
disabled: false,
dynamic_label: None,
}),
}
}
}

View File

@@ -59,7 +59,7 @@ mod fd_logger;
pub use crate::common_metric_data::{CommonMetricData, Lifetime};
pub use crate::core::Glean;
pub use crate::core_metrics::{AttributionMetrics, ClientInfoMetrics, DistributionMetrics};
pub use crate::core_metrics::ClientInfoMetrics;
pub use crate::error::{Error, ErrorKind, Result};
pub use crate::error_recording::{test_get_num_recorded_errors, ErrorType};
pub use crate::histogram::HistogramType;
@@ -102,10 +102,6 @@ static PRE_INIT_SOURCE_TAGS: Mutex<Vec<String>> = Mutex::new(Vec::new());
static PRE_INIT_PING_REGISTRATION: Mutex<Vec<metrics::PingType>> = Mutex::new(Vec::new());
static PRE_INIT_PING_ENABLED: Mutex<Vec<(metrics::PingType, bool)>> = Mutex::new(Vec::new());
/// Keep track of attribution and distribution supplied before Glean is initialized.
static PRE_INIT_ATTRIBUTION: Mutex<Option<AttributionMetrics>> = Mutex::new(None);
static PRE_INIT_DISTRIBUTION: Mutex<Option<DistributionMetrics>> = Mutex::new(None);
/// Global singleton of the handles of the glean.init threads.
/// For joining. For tests.
/// (Why a Vec? There might be more than one concurrent call to initialize.)
@@ -452,15 +448,6 @@ fn initialize_inner(
glean.set_ping_enabled(ping, *enabled);
}
// The attribution and distribution might have been set before initialize,
// take the cached values and set them.
if let Some(attribution) = PRE_INIT_ATTRIBUTION.lock().unwrap().take() {
glean.update_attribution(attribution);
}
if let Some(distribution) = PRE_INIT_DISTRIBUTION.lock().unwrap().take() {
glean.update_distribution(distribution);
}
// If this is the first time ever the Glean SDK runs, make sure to set
// some initial core metrics in case we need to generate early pings.
// The next times we start, we would have them around already.
@@ -887,7 +874,7 @@ pub fn glean_set_collection_enabled(enabled: bool) {
/// and all pending pings of that type to be deleted.
pub fn set_ping_enabled(ping: &PingType, enabled: bool) {
let ping = ping.clone();
if was_initialize_called() && core::global_glean().is_some() {
if was_initialize_called() {
crate::launch_with_glean_mut(move |glean| glean.set_ping_enabled(&ping, enabled));
} else {
let m = &PRE_INIT_PING_ENABLED;
@@ -902,7 +889,7 @@ pub(crate) fn register_ping_type(ping: &PingType) {
// we dispatch ping registration on the thread pool.
// Registering a ping should not block the application.
// Submission itself is also dispatched, so it will always come after the registration.
if was_initialize_called() && core::global_glean().is_some() {
if was_initialize_called() {
let ping = ping.clone();
crate::launch_with_glean_mut(move |glean| {
glean.register_ping_type(&ping);
@@ -1016,7 +1003,7 @@ pub fn glean_apply_server_knobs_config(json: String) {
/// This will return `false` in case `tag` is not a valid tag and `true` otherwise.
/// If called before Glean is initialized it will always return `true`.
pub fn glean_set_debug_view_tag(tag: String) -> bool {
if was_initialize_called() && core::global_glean().is_some() {
if was_initialize_called() {
crate::launch_with_glean_mut(move |glean| {
glean.set_debug_view_tag(&tag);
});
@@ -1054,7 +1041,7 @@ pub fn glean_get_debug_view_tag() -> Option<String> {
/// * `tags` - A vector of at most 5 valid HTTP header values. Individual
/// tags must match the regex: "[a-zA-Z0-9-]{1,20}".
pub fn glean_set_source_tags(tags: Vec<String>) -> bool {
if was_initialize_called() && core::global_glean().is_some() {
if was_initialize_called() {
crate::launch_with_glean_mut(|glean| {
glean.set_source_tags(tags);
});
@@ -1079,7 +1066,7 @@ pub fn glean_set_source_tags(tags: Vec<String>) -> bool {
///
/// * `value` - The value of the log pings option
pub fn glean_set_log_pings(value: bool) {
if was_initialize_called() && core::global_glean().is_some() {
if was_initialize_called() {
crate::launch_with_glean_mut(move |glean| {
glean.set_log_pings(value);
});
@@ -1176,8 +1163,7 @@ pub fn glean_submit_ping_by_name_sync(ping_name: String, reason: Option<String>)
return false;
}
core::with_opt_glean(|glean| glean.submit_ping_by_name(&ping_name, reason.as_deref()))
.unwrap_or(false)
core::with_glean(|glean| glean.submit_ping_by_name(&ping_name, reason.as_deref()))
}
/// EXPERIMENTAL: Register a listener object to recieve notifications of event recordings.
@@ -1269,52 +1255,6 @@ pub fn glean_set_dirty_flag(new_value: bool) {
core::with_glean(|glean| glean.set_dirty_flag(new_value))
}
/// Updates attribution fields with new values.
/// AttributionMetrics fields with `None` values will not overwrite older values.
pub fn glean_update_attribution(attribution: AttributionMetrics) {
if was_initialize_called() && core::global_glean().is_some() {
core::with_glean(|glean| glean.update_attribution(attribution));
} else {
PRE_INIT_ATTRIBUTION
.lock()
.unwrap()
.get_or_insert(Default::default())
.update(attribution);
}
}
/// **TEST-ONLY Method**
///
/// Returns the current attribution metrics.
/// Panics if called before init.
pub fn glean_test_get_attribution() -> AttributionMetrics {
join_init();
core::with_glean(|glean| glean.test_get_attribution())
}
/// Updates distribution fields with new values.
/// DistributionMetrics fields with `None` values will not overwrite older values.
pub fn glean_update_distribution(distribution: DistributionMetrics) {
if was_initialize_called() && core::global_glean().is_some() {
core::with_glean(|glean| glean.update_distribution(distribution));
} else {
PRE_INIT_DISTRIBUTION
.lock()
.unwrap()
.get_or_insert(Default::default())
.update(distribution);
}
}
/// **TEST-ONLY Method**
///
/// Returns the current distribution metrics.
/// Panics if called before init.
pub fn glean_test_get_distribution() -> DistributionMetrics {
join_init();
core::with_glean(|glean| glean.test_get_distribution())
}
#[cfg(all(not(target_os = "android"), not(target_os = "ios")))]
static FD_LOGGER: OnceCell<fd_logger::FdLogger> = OnceCell::new();

View File

@@ -396,58 +396,6 @@ fn client_id_is_set_to_random_value_when_uploading_enabled_at_start() {
assert_ne!(*KNOWN_CLIENT_ID, current_client_id.unwrap());
}
#[test]
fn attribution_and_distribution_are_correctly_stored() {
let dir = tempfile::tempdir().unwrap();
let tmpname = dir.path().display().to_string();
let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true, true);
// On a fresh Glean, no attribution or distribution information is set.
assert_eq!(
<AttributionMetrics as Default>::default(),
glean.test_get_attribution()
);
assert_eq!(
<DistributionMetrics as Default>::default(),
glean.test_get_distribution()
);
let mut attribution = AttributionMetrics {
source: Some("source".into()),
medium: Some("medium".into()),
campaign: Some("campaign".into()),
term: Some("term".into()),
content: Some("content".into()),
};
let distribution = DistributionMetrics {
name: Some("name".into()),
};
// Set them all at once.
glean.update_attribution(attribution.clone());
glean.update_distribution(distribution.clone());
assert_eq!(attribution, glean.test_get_attribution());
assert_eq!(distribution, glean.test_get_distribution());
let attribution_update = AttributionMetrics {
campaign: Some("new campaign".into()),
..Default::default()
};
let distribution_update = DistributionMetrics {
name: Some("new name".into()),
};
// Perform updates.
glean.update_attribution(attribution_update);
glean.update_distribution(distribution_update.clone());
// Ensure only the updated fields took over
attribution.campaign = Some("new campaign".into());
assert_eq!(attribution, glean.test_get_attribution());
assert_eq!(distribution_update, glean.test_get_distribution());
}
#[test]
fn enabling_when_already_enabled_is_a_noop() {
let dir = tempfile::tempdir().unwrap();

View File

@@ -17,7 +17,7 @@ use crate::Glean;
const MAX_LABELS: usize = 16;
const OTHER_LABEL: &str = "__other__";
const MAX_LABEL_LENGTH: usize = 111;
const MAX_LABEL_LENGTH: usize = 71;
/// A labeled counter.
pub type LabeledCounter = LabeledMetric<CounterMetric>;
@@ -265,7 +265,7 @@ where
/// only the first 16 unique labels will be used.
/// After that, any additional labels will be recorded under the special `OTHER_LABEL` label.
///
/// Labels must have a maximum of 111 characters, and may comprise any printable ASCII characters.
/// Labels must be `snake_case` and less than 30 characters.
/// If an invalid label is used, the metric will be recorded in the special `OTHER_LABEL` label.
pub fn get<S: AsRef<str>>(&self, label: S) -> Arc<T> {
let label = label.as_ref();

View File

@@ -176,36 +176,8 @@ impl PingMaker {
StorageManager.snapshot_as_json(glean.storage(), "glean_client_info", true)
{
let client_info_obj = client_info.as_object().unwrap(); // safe unwrap, snapshot always returns an object.
for (_metric_type, metrics) in client_info_obj {
merge(&mut map, metrics);
}
let map = map.as_object_mut().unwrap(); // safe unwrap, we created the object above.
let mut attribution = serde_json::Map::new();
let mut distribution = serde_json::Map::new();
map.retain(|name, value| {
// Only works because we ensure no client_info metric categories contain '.'.
let mut split = name.split('.');
let category = split.next();
let name = split.next();
if let (Some(category), Some(name)) = (category, name) {
if category == "attribution" {
attribution.insert(name.into(), value.take());
false
} else if category == "distribution" {
distribution.insert(name.into(), value.take());
false
} else {
true
}
} else {
true
}
});
if !attribution.is_empty() {
map.insert("attribution".into(), serde_json::Value::from(attribution));
}
if !distribution.is_empty() {
map.insert("distribution".into(), serde_json::Value::from(distribution));
for (_key, value) in client_info_obj {
merge(&mut map, value);
}
} else {
log::warn!("Empty client info data.");

View File

@@ -21,7 +21,7 @@ where
/// only the first 16 unique labels will be used.
/// After that, any additional labels will be recorded under the special `OTHER_LABEL` label.
///
/// Labels must have a maximum of 111 characters, and may comprise any printable ASCII characters.
/// Labels must be `snake_case` and less than 30 characters.
/// If an invalid label is used, the metric will be recorded in the special `OTHER_LABEL` label.
fn get(&self, label: &str) -> T;

View File

@@ -387,7 +387,7 @@ fn dynamic_labels_too_long() {
None,
);
let metric = labeled.get("1".repeat(112));
let metric = labeled.get("1".repeat(72));
metric.add_sync(&glean, 1);
let snapshot = StorageManager

View File

@@ -4,8 +4,6 @@
mod common;
use crate::common::*;
use glean_core::{AttributionMetrics, DistributionMetrics};
use serde_json::json;
use glean_core::metrics::*;
use glean_core::ping::PingMaker;
@@ -308,69 +306,3 @@ fn metadata_is_correctly_added_when_necessary() {
let headers = metadata.as_ref().unwrap().get("headers").unwrap();
assert_eq!(headers.get("X-Debug-ID").unwrap(), "valid-tag");
}
#[test]
fn attribution_and_distribution_appear_in_client_info() {
let (glean, ping_maker, ping_type, _t) = set_up_basic_ping();
let attribution = AttributionMetrics {
source: Some("source".into()),
medium: Some("medium".into()),
campaign: Some("campaign".into()),
term: Some("term".into()),
content: Some("content".into()),
};
let distribution = DistributionMetrics {
name: Some("name".into()),
};
glean.update_attribution(attribution);
glean.update_distribution(distribution);
let ping = ping_maker
.collect(&glean, &ping_type, None, "", "")
.unwrap();
let client_info = ping.content["client_info"].as_object().unwrap();
assert_eq!(json!({"name": "name"}), client_info["distribution"]);
assert_eq!(
json!({
"source": "source",
"medium": "medium",
"campaign": "campaign",
"term": "term",
"content": "content",
}),
client_info["attribution"]
);
// Now let's test updated values.
let attribution_update = AttributionMetrics {
content: Some("what a boring word".into()),
..Default::default()
};
let distribution_update = DistributionMetrics {
name: Some("what's in a name".into()),
};
glean.update_attribution(attribution_update);
glean.update_distribution(distribution_update);
let ping = ping_maker
.collect(&glean, &ping_type, None, "", "")
.unwrap();
let client_info = ping.content["client_info"].as_object().unwrap();
assert_eq!(
json!({"name": "what's in a name"}),
client_info["distribution"]
);
assert_eq!(
json!({
"source": "source",
"medium": "medium",
"campaign": "campaign",
"term": "term",
"content": "what a boring word",
}),
client_info["attribution"]
);
}

View File

@@ -1 +1 @@
{"files":{"Cargo.lock":"add20d32d164cac0a56ddac41468eaf0b23b9616f32e94a8434f5841d14b3a97","Cargo.toml":"99107d6ac4ef4ff33e2d206e8498875df879001e4621ba94e9d4ccf14267f39c","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"5627cc81e6187ab6c2b4dff061af16d559edcab64ba786bac39daa69c703c595","src/common_test.rs":"c86cccfb7da1506cfed29cb2ee13d839b7ac7cffdfd70793c9665bb44e0b684f","src/configuration.rs":"de65ab99a26b4547be20803bc195cb50a6ab40b1a3f49a2e6230fed5a9d7a8d8","src/core_metrics.rs":"fef8fb4e5fa57c179836c6eb2cf59278fe3b8b036dbe57b0ff02971b4acd822f","src/lib.rs":"998359d04ba0f71aaa360b8999c716f22c9efaf1ff4e1fdce80f1d3af5e584b0","src/net/http_uploader.rs":"0a94ac3cd87cb021529dee46d537765ab8d923e0f4ac7615225e878d3739e6dc","src/net/mod.rs":"09ba010b03d045fd8a2ccbe4f205c5275bb622bceb34cb81a0aa8f7d33804e2e","src/private/event.rs":"f299c79e4e2acb657f06004f3038bd8909e287719458566bc7f96262d8665e62","src/private/mod.rs":"66e90c41de74d1e80c5d3f49b8f1a86b8396be0b8c4a80f1a28903fe6d105ecf","src/private/object.rs":"7f17a7a658e8f7aa19a6bedf70f60f3f42713316d5d60298d682bb045caaafb7","src/private/ping.rs":"d2fb45e9e178ff6b17aa9c1b5258dfcd2ed91a2b43b44dec826de256ef5e8520","src/system.rs":"d602804a72258bfd65e51c571946631732ee27d81342d8aa406e47fdd241bbfa","src/test.rs":"8ff4d5072d23d9fbf5444e474d21b41a31e86a37e2a25fc2f2a92976e7642cbb","tests/collection_enabled.rs":"3327a949dbdeec493d661261abda68ffa71acc50ab24cba4fde5302749e6f16b","tests/collection_enabled_bin.rs":"d3a6458b84012a447e5cb792f2292a06951ed252fad803b9166b437bacba542c","tests/common/mod.rs":"2fd391c5eb45f56fdfa3261dd631406c67ed36b10b0d5432febe2483da5c9d89","tests/custom_distribution_buffered.rs":"47c13d1f39adf3881e10caa19e0c08235f08958809e234bf37a79d37d7322cd5","tests/init_fails.rs":"ca7fa1b3dd6a21a9e005b7a4f0a18664c4bceb952dd463db8316500f72280d5b","tests/interruptible_shutdown.rs":"3d954bbe47d4f5fd103c51a4ff99f151662143c25c826da9734a00cd215909b9","tests/memory_distribution_buffered.rs":"db487475a5cf17a0864ccf150984ebdd28bf616573772cf678246cc1bdbcbc0f","tests/metric_metadata.rs":"05c947d3decf0a3281378dbb108080a05319ad8f130af5b07f9b049b80e5f04f","tests/near-empty-c0ffee-db.safe.bin":"89afb3bb8fc94430fb0ed0fe55f85f3f8bcc8fd0fed69a9df13cc560294ec9f5","tests/never_init.rs":"51fff5618f6603bc0945d70131698d10a1c6275f43bbc22a2de5807f8a79229f","tests/no_time_to_init.rs":"2ede23df6618ff1cb5ae3b7bbf95900ad0fd92072afa2e0319bf147b4f75cefc","tests/overflowing_preinit.rs":"985e140460a100986fd051ce901b787a3a7a9747a856cd06066b740ac7d2381c","tests/persist_ping_lifetime_nopanic.rs":"18379d3ffbf4a2c8c684c04ff7a0660b86dfbbb447db2d24dfed6073cb7ddf8f","tests/schema.rs":"23b49005402b914e55a0c5c155f30c2662c609f79be78d1385ec25b3600b3547","tests/simple.rs":"15c76a1b5a336fd6abfbdebafc971f5c6a9b75107ddbca65f0031cde3e2886da","tests/test-delayed-ping-data.sh":"4a6db98b4df6b77898ace6a8b4e8b4c60d3e5c44873bbf38c62e83583e27a3ff","tests/test-enabled-pings.sh":"06656e38f63e65475006b107dd6bd179b0cbaa1fad1470de38e679e91a9315a3","tests/test-pending-gets-removed.sh":"e335f2f00fa97a61b6d94e0005fb3b9de8c8db8076111a67ca47d85392039ea9","tests/test-ping-lifetime-flush.sh":"e8f118ea2f6fd973809e38d5e828a03cfccfe0b0f497ccde5ec92d6d1380c071","tests/test-shutdown-blocking.sh":"a44d8d4bbe2ee3ede9e48121150ae7a5386025160c5cef2181ca142232c5fb27","tests/test-thread-crashing.sh":"f3cd0cc8a7b4fe82bef0fe6fbfbbe45fbad6da3afe0f82578bc5cfb2d6527ac6","tests/timing_distribution_buffered.rs":"501f7289c0c28f0ab83838c88b058999b19436d0f2b693be0787513d7b67e06d","tests/timing_distribution_single_sample.rs":"4f9498b6ef29913da0356027efe5f572c81d2f426e8538c068b54a1cfa33c1b8","tests/upload_timing.rs":"b3b9db197bc2ec41556388969a6bf289e7ef19e05b9019bc2bd98c823fcf6ea3","tests/uploader_capabilities.rs":"347f19e534a50a211ea179d6818631270d1b4ec468098e6b6abcde1e4a6a9bca"},"package":"95024f4707705270208e36983976cbac235dd7fc33c9f1cb0dee396ec1ce295d"}
{"files":{"Cargo.lock":"61c7d6620026e84a7bb067305d92ffb8c51a59261c339d3ef6a8406d03bbfd92","Cargo.toml":"bec966c61ac0670d367556c54f9156aad7b2cd72dce2d09c783fdf421f49c563","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"5627cc81e6187ab6c2b4dff061af16d559edcab64ba786bac39daa69c703c595","src/common_test.rs":"c86cccfb7da1506cfed29cb2ee13d839b7ac7cffdfd70793c9665bb44e0b684f","src/configuration.rs":"de65ab99a26b4547be20803bc195cb50a6ab40b1a3f49a2e6230fed5a9d7a8d8","src/core_metrics.rs":"fef8fb4e5fa57c179836c6eb2cf59278fe3b8b036dbe57b0ff02971b4acd822f","src/lib.rs":"61b56a35c2bc6cd60bba2225b399881512d4b9a7d8cadca7fbed37ee6959d74c","src/net/http_uploader.rs":"0a94ac3cd87cb021529dee46d537765ab8d923e0f4ac7615225e878d3739e6dc","src/net/mod.rs":"09ba010b03d045fd8a2ccbe4f205c5275bb622bceb34cb81a0aa8f7d33804e2e","src/private/event.rs":"f299c79e4e2acb657f06004f3038bd8909e287719458566bc7f96262d8665e62","src/private/mod.rs":"66e90c41de74d1e80c5d3f49b8f1a86b8396be0b8c4a80f1a28903fe6d105ecf","src/private/object.rs":"7f17a7a658e8f7aa19a6bedf70f60f3f42713316d5d60298d682bb045caaafb7","src/private/ping.rs":"d2fb45e9e178ff6b17aa9c1b5258dfcd2ed91a2b43b44dec826de256ef5e8520","src/system.rs":"d602804a72258bfd65e51c571946631732ee27d81342d8aa406e47fdd241bbfa","src/test.rs":"bfbea9416dfdc96ebc1f9af5005b5b23f2285b74ef82c74cdab11635322ea3e3","tests/collection_enabled.rs":"3327a949dbdeec493d661261abda68ffa71acc50ab24cba4fde5302749e6f16b","tests/collection_enabled_bin.rs":"d3a6458b84012a447e5cb792f2292a06951ed252fad803b9166b437bacba542c","tests/common/mod.rs":"2fd391c5eb45f56fdfa3261dd631406c67ed36b10b0d5432febe2483da5c9d89","tests/custom_distribution_buffered.rs":"47c13d1f39adf3881e10caa19e0c08235f08958809e234bf37a79d37d7322cd5","tests/init_fails.rs":"ca7fa1b3dd6a21a9e005b7a4f0a18664c4bceb952dd463db8316500f72280d5b","tests/interruptible_shutdown.rs":"3d954bbe47d4f5fd103c51a4ff99f151662143c25c826da9734a00cd215909b9","tests/memory_distribution_buffered.rs":"db487475a5cf17a0864ccf150984ebdd28bf616573772cf678246cc1bdbcbc0f","tests/metric_metadata.rs":"05c947d3decf0a3281378dbb108080a05319ad8f130af5b07f9b049b80e5f04f","tests/near-empty-c0ffee-db.safe.bin":"89afb3bb8fc94430fb0ed0fe55f85f3f8bcc8fd0fed69a9df13cc560294ec9f5","tests/never_init.rs":"51fff5618f6603bc0945d70131698d10a1c6275f43bbc22a2de5807f8a79229f","tests/no_time_to_init.rs":"2ede23df6618ff1cb5ae3b7bbf95900ad0fd92072afa2e0319bf147b4f75cefc","tests/overflowing_preinit.rs":"985e140460a100986fd051ce901b787a3a7a9747a856cd06066b740ac7d2381c","tests/persist_ping_lifetime_nopanic.rs":"18379d3ffbf4a2c8c684c04ff7a0660b86dfbbb447db2d24dfed6073cb7ddf8f","tests/schema.rs":"23b49005402b914e55a0c5c155f30c2662c609f79be78d1385ec25b3600b3547","tests/simple.rs":"15c76a1b5a336fd6abfbdebafc971f5c6a9b75107ddbca65f0031cde3e2886da","tests/test-delayed-ping-data.sh":"4a6db98b4df6b77898ace6a8b4e8b4c60d3e5c44873bbf38c62e83583e27a3ff","tests/test-enabled-pings.sh":"06656e38f63e65475006b107dd6bd179b0cbaa1fad1470de38e679e91a9315a3","tests/test-pending-gets-removed.sh":"e335f2f00fa97a61b6d94e0005fb3b9de8c8db8076111a67ca47d85392039ea9","tests/test-ping-lifetime-flush.sh":"e8f118ea2f6fd973809e38d5e828a03cfccfe0b0f497ccde5ec92d6d1380c071","tests/test-shutdown-blocking.sh":"a44d8d4bbe2ee3ede9e48121150ae7a5386025160c5cef2181ca142232c5fb27","tests/test-thread-crashing.sh":"f3cd0cc8a7b4fe82bef0fe6fbfbbe45fbad6da3afe0f82578bc5cfb2d6527ac6","tests/timing_distribution_buffered.rs":"501f7289c0c28f0ab83838c88b058999b19436d0f2b693be0787513d7b67e06d","tests/timing_distribution_single_sample.rs":"4f9498b6ef29913da0356027efe5f572c81d2f426e8538c068b54a1cfa33c1b8","tests/upload_timing.rs":"b3b9db197bc2ec41556388969a6bf289e7ef19e05b9019bc2bd98c823fcf6ea3","tests/uploader_capabilities.rs":"347f19e534a50a211ea179d6818631270d1b4ec468098e6b6abcde1e4a6a9bca"},"package":"251b9cb685554b96dcf785dba69ce90447006dd6d9229db783336c981c3777e1"}

10
third_party/rust/glean/Cargo.lock generated vendored
View File

@@ -135,9 +135,9 @@ dependencies = [
[[package]]
name = "crossbeam-channel"
version = "0.5.15"
version = "0.5.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2"
checksum = "06ba6d68e24814cb8de6bb986db8222d3a027d15872cabc0d18817bc3c0e4471"
dependencies = [
"crossbeam-utils",
]
@@ -242,7 +242,7 @@ dependencies = [
[[package]]
name = "glean"
version = "64.1.1"
version = "64.0.1"
dependencies = [
"crossbeam-channel",
"env_logger",
@@ -260,9 +260,9 @@ dependencies = [
[[package]]
name = "glean-core"
version = "64.1.1"
version = "64.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ca0df94fb37669287b77e8aa300913ad1d14426d7f9e443b0ce1185349c817e"
checksum = "a49d1d62648ddeed8cb996373046ea45de93f1d1ff956aba054b9304bc305753"
dependencies = [
"android_logger",
"bincode",

View File

@@ -13,7 +13,7 @@
edition = "2021"
rust-version = "1.82"
name = "glean"
version = "64.1.1"
version = "64.0.1"
authors = [
"Jan-Erik Rediger <jrediger@mozilla.com>",
"The Glean Team <glean-team@mozilla.com>",
@@ -115,7 +115,7 @@ path = "tests/uploader_capabilities.rs"
version = "0.5"
[dependencies.glean-core]
version = "64.1.1"
version = "64.0.1"
[dependencies.inherent]
version = "1"

View File

@@ -39,8 +39,8 @@ pub use glean_core::{
Datetime, DistributionData, MemoryUnit, MetricIdentifier, Rate, RecordedEvent, TimeUnit,
TimerId,
},
traits, AttributionMetrics, CommonMetricData, DistributionMetrics, Error, ErrorType, Glean,
HistogramType, LabeledMetricData, Lifetime, PingRateLimit, RecordedExperiment, Result,
traits, CommonMetricData, Error, ErrorType, Glean, HistogramType, LabeledMetricData, Lifetime,
PingRateLimit, RecordedExperiment, Result,
};
mod configuration;
@@ -356,31 +356,5 @@ pub fn get_registered_ping_names() -> Vec<String> {
glean_core::glean_get_registered_ping_names()
}
/// Updates attribution fields with new values.
/// AttributionMetrics fields with `None` values will not overwrite older values.
pub fn update_attribution(attribution: AttributionMetrics) {
glean_core::glean_update_attribution(attribution);
}
/// **TEST-ONLY Method**
///
/// Returns the current attribution metrics.
pub fn test_get_attribution() -> AttributionMetrics {
glean_core::glean_test_get_attribution()
}
/// Updates distribution fields with new values.
/// DistributionMetrics fields with `None` values will not overwrite older values.
pub fn update_distribution(distribution: DistributionMetrics) {
glean_core::glean_update_distribution(distribution);
}
/// **TEST-ONLY Method**
///
/// Returns the current distribution metrics.
pub fn test_get_distribution() -> DistributionMetrics {
glean_core::glean_test_get_distribution()
}
#[cfg(test)]
mod test;

View File

@@ -1501,49 +1501,3 @@ fn pings_ride_along_builtin_pings() {
let url = r.recv().unwrap();
assert!(url.contains("ride-along"));
}
#[test]
fn test_attribution_and_distribution_updates_before_glean_inits() {
let _lock = lock_test();
let dir = tempfile::tempdir().unwrap();
let tmpname = dir.path().to_path_buf();
destroy_glean(true, &tmpname);
// No Glean, let's set and update some attribution + distribution.
let mut attribution = AttributionMetrics {
source: Some("source".into()),
medium: Some("medium".into()),
campaign: Some("campaign".into()),
term: Some("term".into()),
content: Some("content".into()),
};
let distribution = DistributionMetrics {
name: Some("name".into()),
};
update_attribution(attribution.clone());
update_distribution(distribution);
let attribution_update = AttributionMetrics {
term: Some("new term".into()),
..Default::default()
};
let distribution_update = DistributionMetrics {
name: Some("different name".into()),
};
update_attribution(attribution_update);
update_distribution(distribution_update.clone());
test_reset_glean(
ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID)
.with_server_endpoint("invalid-test-host")
.build(),
ClientInfoMetrics::unknown(),
false,
);
// Ensure the updated attribution + distribution are correctly stored.
attribution.term = Some("new term".into());
assert_eq!(attribution, test_get_attribution());
assert_eq!(distribution_update, test_get_distribution());
}

View File

@@ -587,7 +587,7 @@ mod test {
None,
);
metric.get(&"1".repeat(112)).set(true);
metric.get(&"1".repeat(72)).set(true);
assert_eq!(
1,

View File

@@ -407,11 +407,11 @@ class Labeled<TimingDistributionMetric, DynamicLabel> {
TimingDistributionMetric MaybeTruncateAndGet(const nsACString& aLabel) const {
// bug 1959765 is for incorporating this behaviour into the SDK.
if (aLabel.Length() < 112) {
if (aLabel.Length() < 72) { // bug 1959696 will up this to 112.
return Get(aLabel);
}
nsAutoCStringN<111> truncated;
truncated.Append(aLabel.BeginReading(), 108);
nsAutoCStringN<71> truncated; // bug 1959696 will up this to 111.
truncated.Append(aLabel.BeginReading(), 68);
truncated += "...";
return Get(truncated);
}

View File

@@ -112,7 +112,6 @@ gecko_metrics = [
firefox_desktop_metrics = [
"browser/actors/metrics.yaml",
"browser/components/asrouter/metrics.yaml",
"browser/components/attribution/metrics.yaml",
"browser/components/backup/metrics.yaml",
"browser/components/doh/metrics.yaml",
"browser/components/downloads/metrics.yaml",

View File

@@ -36,8 +36,6 @@ mod init;
pub use init::fog_init;
use glean::{AttributionMetrics, DistributionMetrics};
#[no_mangle]
pub extern "C" fn fog_shutdown() {
glean::shutdown();
@@ -270,95 +268,3 @@ pub extern "C" fn fog_apply_serverknobs(serverknobs_path: &nsAString) -> bool {
true
}
#[repr(C)]
pub struct FogAttributionMetrics {
source: nsCString,
medium: nsCString,
campaign: nsCString,
term: nsCString,
content: nsCString,
}
impl FogAttributionMetrics {
fn take(&mut self, other: AttributionMetrics) {
if let Some(source) = other.source {
self.source = source.into();
}
if let Some(medium) = other.medium {
self.medium = medium.into();
}
if let Some(campaign) = other.campaign {
self.campaign = campaign.into();
}
if let Some(term) = other.term {
self.term = term.into();
}
if let Some(content) = other.content {
self.content = content.into();
}
}
}
impl From<&FogAttributionMetrics> for AttributionMetrics {
fn from(value: &FogAttributionMetrics) -> Self {
let to_opt_string = |s: &nsCString| {
if s.is_empty() {
None
} else {
Some(s.to_utf8().into_owned())
}
};
AttributionMetrics {
source: to_opt_string(&value.source),
medium: to_opt_string(&value.medium),
campaign: to_opt_string(&value.campaign),
term: to_opt_string(&value.term),
content: to_opt_string(&value.content),
}
}
}
#[repr(C)]
pub struct FogDistributionMetrics {
name: nsCString,
}
impl FogDistributionMetrics {
fn take(&mut self, other: DistributionMetrics) {
if let Some(name) = other.name {
self.name = name.into();
}
}
}
impl From<&FogDistributionMetrics> for DistributionMetrics {
fn from(value: &FogDistributionMetrics) -> Self {
let name = if value.name.is_empty() {
None
} else {
Some(value.name.to_utf8().into_owned())
};
DistributionMetrics { name }
}
}
#[no_mangle]
pub extern "C" fn fog_update_attribution(attr: &FogAttributionMetrics) {
glean::update_attribution(attr.into());
}
#[no_mangle]
pub extern "C" fn fog_test_get_attribution(value: &mut FogAttributionMetrics) {
value.take(glean::test_get_attribution());
}
#[no_mangle]
pub extern "C" fn fog_update_distribution(dist: &FogDistributionMetrics) {
glean::update_distribution(dist.into());
}
#[no_mangle]
pub extern "C" fn fog_test_get_distribution(value: &mut FogDistributionMetrics) {
value.take(glean::test_get_distribution());
}

View File

@@ -30,7 +30,7 @@ add_task(async () => {
undefined,
Glean.testOnlyIpc.aLabeledCounter.__other__.testGetValue()
);
Glean.testOnlyIpc.aLabeledCounter["1".repeat(112)].add(3);
Glean.testOnlyIpc.aLabeledCounter["1".repeat(72)].add(3);
Assert.throws(
() => Glean.testOnlyIpc.aLabeledCounter.__other__.testGetValue(),
/DataError/,
@@ -44,6 +44,7 @@ add_task(async () => {
{
a_label: 1,
another_label: 2,
["1".repeat(72)]: 3,
},
value
);

View File

@@ -609,8 +609,9 @@ TEST_F(FOGFixture, TestLabeledTimingDistWorks) {
}
TEST_F(FOGFixture, TestLabeledTimingDistTruncateGet) {
// Note that bug 1959696 will up this limit to 111.
auto longKey =
"this is a label that is longer than the new label limit of 111 characters introduced in bug 1959696 in April of 2025."_ns;
"this is a key that is longer than the present limit of 71 characters ok?"_ns;
auto sec = TimeDuration::FromMilliseconds(1);
test_only::where_has_the_time_gone.MaybeTruncateAndGet(longKey)

View File

@@ -1,69 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
add_setup(
/* on Android FOG is set up through head.js */
{ skip_if: () => AppConstants.platform == "android" },
function test_setup() {
// FOG needs a profile directory to put its data in.
do_get_profile();
// We need to initialize it once, otherwise operations will be stuck in the pre-init queue.
Services.fog.initializeFOG();
}
);
add_task(function test_attribution_works() {
// Ensure we aren't racing Glean init.
// (Remove upon vendoring of a fix to bug 1959515).
Glean.testOnly.balloons.testGetValue();
let attr = Services.fog.testGetAttribution();
Assert.deepEqual(
attr,
{
source: null,
medium: null,
campaign: null,
term: null,
content: null,
},
"Initial attribution should be empty."
);
Services.fog.updateAttribution("source", null, "campaign", null, "content");
let expected = {
source: "source",
medium: null,
campaign: "campaign",
term: null,
content: "content",
};
attr = Services.fog.testGetAttribution();
Assert.deepEqual(attr, expected, "Must give what it got.");
});
add_task(function test_distribution_works() {
// Ensure we aren't racing Glean init.
// (Remove upon vendoring of a fix to bug 1959515).
Glean.testOnly.balloons.testGetValue();
let dist = Services.fog.testGetDistribution();
Assert.deepEqual(
dist,
{ name: null },
"Initial distribution should be empty."
);
Services.fog.updateDistribution("name");
dist = Services.fog.testGetDistribution();
Assert.deepEqual(dist, { name: "name" }, "Must give what it got.");
});

View File

@@ -318,7 +318,7 @@ add_task(function test_gifft_labeled_counter() {
undefined,
Glean.testOnlyIpc.aLabeledCounter.__other__.testGetValue()
);
Glean.testOnlyIpc.aLabeledCounter["1".repeat(112)].add(3);
Glean.testOnlyIpc.aLabeledCounter["1".repeat(72)].add(3);
Assert.throws(
() => Glean.testOnlyIpc.aLabeledCounter.__other__.testGetValue(),
/DataError/,
@@ -332,6 +332,7 @@ add_task(function test_gifft_labeled_counter() {
{
a_label: 4,
another_label: 2,
["1".repeat(72)]: 3,
},
value
);
@@ -496,7 +497,7 @@ add_task(async function test_gifft_labeled_boolean() {
undefined,
Glean.testOnly.mirrorsForLabeledBools.__other__.testGetValue()
);
Glean.testOnly.mirrorsForLabeledBools["1".repeat(112)].set(true);
Glean.testOnly.mirrorsForLabeledBools["1".repeat(72)].set(true);
Assert.throws(
() => Glean.testOnly.mirrorsForLabeledBools.__other__.testGetValue(),
/DataError/,
@@ -509,6 +510,7 @@ add_task(async function test_gifft_labeled_boolean() {
{
a_label: true,
another_label: false,
["1".repeat(72)]: true,
},
value
);
@@ -807,7 +809,7 @@ add_task(async function test_gifft_labeled_quantity() {
Assert.equal(1, Glean.testOnly.buttonJars.whoseGot.testGetValue());
// What about invalid/__other__?
Assert.equal(undefined, Glean.testOnly.buttonJars.__other__.testGetValue());
Glean.testOnly.buttonJars["1".repeat(112)].set(9000);
Glean.testOnly.buttonJars["1".repeat(72)].set(9000);
Assert.throws(
() => Glean.testOnly.buttonJars.__other__.testGetValue(),
/DataError/,
@@ -821,6 +823,7 @@ add_task(async function test_gifft_labeled_quantity() {
{
pants: 42,
whoseGot: 1,
["1".repeat(72)]: 9000,
},
value
);

View File

@@ -103,9 +103,7 @@ add_task({ skip_if: () => runningInParent }, async function run_child_stuff() {
// Has to be different from aLabeledCounter so the error we record doesn't
// get in the way.
Glean.testOnlyIpc.anotherLabeledCounter["1".repeat(112)].add(
INVALID_COUNTERS
);
Glean.testOnlyIpc.anotherLabeledCounter["1".repeat(72)].add(INVALID_COUNTERS);
Glean.testOnlyIpc.aLabeledCounterForHgram.true.add(1);
Glean.testOnlyIpc.aLabeledCounterForHgram.false.add(1);
@@ -279,7 +277,12 @@ add_task(
"telemetry.test.mirror_for_labeled_counter",
"content"
);
Assert.deepEqual(undefined, value);
Assert.deepEqual(
{
["1".repeat(72)]: INVALID_COUNTERS,
},
value
);
const boolHgramCounters = Glean.testOnlyIpc.aLabeledCounterForHgram;
Assert.equal(boolHgramCounters.true.testGetValue(), 1);

View File

@@ -321,7 +321,7 @@ add_task(async function test_fog_labels_conform() {
"wednesday",
Glean.testOnly.mabelsLabelMaker.camelCase.testGetValue()
);
const veryLong = "1".repeat(112);
const veryLong = "1".repeat(72);
Glean.testOnly.mabelsLabelMaker[veryLong].set("seventy-two");
Assert.throws(
() => Glean.testOnly.mabelsLabelMaker[veryLong].testGetValue(),
@@ -358,7 +358,7 @@ add_task(async function test_fog_labeled_boolean_works() {
undefined,
Glean.testOnly.mabelsLikeBalloons.__other__.testGetValue()
);
Glean.testOnly.mabelsLikeBalloons["1".repeat(112)].set(true);
Glean.testOnly.mabelsLikeBalloons["1".repeat(72)].set(true);
Assert.throws(
() => Glean.testOnly.mabelsLikeBalloons.__other__.testGetValue(),
/DataError/,
@@ -387,7 +387,7 @@ add_task(async function test_fog_labeled_counter_works() {
undefined,
Glean.testOnly.mabelsKitchenCounters.__other__.testGetValue()
);
Glean.testOnly.mabelsKitchenCounters["1".repeat(112)].add(1);
Glean.testOnly.mabelsKitchenCounters["1".repeat(72)].add(1);
Assert.throws(
() => Glean.testOnly.mabelsKitchenCounters.__other__.testGetValue(),
/DataError/,
@@ -416,7 +416,7 @@ add_task(async function test_fog_labeled_string_works() {
undefined,
Glean.testOnly.mabelsBalloonStrings.__other__.testGetValue()
);
Glean.testOnly.mabelsBalloonStrings["1".repeat(112)].set("valid");
Glean.testOnly.mabelsBalloonStrings["1".repeat(72)].set("valid");
Assert.throws(
() => Glean.testOnly.mabelsBalloonStrings.__other__.testGetValue(),
/DataError/
@@ -715,7 +715,7 @@ add_task(async function test_fog_labeled_custom_distribution_works() {
Glean.testOnly.mabelsCustomLabelLengths.__other__.testGetValue()
);
Glean.testOnly.mabelsCustomLabelLengths[
"1".repeat(112)
"1".repeat(72)
].accumulateSingleSample(3);
Assert.throws(
() => Glean.testOnly.mabelsCustomLabelLengths.__other__.testGetValue(),
@@ -786,7 +786,7 @@ add_task(async function test_fog_labeled_quantity_works() {
Assert.equal(0, Glean.testOnly.buttonJars.curling.testGetValue());
// What about invalid/__other__?
Assert.equal(undefined, Glean.testOnly.buttonJars.__other__.testGetValue());
Glean.testOnly.buttonJars["1".repeat(112)].set(0);
Glean.testOnly.buttonJars["1".repeat(72)].set(0);
Assert.throws(
() => Glean.testOnly.buttonJars.__other__.testGetValue(),
/DataError/,

View File

@@ -72,7 +72,7 @@ add_task({ skip_if: () => runningInParent }, async function run_child_stuff() {
COUNTERS_WITH_JUNK_ON_THEM
);
Glean.testOnly.mabelsBathroomCounters["1".repeat(112)].add(INVALID_COUNTERS);
Glean.testOnly.mabelsBathroomCounters["1".repeat(72)].add(INVALID_COUNTERS);
Glean.testOnlyIpc.irate.addToNumerator(44);
Glean.testOnlyIpc.irate.addToDenominator(14);

View File

@@ -379,7 +379,7 @@ add_task(async function test_jog_labeled_boolean_works() {
Assert.equal(undefined, Glean.jogCat.jogLabeledBool.__other__.testGetValue());
Glean.jogCat.jogLabeledBool.NowValidLabel.set(true);
Assert.ok(Glean.jogCat.jogLabeledBool.NowValidLabel.testGetValue());
Glean.jogCat.jogLabeledBool["1".repeat(112)].set(true);
Glean.jogCat.jogLabeledBool["1".repeat(72)].set(true);
Assert.throws(
() => Glean.jogCat.jogLabeledBool.__other__.testGetValue(),
/DataError/,
@@ -448,7 +448,7 @@ add_task(async function test_jog_labeled_counter_works() {
undefined,
Glean.jogCat.jogLabeledCounter.__other__.testGetValue()
);
Glean.jogCat.jogLabeledCounter["1".repeat(112)].add(1);
Glean.jogCat.jogLabeledCounter["1".repeat(72)].add(1);
Assert.throws(
() => Glean.jogCat.jogLabeledCounter.__other__.testGetValue(),
/DataError/,
@@ -486,7 +486,7 @@ add_task(async function test_jog_labeled_counter_with_static_labels_works() {
undefined,
Glean.jogCat.jogLabeledCounterWithLabels.__other__.testGetValue()
);
Glean.jogCat.jogLabeledCounterWithLabels["1".repeat(112)].add(1);
Glean.jogCat.jogLabeledCounterWithLabels["1".repeat(72)].add(1);
// TODO:(bug 1766515) - This should throw.
/*Assert.throws(
() => Glean.jogCat.jogLabeledCounterWithLabels.__other__.testGetValue(),
@@ -522,7 +522,7 @@ add_task(async function test_jog_labeled_string_works() {
undefined,
Glean.jogCat.jogLabeledString.__other__.testGetValue()
);
Glean.jogCat.jogLabeledString["1".repeat(112)].set("valid");
Glean.jogCat.jogLabeledString["1".repeat(72)].set("valid");
Assert.throws(
() => Glean.jogCat.jogLabeledString.__other__.testGetValue(),
/DataError/
@@ -559,7 +559,7 @@ add_task(async function test_jog_labeled_string_with_labels_works() {
undefined,
Glean.jogCat.jogLabeledStringWithLabels.__other__.testGetValue()
);
Glean.jogCat.jogLabeledStringWithLabels["1".repeat(112)].set("valid");
Glean.jogCat.jogLabeledStringWithLabels["1".repeat(72)].set("valid");
// TODO:(bug 1766515) - This should throw.
/*Assert.throws(
() => Glean.jogCat.jogLabeledStringWithLabels.__other__.testGetValue(),
@@ -898,7 +898,7 @@ add_task(async function test_jog_labeled_quantity_works() {
100,
Glean.jogCat.jogLabeledQuantity.NowValidLabel.testGetValue()
);
Glean.jogCat.jogLabeledQuantity["1".repeat(112)].set(true);
Glean.jogCat.jogLabeledQuantity["1".repeat(72)].set(true);
Assert.throws(
() => Glean.jogCat.jogLabeledQuantity.__other__.testGetValue(),
/DataError/,

View File

@@ -207,12 +207,12 @@ add_task({ skip_if: () => runningInParent }, async function run_child_stuff() {
Glean.jogIpc.jogLabeledCounter.label_1.add(COUNTERS_1);
Glean.jogIpc.jogLabeledCounter.label_2.add(COUNTERS_2);
Glean.jogIpc.jogLabeledCounterErr["1".repeat(112)].add(INVALID_COUNTERS);
Glean.jogIpc.jogLabeledCounterErr["1".repeat(72)].add(INVALID_COUNTERS);
Glean.jogIpc.jogLabeledCounterWithLabels.label_1.add(COUNTERS_1);
Glean.jogIpc.jogLabeledCounterWithLabels.label_2.add(COUNTERS_2);
Glean.jogIpc.jogLabeledCounterWithLabelsErr["1".repeat(112)].add(
Glean.jogIpc.jogLabeledCounterWithLabelsErr["1".repeat(72)].add(
INVALID_COUNTERS
);

View File

@@ -2,9 +2,6 @@
firefox-appdir = "browser"
head = "head.js"
["test_AttributionDistribution.js"]
skip-if = ["os == 'android'"] # FOG isn't responsible for attribution/distribution on Android.
["test_FOGIPCLimit.js"]
["test_FOGInit.js"]

View File

@@ -488,138 +488,6 @@ FOG::TestRegisterRuntimePing(
return NS_OK;
}
NS_IMETHODIMP
FOG::UpdateAttribution(const nsACString& aSource, const nsACString& aMedium,
const nsACString& aCampaign, const nsACString& aTerm,
const nsACString& aContent) {
MOZ_ASSERT(XRE_IsParentProcess());
glean::impl::FogAttributionMetrics attr{.source = nsCString(aSource),
.medium = nsCString(aMedium),
.campaign = nsCString(aCampaign),
.term = nsCString(aTerm),
.content = nsCString(aContent)};
glean::impl::fog_update_attribution(&attr);
return NS_OK;
}
NS_IMETHODIMP
FOG::TestGetAttribution(JSContext* aCx, JS::MutableHandleValue aResult) {
#ifdef MOZ_GLEAN_ANDROID
NS_WARNING("Don't test attribution from Gecko in Android. Throwing.");
aResult.set(JS::UndefinedValue());
return NS_ERROR_FAILURE;
#else
MOZ_ASSERT(XRE_IsParentProcess());
glean::impl::FogAttributionMetrics attr;
glean::impl::fog_test_get_attribution(&attr);
JS::RootedObject jsAttr(aCx, JS_NewPlainObject(aCx));
NS_ENSURE_TRUE(jsAttr, NS_ERROR_FAILURE);
JS::RootedValue jsSource(aCx);
if (attr.source.IsEmpty()) {
NS_ENSURE_TRUE(JS_DefineProperty(aCx, jsAttr, "source", JS::NullHandleValue,
JSPROP_ENUMERATE),
NS_ERROR_FAILURE);
} else if (!dom::ToJSValue(aCx, attr.source, &jsSource) ||
!JS_DefineProperty(aCx, jsAttr, "source", jsSource,
JSPROP_ENUMERATE)) {
NS_WARNING("Failed to define attribution.source.");
return NS_ERROR_FAILURE;
}
JS::RootedValue jsMedium(aCx);
if (attr.medium.IsEmpty()) {
NS_ENSURE_TRUE(JS_DefineProperty(aCx, jsAttr, "medium", JS::NullHandleValue,
JSPROP_ENUMERATE),
NS_ERROR_FAILURE);
} else if (!dom::ToJSValue(aCx, attr.medium, &jsMedium) ||
!JS_DefineProperty(aCx, jsAttr, "medium", jsMedium,
JSPROP_ENUMERATE)) {
NS_WARNING("Failed to define attribution.medium.");
return NS_ERROR_FAILURE;
}
JS::RootedValue jsCampaign(aCx);
if (attr.campaign.IsEmpty()) {
NS_ENSURE_TRUE(JS_DefineProperty(aCx, jsAttr, "campaign",
JS::NullHandleValue, JSPROP_ENUMERATE),
NS_ERROR_FAILURE);
} else if (!dom::ToJSValue(aCx, attr.campaign, &jsCampaign) ||
!JS_DefineProperty(aCx, jsAttr, "campaign", jsCampaign,
JSPROP_ENUMERATE)) {
NS_WARNING("Failed to define attribution.campaign.");
return NS_ERROR_FAILURE;
}
JS::RootedValue jsTerm(aCx);
if (attr.term.IsEmpty()) {
NS_ENSURE_TRUE(JS_DefineProperty(aCx, jsAttr, "term", JS::NullHandleValue,
JSPROP_ENUMERATE),
NS_ERROR_FAILURE);
} else if (!dom::ToJSValue(aCx, attr.term, &jsTerm) ||
!JS_DefineProperty(aCx, jsAttr, "term", jsTerm,
JSPROP_ENUMERATE)) {
NS_WARNING("Failed to define attribution.term.");
return NS_ERROR_FAILURE;
}
JS::RootedValue jsContent(aCx);
if (attr.content.IsEmpty()) {
NS_ENSURE_TRUE(JS_DefineProperty(aCx, jsAttr, "content",
JS::NullHandleValue, JSPROP_ENUMERATE),
NS_ERROR_FAILURE);
} else if (!dom::ToJSValue(aCx, attr.content, &jsContent) ||
!JS_DefineProperty(aCx, jsAttr, "content", jsContent,
JSPROP_ENUMERATE)) {
NS_WARNING("Failed to define attribution.content.");
return NS_ERROR_FAILURE;
}
aResult.setObject(*jsAttr);
return NS_OK;
#endif // MOZ_GLEAN_ANDROID
}
NS_IMETHODIMP
FOG::UpdateDistribution(const nsACString& aName) {
MOZ_ASSERT(XRE_IsParentProcess());
glean::impl::FogDistributionMetrics dist{.name = nsCString(aName)};
glean::impl::fog_update_distribution(&dist);
return NS_OK;
}
NS_IMETHODIMP
FOG::TestGetDistribution(JSContext* aCx, JS::MutableHandleValue aResult) {
#ifdef MOZ_GLEAN_ANDROID
NS_WARNING("Don't test distribution from Gecko in Android. Throwing.");
aResult.set(JS::UndefinedValue());
return NS_ERROR_FAILURE;
#else
MOZ_ASSERT(XRE_IsParentProcess());
glean::impl::FogDistributionMetrics dist;
glean::impl::fog_test_get_distribution(&dist);
JS::RootedObject jsDist(aCx, JS_NewPlainObject(aCx));
NS_ENSURE_TRUE(jsDist, NS_ERROR_FAILURE);
JS::RootedValue jsName(aCx);
if (dist.name.IsEmpty()) {
NS_ENSURE_TRUE(JS_DefineProperty(aCx, jsDist, "name", JS::NullHandleValue,
JSPROP_ENUMERATE),
NS_ERROR_FAILURE);
} else if (!dom::ToJSValue(aCx, dist.name, &jsName) ||
!JS_DefineProperty(aCx, jsDist, "name", jsName,
JSPROP_ENUMERATE)) {
NS_WARNING("Failed to define distribution.name.");
return NS_ERROR_FAILURE;
}
aResult.setObject(*jsDist);
return NS_OK;
#endif // MOZ_GLEAN_ANDROID
}
void FOG::InitMemoryReporter() { RegisterWeakMemoryReporter(this); }
MOZ_DEFINE_MALLOC_SIZE_OF(FOGMallocSizeOf)

View File

@@ -197,47 +197,4 @@ interface nsIFOG : nsISupports
in Array<ACString> aReasonCodes,
in boolean aFollowsCollectionEnabled,
in Array<ACString> aUploaderCapabilities);
/**
* Update the core attribution metrics in Glean.
*
* @param aSource - The product's attribution source (e.g. "google-play").
* @param aMedium - The product's attribution medium (e.g. "organic" for a search engine).
* @param aCampaign - The product's attribution campaign (e.g. "mozilla-org").
* @param aTerm - The product's attribution term (e.g. "browser with developer tools for android").
* @param aContent - The product's attribution content (e.g. "firefoxview").
*/
void updateAttribution(in ACString aSource,
in ACString aMedium,
in ACString aCampaign,
in ACString aTerm,
in ACString aContent);
/**
* ** Test-only Method **
*
* Returns the core attribution data from Glean.
*
* @returns the core attribution data from Glean in the form
* `{source, medium, campaign, term, content}`.
*/
[implicit_jscontext]
jsval testGetAttribution();
/**
* Update the core distribution metrics in Glean.
*
* @param aName - The product's distribution name (e.g. "MozillaOnline").
*/
void updateDistribution(in ACString aName);
/**
* ** Test-only Method **
*
* Returns the core distribution data from Glean.
*
* @returns the core distribution data from Glean in the form `{name}`.
*/
[implicit_jscontext]
jsval testGetDistribution();
};

View File

@@ -83,7 +83,7 @@ var gActiveExperimentStartupBuffer = new Map();
// For Powering arewegleanyet.com (See bug 1944592)
// Legacy Count: 110
// Glean Count: 35
// Glean Count: 19
var gGlobalEnvironment;
function getGlobal() {
@@ -1781,22 +1781,6 @@ EnvironmentCache.prototype = {
: data[key];
}
this._currentEnvironment.settings.attribution = attributionData;
let extAttribution = {
experiment: attributionData.experiment,
variation: attributionData.variation,
ua: attributionData.ua,
dltoken: attributionData.dltoken,
msstoresignedin: attributionData.msstoresignedin,
dlsource: attributionData.dlsource,
};
Services.fog.updateAttribution(
attributionData.source,
attributionData.medium,
attributionData.campaign,
attributionData.term,
attributionData.content
);
Glean.gleanAttribution.ext.set(extAttribution);
},
/**
@@ -1902,15 +1886,6 @@ EnvironmentCache.prototype = {
);
partnerData.partnerNames = partnerBranch.getChildList("");
Services.fog.updateDistribution(partnerData.distributionId);
Glean.gleanDistribution.ext.set({
distributionVersion: partnerData.distributionVersion,
partnerId: partnerData.partnerId,
distributor: partnerData.distributor,
distributorChannel: partnerData.distributorChannel,
partnerNames: partnerData.partnerNames,
});
return partnerData;
},

View File

@@ -379,18 +379,6 @@ export var TelemetryEnvironmentTesting = {
lazy.Assert.equal(typeof data.settings.attribution, "object");
lazy.Assert.equal(data.settings.attribution.source, "google.com");
lazy.Assert.equal(data.settings.attribution.dlsource, "unittest");
let attr = Services.fog.testGetAttribution();
lazy.Assert.equal(
attr.source,
"google.com",
"Must have correct attribution.source."
);
let attrExt = Glean.gleanAttribution.ext.testGetValue();
lazy.Assert.equal(
attrExt.dlsource,
"unittest",
"Must have correct dlsource."
);
}
this.checkIntlSettings(data.settings);
@@ -456,8 +444,6 @@ export var TelemetryEnvironmentTesting = {
"There must be a partner section in Environment."
);
let dist = Services.fog.testGetDistribution();
let distExt = Glean.gleanDistribution.ext.testGetValue();
for (let f in EXPECTED_FIELDS) {
let expected = isInitial ? null : EXPECTED_FIELDS[f];
lazy.Assert.strictEqual(
@@ -465,32 +451,14 @@ export var TelemetryEnvironmentTesting = {
expected,
f + " must have the correct value."
);
if (f == "distributionId") {
lazy.Assert.strictEqual(
dist.name,
expected,
"Core Glean distribution must be correct."
);
} else {
lazy.Assert.equal(
distExt[f],
expected,
`Extended Glean distribution field "${f}" must be correct.`
);
}
}
// Check that "partnerNames" exists and contains the correct element.
lazy.Assert.ok(Array.isArray(data.partner.partnerNames));
if (isInitial) {
lazy.Assert.equal(data.partner.partnerNames.length, 0);
lazy.Assert.equal(distExt.partnerNames, null);
} else {
lazy.Assert.ok(data.partner.partnerNames.includes(PARTNER_NAME));
lazy.Assert.ok(
distExt.partnerNames.includes(PARTNER_NAME),
"Glean partner names contain expected partner name."
);
}
},