Bug 1799129 - Vendor Glean v51.8.0 and glean_parser 6.3.0 r=chutten,supply-chain-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D161276
This commit is contained in:
Jan-Erik Rediger 2022-11-08 15:53:07 +00:00
parent d20dd96f8f
commit 68cd95c000
37 changed files with 276 additions and 192 deletions

8
Cargo.lock generated
View file

@ -2249,9 +2249,9 @@ dependencies = [
[[package]]
name = "glean"
version = "51.7.0"
version = "51.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dfbbb336d8195ad56be852099319eaab3ba491bc7f38d18e7ebe02242a6be20"
checksum = "13aedcf0f5dd22897f3e714f3e9340ec7841ce2dd6c2b9947784314735cc1b27"
dependencies = [
"chrono",
"crossbeam-channel",
@ -2269,9 +2269,9 @@ dependencies = [
[[package]]
name = "glean-core"
version = "51.7.0"
version = "51.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "736924672efcb4cea229f024d75057fb2d0c37bb9544fdba6d8c09f6e6c3c766"
checksum = "7f2623748bec073cec65c8f21762ad26e5421e85e42afd59e7395145db9be98b"
dependencies = [
"android_logger",
"bincode",

View file

@ -36,7 +36,7 @@ allprojects {
topsrcdir = gradle.mozconfig.topsrcdir
topobjdir = gradle.mozconfig.topobjdir
gleanVersion = "51.7.0"
gleanVersion = "51.8.0"
if (gleanVersion != getRustVersionFor("glean")) {
throw new StopExecutionException("Mismatched Glean version, expected: ${gleanVersion}," +
" found ${getRustVersionFor("glean")}")

8
gfx/wr/Cargo.lock generated
View file

@ -865,9 +865,9 @@ dependencies = [
[[package]]
name = "glean"
version = "51.7.0"
version = "51.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dfbbb336d8195ad56be852099319eaab3ba491bc7f38d18e7ebe02242a6be20"
checksum = "13aedcf0f5dd22897f3e714f3e9340ec7841ce2dd6c2b9947784314735cc1b27"
dependencies = [
"chrono",
"crossbeam-channel",
@ -885,9 +885,9 @@ dependencies = [
[[package]]
name = "glean-core"
version = "51.7.0"
version = "51.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "736924672efcb4cea229f024d75057fb2d0c37bb9544fdba6d8c09f6e6c3c766"
checksum = "7f2623748bec073cec65c8f21762ad26e5421e85e42afd59e7395145db9be98b"
dependencies = [
"android_logger",
"bincode",

View file

@ -51,7 +51,7 @@ svg_fmt = "0.4"
tracy-rs = "0.1.2"
derive_more = { version = "0.99", default-features = false, features = ["add_assign"] }
etagere = "0.2.6"
glean = "51.7.0"
glean = "51.8.0"
fog = { version = "0.1.0", optional = true }
swgl = { path = "../swgl", optional = true }
topological-sort = "0.1"

View file

@ -132,7 +132,7 @@ pth:xpcom/geckoprocesstypes_generator
pth:xpcom/idl-parser
# glean-sdk may not be installable if a wheel isn't available
# and it has to be built from source.
pypi-optional:glean-sdk==51.7.0:telemetry will not be collected
pypi-optional:glean-sdk==51.8.0: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

@ -563,6 +563,12 @@ criteria = "safe-to-deploy"
delta = "51.4.0 -> 51.5.0"
notes = "Maintained by the Glean team at Mozilla"
[[audits.glean]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
delta = "51.7.0 -> 51.8.0"
notes = "Maintained by the Glean team at Mozilla"
[[audits.glean-core]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
@ -616,6 +622,12 @@ criteria = "safe-to-deploy"
delta = "51.4.0 -> 51.5.0"
notes = "Maintained by the Glean team at Mozilla"
[[audits.glean-core]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
delta = "51.7.0 -> 51.8.0"
notes = "Maintained by the Glean team at Mozilla"
[[audits.goblin]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"

View file

@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: glean-parser
Version: 6.1.2
Version: 6.3.0
Summary: Parser tools for Mozilla's Glean telemetry
Home-page: https://github.com/mozilla/glean_parser
Author: The Glean Team
@ -86,6 +86,19 @@ $ glean_parser check < ping.json
## Unreleased
## 6.3.0
- events: Increase extras limit to 15 ([bug 1798713](https://bugzilla.mozilla.org/show_bug.cgi?id=1798713))
## 6.2.1
- Add support for Rate, Denominator and Numerator metrics for JavaScript. ([bug 1793777](https://bugzilla.mozilla.org/show_bug.cgi?id=1793777))
## 6.2.0
- [data-review] Use a template to generate the Data Review Request template ([bug 1772605](https://bugzilla.mozilla.org/show_bug.cgi?id=1772605))
- Make tag and no\_lint order deterministic ([#518](https://github.com/mozilla/glean_parser/pull/518))
## 6.1.2
- Swift: Add a conditional `import Foundation` to support generating metrics when Glean is delivered via the AppServices iOS megazord

View file

@ -1,26 +1,27 @@
glean_parser/__init__.py,sha256=bJljD052_0y-efcBhYpllICVCXOMHLcXRLNyrvfgt5A,533
glean_parser/__main__.py,sha256=rLs4QpTvLIRGF223xSYkshGD9_aJmuDNOGj8PfZLqRE,7002
glean_parser/__main__.py,sha256=ZrmFSG6rJfs_bnXOSb-3b7_Bega-CmhE3SZgWO3G3_E,7066
glean_parser/coverage.py,sha256=2IwC4XMDtDamMkBFoYilmqJzW4gyypq65YVCur8SNas,4405
glean_parser/data_review.py,sha256=s_aguo4tCiPhpJoHUfsE1Z91N7wXyQt11hjH11jmqiM,5507
glean_parser/javascript.py,sha256=okBdomD628U0kO-r23mWC8lXPuVbZmL97wMCufgBYA8,11443
glean_parser/data_review.py,sha256=BweeeTkNNS6HrIDkztawhbDByrk_-Avxpg7YeST3VAs,2152
glean_parser/javascript.py,sha256=w4ZhNBHBKWYk0h3t7G0Ud2tR__hRqzn9dlEXNKLdQrA,11230
glean_parser/kotlin.py,sha256=kMCpULsg_LTx4UI1HMtRXtkA3YtEruqtvfOIauMlO74,13271
glean_parser/lint.py,sha256=_N294HLf5-PgGa-oQxb64xcLP24W9874IGheGzjO6jk,17088
glean_parser/markdown.py,sha256=GkCr1CrV6mnRQseT6FO1-JJ7Eup8X3lxUfRMBTxXpe4,9066
glean_parser/metrics.py,sha256=OqTEH1qfum1_EpRZNmFMSl2xP_kKVvKlPKTREUPJABY,12036
glean_parser/parser.py,sha256=OydnNQYHfNW_UKNzZuZCL-ZEAxTlVzsabXNMxmUuht4,15741
glean_parser/parser.py,sha256=pcgB0gRnmXWCPqNHqQf67mAS6DrD89tMpi4oxjQC4k4,15749
glean_parser/pings.py,sha256=6XakkO9jnQc2oojLQJvTCMwF7w-BEm6rR54tunCb38o,2805
glean_parser/rust.py,sha256=Nq3s--LW0-PFhRCDpLOJXYWxQXbcSOA6OsFIkxUGnYc,6116
glean_parser/swift.py,sha256=0ncUjywXLqhCNta1qkzxb8PoVCmWi47UedCvb7bkdLc,9062
glean_parser/tags.py,sha256=bemKYvcbMO4JrghiNSe-A4BNNDtx_FlUPkgrPPJy84Y,1391
glean_parser/translate.py,sha256=4mHMtRjOusbFNvS7-zibKg6zE_qCRmpjWh6GjwaabSo,7964
glean_parser/translation_options.py,sha256=TpsvgaejlmOWkmTkarMx7cBVcjhshlJi33jsAbw9Wjc,2207
glean_parser/translation_options.py,sha256=Lxzr6G7MP0tC_ZYlZXftS4j0SLiqO-5mGVTEc7ggXis,2037
glean_parser/util.py,sha256=Hei33QDq4a_lIHp5j98KovN6C7tmLrvVamEX2a1DcTo,16825
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=cw6nR9cjd1E0O0_daSZ-w1dFvClMcOrpJsFb-PNnMSw,23887
glean_parser/schemas/metrics.2-0-0.schema.yaml,sha256=nx3X2SBaX1SqP8OBv0lvnT_TpQN1BRulnzmp_ID5QQI,23887
glean_parser/schemas/pings.1-0-0.schema.yaml,sha256=hwCnsKpEysmrmVp-QHGBArEkVY3vaU1rVsxlTwhAzws,4315
glean_parser/schemas/pings.2-0-0.schema.yaml,sha256=rD1s-rfz1xC9biHyLfBCnsoQxVYHwpe_S05awfe2xDA,4363
glean_parser/schemas/tags.1-0-0.schema.yaml,sha256=OGXIJlvvVW1vaqB_NVZnwKeZ-sLlfH57vjBSHbj6DNI,1231
glean_parser/templates/data_review.jinja2,sha256=jeYU29T1zLSyu9fKBBFu5BFPfIw8_hmOUXw8RXhRXK8,3287
glean_parser/templates/javascript.buildinfo.jinja2,sha256=4mXiZCQIk9if4lxlA05kpSIL4a95IdwGwqle2OqqNAs,474
glean_parser/templates/javascript.jinja2,sha256=cT_bG-jC6m4afECXmcsqHwiiHjRuVtJnfv90OD2Mwxw,2669
glean_parser/templates/kotlin.buildinfo.jinja2,sha256=X0lk2SNu5OIIj2i6mUyF9CWFQIonLgfqkgT5fA-5G6c,920
@ -28,12 +29,12 @@ glean_parser/templates/kotlin.geckoview.jinja2,sha256=MJOgtoDXmBjE9pwk-G6T89y36R
glean_parser/templates/kotlin.jinja2,sha256=h6RaxhGwh1G1NVqhGb4l2Jtl2orhyf8iFL-Cj3qb6lk,5162
glean_parser/templates/markdown.jinja2,sha256=vAHHGGm28HRDPd3zO_wQMAUZIuxE9uQ7hl3NpXxcKV4,3425
glean_parser/templates/qmldir.jinja2,sha256=m6IGsp-tgTiOfQ7VN8XW6GqX0gJqJkt3B6Pkaul6FVo,156
glean_parser/templates/rust.jinja2,sha256=rskbE0LMcCTO488faVXrGAP_e-l7rUpysbkNZXKk1Ck,11083
glean_parser/templates/rust.jinja2,sha256=3X4JNVVz2KLhFXTsCg8LQ9JL_dopi7P-yhZcir7-dTw,11104
glean_parser/templates/swift.jinja2,sha256=yfv1qJLrfR2cc3t35fFPgveuuATBjg1Hge-3ka5rpFc,5270
glean_parser-6.1.2.dist-info/AUTHORS.md,sha256=yxgj8MioO4wUnrh0gmfb8l3DJJrf-l4HmmEDbQsbbNI,455
glean_parser-6.1.2.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
glean_parser-6.1.2.dist-info/METADATA,sha256=_paEotrxyZsT2pVvTmvF8EAattiUUkTK3RdZKL8OWes,26073
glean_parser-6.1.2.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
glean_parser-6.1.2.dist-info/entry_points.txt,sha256=s-clJTIqp-PpJD-n3AnIQZFkTafIrzsTbAPX9vNY018,69
glean_parser-6.1.2.dist-info/top_level.txt,sha256=q7T3duD-9tYZFyDry6Wv2LcdMsK2jGnzdDFhxWcT2Z8,13
glean_parser-6.1.2.dist-info/RECORD,,
glean_parser-6.3.0.dist-info/AUTHORS.md,sha256=yxgj8MioO4wUnrh0gmfb8l3DJJrf-l4HmmEDbQsbbNI,455
glean_parser-6.3.0.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
glean_parser-6.3.0.dist-info/METADATA,sha256=5JMMbGW6jxTUOvKV4MJnSQM7IEirQTqzw_zTIsCYOTM,26607
glean_parser-6.3.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
glean_parser-6.3.0.dist-info/entry_points.txt,sha256=s-clJTIqp-PpJD-n3AnIQZFkTafIrzsTbAPX9vNY018,69
glean_parser-6.3.0.dist-info/top_level.txt,sha256=q7T3duD-9tYZFyDry6Wv2LcdMsK2jGnzdDFhxWcT2Z8,13
glean_parser-6.3.0.dist-info/RECORD,,

View file

@ -274,7 +274,10 @@ def main_wrapper(args=None):
main(args=args)
except SystemExit as e:
if e.code != 0:
print(f"ERROR running glean_parser v{glean_parser.__version__}")
print(
f"ERROR running glean_parser v{glean_parser.__version__}",
file=sys.stderr,
)
raise

View file

@ -46,119 +46,34 @@ def generate(
reobj = re.compile(f"\\W{bug}\\W|\\W{bug}$")
durations = set()
responsible_emails = set()
metrics_table = ""
for category_name, metrics in all_objects.value.items():
filtered_metrics = list()
for metrics in all_objects.value.values():
for metric in metrics.values():
if not any([len(reobj.findall(bug)) == 1 for bug in metric.bugs]):
continue
metric_name = util.snake_case(metric.name)
category_name = util.snake_case(category_name)
one_line_desc = metric.description.replace("\n", " ")
sensitivity = ", ".join([s.name for s in metric.data_sensitivity])
last_bug = metric.bugs[-1]
metrics_table += f"`{category_name}.{metric_name}` | "
metrics_table += f"{one_line_desc} | {sensitivity} | {last_bug}\n"
if metric.type == "event" and len(metric.allowed_extra_keys):
for extra_name, extra_detail in metric.extra_keys.items():
extra_one_line_desc = extra_detail["description"].replace("\n", " ")
metrics_table += f"`{category_name}.{metric_name}#{extra_name}` | "
metrics_table += (
f"{extra_one_line_desc} | {sensitivity} | {last_bug}\n"
)
filtered_metrics.append(metric)
durations.add(metric.expires)
if metric.expires == "never":
responsible_emails.update(metric.notification_emails)
if len(durations) == 1:
duration = next(iter(durations))
if duration == "never":
collection_duration = "This collection will be collected permanently."
else:
collection_duration = f"This collection has expiry '{duration}'"
else:
collection_duration = "Parts of this collection expire at different times: "
collection_duration += f"{durations}"
if "never" in durations:
collection_duration += "\n" + ", ".join(responsible_emails) + " "
collection_duration += "will be responsible for the permanent collections."
if len(durations) == 0:
if len(filtered_metrics) == 0:
print(f"I'm sorry, I couldn't find metrics matching the bug number {bug}.")
return 1
# This template is pulled from
# https://github.com/mozilla/data-review/blob/main/request.md
print(
"""
!! Reminder: it is your responsibility to complete and check the correctness of
!! this automatically-generated request skeleton before requesting Data
!! Collection Review. See https://wiki.mozilla.org/Data_Collection for details.
DATA REVIEW REQUEST
1. What questions will you answer with this data?
TODO: Fill this in.
2. Why does Mozilla need to answer these questions? Are there benefits for users?
Do we need this information to address product or business requirements?
TODO: Fill this in.
3. What alternative methods did you consider to answer these questions?
Why were they not sufficient?
TODO: Fill this in.
4. Can current instrumentation answer these questions?
TODO: Fill this in.
5. List all proposed measurements and indicate the category of data collection for each
measurement, using the Firefox data collection categories found on the Mozilla wiki.
Measurement Name | Measurement Description | Data Collection Category | Tracking Bug
---------------- | ----------------------- | ------------------------ | ------------"""
template = util.get_jinja2_template(
"data_review.jinja2",
filters=(("snake_case", util.snake_case),),
)
print(metrics_table)
print(
"""
6. Please provide a link to the documentation for this data collection which
describes the ultimate data set in a public, complete, and accurate way.
This collection is Glean so is documented
[in the Glean Dictionary](https://dictionary.telemetry.mozilla.org).
7. How long will this data be collected?
"""
template.render(
metrics=filtered_metrics,
durations=durations,
responsible_emails=responsible_emails,
)
print(collection_duration)
print(
"""
8. What populations will you measure?
All channels, countries, and locales. No filters.
9. If this data collection is default on, what is the opt-out mechanism for users?
These collections are Glean. The opt-out can be found in the product's preferences.
10. Please provide a general description of how you will analyze this data.
TODO: Fill this in.
11. Where do you intend to share the results of your analysis?
TODO: Fill this in.
12. Is there a third-party tool (i.e. not Glean or Telemetry) that you
are proposing to use for this data collection?
No.
"""
)
return 0

View file

@ -10,7 +10,6 @@ Outputter to generate Javascript code for metrics.
import enum
import json
import sys
from pathlib import Path
from typing import Any, Dict, Optional, Callable
@ -22,12 +21,27 @@ from . import util
def javascript_datatypes_filter(value: util.JSONType) -> str:
"""
A Jinja2 filter that renders Javascript literals.
Based on Python's JSONEncoder, but overrides:
- lists to use listOf
- sets to use setOf
- Rate objects to a CommonMetricData initializer
(for external Denominators' Numerators lists)
"""
class JavascriptEncoder(json.JSONEncoder):
def iterencode(self, value):
if isinstance(value, enum.Enum):
yield from super().iterencode(util.camelize(value.name))
elif isinstance(value, list):
yield "["
first = True
for subvalue in value:
if not first:
yield ", "
yield from self.iterencode(subvalue)
first = False
yield "]"
elif isinstance(value, set):
yield "["
first = True
@ -37,6 +51,17 @@ def javascript_datatypes_filter(value: util.JSONType) -> str:
yield from self.iterencode(subvalue)
first = False
yield "]"
elif isinstance(value, metrics.Rate):
yield "CommonMetricData("
first = True
for arg_name in util.common_metric_args:
if hasattr(value, arg_name):
if not first:
yield ", "
yield f"{util.camelize(arg_name)} = "
yield from self.iterencode(getattr(value, arg_name))
first = False
yield ")"
else:
yield from super().iterencode(value)
@ -148,16 +173,11 @@ def output(
it will use that date.
Other values will throw an error.
If not set it will use the current date & time.
- `fail_rates`: When `true` it fails when encountering rate metrics.
When `false` it will warn and skip rate metrics.
Defaults to "true".
"""
if options is None:
options = {}
fail_rates = options.get("fail_rates", "true").lower() == "true"
fail_rate_level = "ERROR" if fail_rates else "WARN"
platform = options.get("platform", "webext")
accepted_platforms = ["qt", "webext", "node"]
if platform not in accepted_platforms:
@ -186,26 +206,6 @@ def output(
filename = util.camelize(category_key) + extension
filepath = output_dir / filename
# FIXME: Add support for rate (and numerator & denominator) in Glean.js
todelete = []
for key, metric in category_val.items():
if isinstance(metric, metrics.Rate):
print(
f"{fail_rate_level}: Rate metric not supported. Metric: {category_key}.{metric.name}", # noqa: E501
file=sys.stderr,
)
todelete.append(key)
if isinstance(metric, metrics.Denominator):
print(
f"{fail_rate_level}: Rate metric not supported. Dropping numerators. Metric: {category_key}.{metric.name}", # noqa: E501
file=sys.stderr,
)
del metric.numerators
if fail_rates and todelete:
print("Failed due to previous errors.", file=sys.stderr)
raise ValueError("Unsupported metric type encountered.")
types = set(
[
# This takes care of the regular metric type imports

View file

@ -244,9 +244,9 @@ def _instantiate_metrics(
metric_obj = None
if metric_obj is not None:
metric_obj.no_lint = list(set(metric_obj.no_lint + global_no_lint))
metric_obj.no_lint = sorted(set(metric_obj.no_lint + global_no_lint))
if len(global_tags):
metric_obj.metadata["tags"] = list(
metric_obj.metadata["tags"] = sorted(
set(metric_obj.metadata.get("tags", []) + global_tags)
)
@ -311,7 +311,7 @@ def _instantiate_pings(
continue
if ping_obj is not None:
ping_obj.no_lint = list(set(ping_obj.no_lint + global_no_lint))
ping_obj.no_lint = sorted(set(ping_obj.no_lint + global_no_lint))
if isinstance(filepath, Path) and ping_obj.defined_in is not None:
ping_obj.defined_in["filepath"] = str(filepath)
@ -363,7 +363,7 @@ def _instantiate_tags(
continue
if tag_obj is not None:
tag_obj.no_lint = list(set(tag_obj.no_lint + global_no_lint))
tag_obj.no_lint = sorted(set(tag_obj.no_lint + global_no_lint))
if isinstance(filepath, Path) and tag_obj.defined_in is not None:
tag_obj.defined_in["filepath"] = str(filepath)

View file

@ -390,7 +390,7 @@ definitions:
- quantity
required:
- description
maxProperties: 10
maxProperties: 15
default: {}
gecko_datapoint:

View file

@ -0,0 +1,82 @@
!! Reminder: it is your responsibility to complete and check the correctness of
!! this automatically-generated request skeleton before requesting Data
!! Collection Review. See https://wiki.mozilla.org/Data_Collection for details.
{# Data Review Request Template pulled from
https://github.com/mozilla/data-review/blob/main/request.md #}
DATA REVIEW REQUEST
1. What questions will you answer with this data?
{{ "TODO: Fill this in." if not questions }}
2. Why does Mozilla need to answer these questions? Are there benefits for users?
Do we need this information to address product or business requirements?
{{ "TODO: Fill this in." if not why }}
3. What alternative methods did you consider to answer these questions?
Why were they not sufficient?
{{ "TODO: Fill this in." if not methods }}
4. Can current instrumentation answer these questions?
{{ "TODO: Fill this in." if not current_instrumentation_answers }}
5. List all proposed measurements and indicate the category of data collection for each
measurement, using the Firefox data collection categories found on the Mozilla wiki.
Measurement Name | Measurement Description | Data Collection Category | Tracking Bug
---------------- | ----------------------- | ------------------------ | ------------
{% for metric in metrics %}
{% if metric.type == "event" and metric.allowed_extra_keys %}
{% for extra_name, extra_detail in metric.extra_keys.items() %}
`{{ metric.category|snake_case }}.{{ metric.name|snake_case }}#{{ extra_name }} | {{ extra_detail["description"]|replace("\n", " ") }} | {{ metric.data_sensitivity|join(", ", attribute="name") }} | {{ metric.bugs|last }}
{% endfor %}
{% else %}
`{{ metric.category|snake_case }}.{{ metric.name|snake_case }}` | {{ metric.description|replace("\n", " ") }} | {{ metric.data_sensitivity|join(", ", attribute="name") }} | {{ metric.bugs|last }}
{% endif %}
{% endfor %}
6. Please provide a link to the documentation for this data collection which
describes the ultimate data set in a public, complete, and accurate way.
This collection is Glean so is documented [in the Glean Dictionary](https://dictionary.telemetry.mozilla.org).
7. How long will this data be collected?
{% if durations|length == 1 %}
{% for duration in durations %}
{% if duration == "never" %}
This collection will be collected permanently.
{% else %}
This collection has expiry '{{duration}}'.
{% endif %}
{% endfor %}
{% else %}
Parts of this collection expire at different times: {{ durations|join(", ") }}.
{% endif %}
{% if "never" in durations %}
{{ responsible_emails|join(", ") }} will be responsible for the permanent collections.
{% endif %}
8. What populations will you measure?
All channels, countries, and locales. No filters.
9. If this data collection is default on, what is the opt-out mechanism for users?
These collections are Glean. The opt-out can be found in the product's preferences.
10. Please provide a general description of how you will analyze this data.
{{ "TODO: Fill this in." if not analysis_how }}
11. Where do you intend to share the results of your analysis?
{{ "TODO: Fill this in." if not analysis_where }}
12. Is there a third-party tool (i.e. not Glean or Telemetry) that you
are proposing to use for this data collection?
No.

View file

@ -53,7 +53,7 @@ pub static {{ obj.name|snake_case }}: ::glean::private::__export::Lazy<::glean::
{% else %}
pub mod {{ category.name|snake_case }} {
#[allow(unused_imports)] // HistogramType might be unusued, let's avoid warnings
use glean::{private::*, traits::ExtraKeys, CommonMetricData, HistogramType, Lifetime, TimeUnit, MemoryUnit};
use glean::{private::*, traits::ExtraKeys, traits::NoExtraKeys, CommonMetricData, HistogramType, Lifetime, TimeUnit, MemoryUnit};
{% for obj in category.objs.values() %}
{% if obj|attr("_generate_enums") %}

View file

@ -41,9 +41,6 @@ JavaScript:
it will use that date.
Other values will throw an error.
If not set it will use the current date & time.
- `fail_rates`: When `true` it fails when encountering rate metrics.
When `false` it will warn and skip rate metrics.
Defaults to "true".
Markdown:
- `project_title`: The project's title.

6
third_party/python/poetry.lock generated vendored
View file

@ -204,7 +204,7 @@ python-versions = ">=3.6"
[[package]]
name = "glean-parser"
version = "6.1.2"
version = "6.3.0"
description = "Parser tools for Mozilla's Glean telemetry"
category = "main"
optional = false
@ -878,8 +878,8 @@ giturlparse = [
{file = "giturlparse-0.10.0.tar.gz", hash = "sha256:2595ab291d30717cda8474b874c9fd509f1b9802ad7f6968c36a45e4b13eb337"},
]
glean-parser = [
{file = "glean_parser-6.1.2-py3-none-any.whl", hash = "sha256:e801af6463b7e0ba79d97ddfc0a58d9d71121c93cea601417571e33fa8142270"},
{file = "glean_parser-6.1.2.tar.gz", hash = "sha256:12a0fecedc1144d77fa571e0422ff3fea4dbadc381d631bea800a6b2f58f4f7f"},
{file = "glean_parser-6.3.0-py3-none-any.whl", hash = "sha256:b6cb6ab1247f3eb8e64427644dbdc0ef1fbf46af593225d66e24aa967dcaa23e"},
{file = "glean_parser-6.3.0.tar.gz", hash = "sha256:946ef3d7fe24fbbe8101964791b7ad0e609d1ee6a21a87b33f805de8577e6f40"},
]
idna = [
{file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"},

File diff suppressed because one or more lines are too long

View file

@ -12,7 +12,7 @@
[package]
edition = "2018"
name = "glean-core"
version = "51.7.0"
version = "51.8.0"
authors = [
"Jan-Erik Rediger <jrediger@mozilla.com>",
"The Glean Team <glean-team@mozilla.com>",
@ -34,7 +34,7 @@ license = "MPL-2.0"
repository = "https://github.com/mozilla/glean"
[package.metadata.glean]
glean-parser = "6.1.2"
glean-parser = "6.3.0"
[dependencies.bincode]
version = "1.2.1"

View file

@ -16,7 +16,7 @@ use rkv::StoreError;
///
/// [`Result`]: https://doc.rust-lang.org/stable/std/result/enum.Result.html
/// [`Error`]: std.struct.Error.html
pub type Result<T> = result::Result<T, Error>;
pub type Result<T, E = Error> = result::Result<T, E>;
/// A list enumerating the categories of errors in this crate.
///

View file

@ -82,6 +82,11 @@ dictionary ClientInfoMetrics {
string? android_sdk_version = null;
};
[Error]
enum CallbackError {
"UnexpectedError",
};
// A callback object, that is stored within the core logic for the entire lifetime of the application.
//
// This is used to trigger certain actions that need to happen on the foreign-language side.
@ -97,6 +102,7 @@ callback interface OnGleanEvents {
//
// This should not block.
// The uploader needs to asynchronously poll Glean for new pings to upload.
[Throws=CallbackError]
void trigger_upload();
// Start the Metrics Ping Scheduler.
@ -109,6 +115,7 @@ callback interface OnGleanEvents {
boolean start_metrics_ping_scheduler();
// Called when upload is disabled and uploads should be stopped
[Throws=CallbackError]
void cancel_uploads();
};

View file

@ -15,6 +15,7 @@
//! ## [The Glean SDK Book](https://mozilla.github.io/glean)
use std::collections::HashMap;
use std::fmt;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
@ -189,6 +190,25 @@ fn setup_state(state: State) {
}
}
/// An error returned from callbacks.
#[derive(Debug)]
pub enum CallbackError {
/// An unexpected error occured.
UnexpectedError,
}
impl fmt::Display for CallbackError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Unexpected error")
}
}
impl From<uniffi::UnexpectedUniFFICallbackError> for CallbackError {
fn from(_: uniffi::UnexpectedUniFFICallbackError) -> CallbackError {
CallbackError::UnexpectedError
}
}
/// A callback object used to trigger actions on the foreign-language side.
///
/// A callback object is stored in glean-core for the entire lifetime of the application.
@ -204,13 +224,13 @@ pub trait OnGleanEvents: Send {
///
/// This should not block.
/// The uploader needs to asynchronously poll Glean for new pings to upload.
fn trigger_upload(&self);
fn trigger_upload(&self) -> Result<(), CallbackError>;
/// Start the Metrics Ping Scheduler.
fn start_metrics_ping_scheduler(&self) -> bool;
/// Called when upload is disabled and uploads should be stopped
fn cancel_uploads(&self);
fn cancel_uploads(&self) -> Result<(), CallbackError>;
}
/// Initializes Glean.
@ -348,7 +368,9 @@ fn initialize_inner(
// 1. Pings were submitted through Glean and it is ready to upload those pings;
// 2. Upload is disabled, to upload a possible deletion-request ping.
if pings_submitted || !upload_enabled {
state.callbacks.trigger_upload();
if let Err(e) = state.callbacks.trigger_upload() {
log::error!("Triggering upload failed. Error: {}", e);
}
}
}
@ -371,7 +393,9 @@ fn initialize_inner(
// ping startup check should be performed before any other ping, since it relies
// on being dispatched to the API context before any other metric.
if state.callbacks.start_metrics_ping_scheduler() {
state.callbacks.trigger_upload();
if let Err(e) = state.callbacks.trigger_upload() {
log::error!("Triggering upload failed. Error: {}", e);
}
}
}
@ -388,7 +412,9 @@ fn initialize_inner(
// Note that unwrapping below is safe: the function will return an
// `Ok` value for a known ping.
if glean.submit_ping_by_name("baseline", Some("dirty_startup")) {
state.callbacks.trigger_upload();
if let Err(e) = state.callbacks.trigger_upload() {
log::error!("Triggering upload failed. Error: {}", e);
}
}
}
@ -599,7 +625,9 @@ pub fn glean_set_upload_enabled(enabled: bool) {
// Stop the MPS if its handled within Rust.
glean.cancel_metrics_ping_scheduler();
// Stop wrapper-controlled uploader.
state.callbacks.cancel_uploads();
if let Err(e) = state.callbacks.cancel_uploads() {
log::error!("Canceling upload failed. Error: {}", e);
}
}
glean.set_upload_enabled(enabled);
@ -609,7 +637,9 @@ pub fn glean_set_upload_enabled(enabled: bool) {
}
if original_enabled && !enabled {
state.callbacks.trigger_upload();
if let Err(e) = state.callbacks.trigger_upload() {
log::error!("Triggering upload failed. Error: {}", e);
}
}
})
}
@ -756,7 +786,9 @@ pub fn glean_handle_client_active() {
// the uploader. It's fine to trigger it if no ping was generated:
// it will bail out.
let state = global_state().lock().unwrap();
state.callbacks.trigger_upload();
if let Err(e) = state.callbacks.trigger_upload() {
log::error!("Triggering upload failed. Error: {}", e);
}
});
// The previous block of code may send a ping containing the `duration` metric,
@ -787,7 +819,9 @@ pub fn glean_handle_client_inactive() {
// the uploader. It's fine to trigger it if no ping was generated:
// it will bail out.
let state = global_state().lock().unwrap();
state.callbacks.trigger_upload();
if let Err(e) = state.callbacks.trigger_upload() {
log::error!("Triggering upload failed. Error: {}", e);
}
})
}
@ -799,7 +833,9 @@ pub fn glean_submit_ping_by_name(ping_name: String, reason: Option<String>) {
if sent {
let state = global_state().lock().unwrap();
state.callbacks.trigger_upload();
if let Err(e) = state.callbacks.trigger_upload() {
log::error!("Triggering upload failed. Error: {}", e);
}
}
})
}

View file

@ -11,7 +11,7 @@ use crate::util::truncate_string_at_boundary_with_error;
use crate::CommonMetricData;
use crate::Glean;
const MAX_LENGTH_EXTRA_KEY_VALUE: usize = 100;
const MAX_LENGTH_EXTRA_KEY_VALUE: usize = 500;
/// An event metric.
///

View file

@ -107,7 +107,9 @@ impl PingType {
crate::core::with_glean(move |glean| ping.submit_sync(glean, reason.as_deref()));
if sent {
let state = crate::global_state().lock().unwrap();
state.callbacks.trigger_upload();
if let Err(e) = state.callbacks.trigger_upload() {
log::error!("Triggering upload failed. Error: {}", e);
}
}
})
}
@ -125,6 +127,13 @@ impl PingType {
}
let ping = &self.0;
// Allowing `clippy::manual_filter`.
// This causes a false positive.
// We have a side-effect in the `else` branch,
// so shouldn't delete it.
#[allow(unknown_lints)]
#[allow(clippy::manual_filter)]
let corrected_reason = match reason {
Some(reason) => {
if ping.reason_codes.contains(&reason.to_string()) {

View file

@ -1280,7 +1280,7 @@ mod test {
.unwrap()
);
assert_eq!(
n as i32,
n,
upload_manager
.upload_metrics
.pending_pings

View file

@ -230,9 +230,16 @@ fn extra_keys_must_be_recorded_and_truncated_if_needed() {
);
let test_value = "LeanGleanByFrank";
let test_value_long = test_value.to_string().repeat(32);
// max length for extra values.
let test_value_cap = 500;
assert!(
test_value_long.len() > test_value_cap,
"test value is not long enough"
);
let mut extra = HashMap::new();
extra.insert("extra1".into(), test_value.to_string());
extra.insert("truncatedExtra".into(), test_value.to_string().repeat(10));
extra.insert("truncatedExtra".into(), test_value_long.clone());
test_event.record_sync(&glean, 0, extra);
@ -247,7 +254,7 @@ fn extra_keys_must_be_recorded_and_truncated_if_needed() {
assert_eq!(2, event["extra"].as_object().unwrap().len());
assert_eq!(test_value, event["extra"]["extra1"]);
assert_eq!(
test_value.to_string().repeat(10)[0..100],
test_value_long[0..test_value_cap],
event["extra"]["truncatedExtra"]
);
}

View file

@ -373,7 +373,7 @@ fn seen_labels_get_reloaded_from_disk() {
// Set the maximum number of labels
for i in 1..=16 {
let label = format!("label{}", i);
labeled.get(&label).add_sync(&glean, i);
labeled.get(label).add_sync(&glean, i);
}
let snapshot = StorageManager
@ -439,7 +439,7 @@ fn caching_metrics_with_dynamic_labels() {
let metrics = (1..=20)
.map(|i| {
let label = format!("label{}", i);
labeled.get(&label)
labeled.get(label)
})
.collect::<Vec<_>>();
@ -473,7 +473,7 @@ fn caching_metrics_with_dynamic_labels_across_pings() {
let metrics = (1..=20)
.map(|i| {
let label = format!("label{}", i);
labeled.get(&label)
labeled.get(label)
})
.collect::<Vec<_>>();

View file

@ -1 +1 @@
{"files":{"Cargo.toml":"a7dd5fc6025f875b93c926e1efce817b92a914007ccc750bc95b201e0b48fc71","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"5bc5b1c46695f628e1023662752272e938a963b535d5686bd1ecc433f9e018c4","src/common_test.rs":"68f6d408cb7b683fa32c8b38a4df1e6c45bfd77c0c90ca35976ea7548bbc4b2f","src/configuration.rs":"37ad5b3e7d4e31dd04a7d6690179168b5f2768d87dd36056dee5d08bdbe20fb2","src/core_metrics.rs":"76ac5350cb6f82d9a193d519b085a08f138dceba77da3514bd0c636bcdefefca","src/lib.rs":"e342d497d60abceca3c84d35523a54d187b0282220a112da53e4ab1cf76da205","src/net/http_uploader.rs":"43812a70d19a38e8d7a093c8076c2b6345372c3c861b0f3511428762700a65e0","src/net/mod.rs":"e05e61860f5828caa529c3ea75a2fff7371bfa3dce057077a74c09baf41a568a","src/private/event.rs":"02bbebf545695812e5055741cc0b5f3c99eda2039e684e26fcdd5f087ed15fe3","src/private/mod.rs":"0364ecf5f0439443a5b209583f4ff2c474b79f7c253c981ab0b7cdc528368698","src/private/ping.rs":"cbdc57f41fc9d46e56b4dfff91ac683753d1f8b3ecd0aa9bc3419e3595b8b81b","src/system.rs":"4e0ec743f6d06a9c83e46c95d0286d5745f4642398c942fce8ae7a1ea5202d37","src/test.rs":"1d9a01fa6befdc04e97caeb58ccebd67c840965ff0417b6b2ba9e53aa108a069","tests/common/mod.rs":"37cd4c48e140c793b852ae09fb3e812da28a4412977295015bcbffd632fcf294","tests/init_fails.rs":"9b78226a4e3220de5b64a205a97b8d5778d1700391b5b71c7819b6cdd120747e","tests/never_init.rs":"1f33b8ce7ca3514b57b48cc16d98408974c85cf8aa7d13257ffc2ad878ebb295","tests/no_time_to_init.rs":"494dcddce49f279c6508f484ee59cf8bb83e7324de07bdbc1142f2a066b7f6a1","tests/overflowing_preinit.rs":"396206d5078b7e6c148bbf2aecb0f963cfaa4d7eff3fc7bf6590125076ee6113","tests/persist_ping_lifetime.rs":"2297d4b208e14188e6dcca2d4806b805cfc7dd824d21bd143a7803b95e0709f4","tests/persist_ping_lifetime_nopanic.rs":"06f1f3ca3b8a6c8b7fc4d6fc48d0e1d2ccffd32139f080db0a95003e9edd507d","tests/schema.rs":"a96089f828928b6be1fad7815e3269f5693af1b773e570312b357a29af28122a","tests/simple.rs":"a1d72af899293390bb955ca379baafb89c29bb746630409f8c51f453d222dbad"},"package":"2dfbbb336d8195ad56be852099319eaab3ba491bc7f38d18e7ebe02242a6be20"}
{"files":{"Cargo.toml":"d39ab6aca7c4acaf158b317ad682782de0ab97b3a26eafb7c39c6ff6720334ed","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"5bc5b1c46695f628e1023662752272e938a963b535d5686bd1ecc433f9e018c4","src/common_test.rs":"68f6d408cb7b683fa32c8b38a4df1e6c45bfd77c0c90ca35976ea7548bbc4b2f","src/configuration.rs":"37ad5b3e7d4e31dd04a7d6690179168b5f2768d87dd36056dee5d08bdbe20fb2","src/core_metrics.rs":"76ac5350cb6f82d9a193d519b085a08f138dceba77da3514bd0c636bcdefefca","src/lib.rs":"7caacc2b5f389bf5d3829a74e77c100b457a63ddf3a914225f26556e3b8bfb18","src/net/http_uploader.rs":"43812a70d19a38e8d7a093c8076c2b6345372c3c861b0f3511428762700a65e0","src/net/mod.rs":"e05e61860f5828caa529c3ea75a2fff7371bfa3dce057077a74c09baf41a568a","src/private/event.rs":"02bbebf545695812e5055741cc0b5f3c99eda2039e684e26fcdd5f087ed15fe3","src/private/mod.rs":"0364ecf5f0439443a5b209583f4ff2c474b79f7c253c981ab0b7cdc528368698","src/private/ping.rs":"cbdc57f41fc9d46e56b4dfff91ac683753d1f8b3ecd0aa9bc3419e3595b8b81b","src/system.rs":"4e0ec743f6d06a9c83e46c95d0286d5745f4642398c942fce8ae7a1ea5202d37","src/test.rs":"1d9a01fa6befdc04e97caeb58ccebd67c840965ff0417b6b2ba9e53aa108a069","tests/common/mod.rs":"37cd4c48e140c793b852ae09fb3e812da28a4412977295015bcbffd632fcf294","tests/init_fails.rs":"9b78226a4e3220de5b64a205a97b8d5778d1700391b5b71c7819b6cdd120747e","tests/never_init.rs":"1f33b8ce7ca3514b57b48cc16d98408974c85cf8aa7d13257ffc2ad878ebb295","tests/no_time_to_init.rs":"494dcddce49f279c6508f484ee59cf8bb83e7324de07bdbc1142f2a066b7f6a1","tests/overflowing_preinit.rs":"396206d5078b7e6c148bbf2aecb0f963cfaa4d7eff3fc7bf6590125076ee6113","tests/persist_ping_lifetime.rs":"2297d4b208e14188e6dcca2d4806b805cfc7dd824d21bd143a7803b95e0709f4","tests/persist_ping_lifetime_nopanic.rs":"06f1f3ca3b8a6c8b7fc4d6fc48d0e1d2ccffd32139f080db0a95003e9edd507d","tests/schema.rs":"a96089f828928b6be1fad7815e3269f5693af1b773e570312b357a29af28122a","tests/simple.rs":"a1d72af899293390bb955ca379baafb89c29bb746630409f8c51f453d222dbad"},"package":"13aedcf0f5dd22897f3e714f3e9340ec7841ce2dd6c2b9947784314735cc1b27"}

View file

@ -12,7 +12,7 @@
[package]
edition = "2018"
name = "glean"
version = "51.7.0"
version = "51.8.0"
authors = [
"Jan-Erik Rediger <jrediger@mozilla.com>",
"The Glean Team <glean-team@mozilla.com>",
@ -41,7 +41,7 @@ features = ["serde"]
version = "0.5"
[dependencies.glean-core]
version = "51.7.0"
version = "51.8.0"
[dependencies.inherent]
version = "1"

View file

@ -81,8 +81,9 @@ impl glean_core::OnGleanEvents for GleanEvents {
// intentionally left empty
}
fn trigger_upload(&self) {
fn trigger_upload(&self) -> Result<(), glean_core::CallbackError> {
self.upload_manager.trigger_upload();
Ok(())
}
fn start_metrics_ping_scheduler(&self) -> bool {
@ -91,8 +92,9 @@ impl glean_core::OnGleanEvents for GleanEvents {
true
}
fn cancel_uploads(&self) {
fn cancel_uploads(&self) -> Result<(), glean_core::CallbackError> {
// intentionally left empty
Ok(())
}
}

View file

@ -6,7 +6,7 @@ edition = "2018"
license = "MPL-2.0"
[dependencies]
glean = "51.7.0"
glean = "51.8.0"
log = "0.4"
nserror = { path = "../../../xpcom/rust/nserror" }
nsstring = { path = "../../../xpcom/rust/nsstring" }

View file

@ -8,7 +8,7 @@ publish = false
[dependencies]
bincode = "1.0"
chrono = "0.4.10"
glean = "51.7.0"
glean = "51.8.0"
inherent = "1.0.0"
log = "0.4"
nsstring = { path = "../../../../xpcom/rust/nsstring", optional = true }