Skip to content

Commit

Permalink
Bug 1744674 - Update to Glean v42.3.0 & glean_parser v4.3.1 r=chutten
Browse files Browse the repository at this point in the history
Also updates the docs on how to update the glean_parser in-tree.
Also adds a `no_lint` exception to test pings to avoid breaking the
build.

Differential Revision: https://phabricator.services.mozilla.com/D133077
  • Loading branch information
badboy committed Dec 9, 2021
1 parent c113077 commit 86576c5
Show file tree
Hide file tree
Showing 46 changed files with 619 additions and 149 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ allprojects {
topsrcdir = gradle.mozconfig.topsrcdir
topobjdir = gradle.mozconfig.topobjdir

gleanVersion = "42.1.0"
gleanVersion = "42.3.0"
if (gleanVersion != getRustVersionFor("glean")) {
throw new StopExecutionException("Mismatched Glean version, expected: ${gleanVersion}," +
" found ${getRustVersionFor("glean")}")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: glean-parser
Version: 3.6.0
Version: 4.3.1
Summary: Parser tools for Mozilla's Glean telemetry
Home-page: https://github.com/mozilla/glean_parser
Author: Michael Droettboom
Expand All @@ -16,12 +16,13 @@ Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Description-Content-Type: text/markdown
Requires-Dist: appdirs (>=1.4)
Requires-Dist: Click (>=7)
Requires-Dist: diskcache (>=4)
Requires-Dist: Jinja2 (>=2.10.1)
Requires-Dist: jsonschema (<4,>=3.0.2)
Requires-Dist: jsonschema (>=3.0.2)
Requires-Dist: PyYAML (>=5.3.1)
Requires-Dist: yamllint (>=1.18.0)
Requires-Dist: iso8601 (>=0.1.10) ; python_version <= "3.6"
Expand Down Expand Up @@ -84,6 +85,42 @@ $ glean_parser check < ping.json

## Unreleased

## 4.3.1

- BUGFIX: Skip tags for code generation ([#409](https://github.com/mozilla/glean_parser/pull/409))

## 4.3.0

- Support tags in glean parser ([bug 1734011](https://bugzilla.mozilla.org/show_bug.cgi?id=1734011))

## 4.2.0

- Improve the schema validation error messages. They will no longer include `OrderedDict(...)` on Python 3.7 and later ([bug 1733395](https://bugzilla.mozilla.org/show_bug.cgi?id=1733395))
- Officially support Python 3.10

## 4.1.1 (2021-09-28)

- Update private import paths on Javascript / Typescript templates. ([bug 1702468](https://bugzilla.mozilla.org/show_bug.cgi?id=1702468))

## 4.1.0 (2021-09-16)

- Add support for Node.js platform on Javascript / Typescript templates. ([bug 1728982](https://bugzilla.mozilla.org/show_bug.cgi?id=1728982))

## 4.0.0 (2021-08-20)

- Add support for Text metric type ([#374](https://github.com/mozilla/glean_parser/pull/374))
- Reserve the `default` ping name. It can't be used as a ping name, but it can be used in `send_in_pings` ([#376](https://github.com/mozilla/glean_parser/pull/376))

## 3.8.0 (2021-08-18)

- Expose ping reasons enum on JavaScript / TypeScript templates. ([bug 1719136](https://bugzilla.mozilla.org/show_bug.cgi?id=1719136))
- Define an interface with the allowed extras for each event on the TypeScript template. ([bug 1693487](https://bugzilla.mozilla.org/show_bug.cgi?id=1693487))

## 3.7.0 (2021-07-13)

- New lint: Check for redundant words in ping names ([#355](https://github.com/mozilla/glean_parser/pull/355))
- Add support for URL metric type ([#361](https://github.com/mozilla/glean_parser/pull/361))

## 3.6.0 (2021-06-11)

- Add a command `data-review` to generate a skeleton Data Review Request for all metrics matching a supplied bug number. ([bug 1704541](https://bugzilla.mozilla.org/show_bug.cgi?id=1704541))
Expand All @@ -99,9 +136,9 @@ $ glean_parser check < ping.json

## 3.4.0 (2021-05-28)

- Add missing import for Kotlin code ([#339](https://github.com/mozilla/glean_parser/pull/341))
- Use a plain Kotlin type in the generated interface implementation ([#339](https://github.com/mozilla/glean_parser/pull/341))
- Generate additional generics for event metrics ([#339](https://github.com/mozilla/glean_parser/pull/341))
- Add missing import for Kotlin code ([#339](https://github.com/mozilla/glean_parser/pull/339))
- Use a plain Kotlin type in the generated interface implementation ([#339](https://github.com/mozilla/glean_parser/pull/339))
- Generate additional generics for event metrics ([#339](https://github.com/mozilla/glean_parser/pull/339))
- For Kotlin skip generating `GleanBuildInfo.kt` when requested (with `with_buildinfo=false`) ([#341](https://github.com/mozilla/glean_parser/pull/341))

## 3.3.2 (2021-05-18)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
glean_parser/__init__.py,sha256=kaoYIRhwZiOE1d8TniW1SHSlEivLBXZQJJ3eiDcamvQ,538
glean_parser/__main__.py,sha256=1lA0kuQkEIMZSnG8xYha5dASadwEHI5-MeHmuNqyViA,6509
glean_parser/coverage.py,sha256=2IwC4XMDtDamMkBFoYilmqJzW4gyypq65YVCur8SNas,4405
glean_parser/csharp.py,sha256=tOrwOLjJCnfie0GvhWvg0Q3fnP4VFQM_4GRaaAqUh4I,5242
glean_parser/data_review.py,sha256=TA87mbyUQeDOB1T344gfsXePScBEZ9TdyWLy5TJCpHU,4765
glean_parser/javascript.py,sha256=e2hslgxRB56aS2_JVOkatKexrblcz6-XqsDnGuw0MPQ,8150
glean_parser/kotlin.py,sha256=INVHy3yC2xwm9ZFL9atr99C4DDsOwvRKnCiaJcLql_o,11192
glean_parser/lint.py,sha256=CM9OMH-sIxuErvfQktbWkeKIIVzG28pPxqMGO1Espok,17018
glean_parser/markdown.py,sha256=0auYAmzIrX0kqmQyq9DKkRRvTE66yAYdrU-YMgLhrpw,8996
glean_parser/metrics.py,sha256=Z0gkVMHH-u4eCu_bpsu5JKm9gumZhCz1Jq-xSmHjo8k,11621
glean_parser/parser.py,sha256=vIGJGOz0S4cAIdlzeEoiBbmoEgxLKvGdSStVHt8LvX8,15463
glean_parser/pings.py,sha256=6XakkO9jnQc2oojLQJvTCMwF7w-BEm6rR54tunCb38o,2805
glean_parser/swift.py,sha256=FWOp1Qr8U4xQvOfcu23FttCc4Nc8P7PkJTqm-V7bC4Y,6437
glean_parser/tags.py,sha256=bemKYvcbMO4JrghiNSe-A4BNNDtx_FlUPkgrPPJy84Y,1391
glean_parser/translate.py,sha256=ZyWEEp1bQO2-cneiC-YvbCuTUEra-xgp33X6dkvtgUY,7476
glean_parser/util.py,sha256=gsP8MqfgEs0sDKbz4sV2CfvmDT6MP73dOdNcmOx_K9k,14160
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=asAWdpMUkUWDT0sTN26ivoLey50ggGxLUN4aW6OcQpY,22138
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/csharp.jinja2,sha256=tPj09JzgSK0YyNb53WkL8WFTA7fcVXyiJ7V-bARnfM0,4354
glean_parser/templates/javascript.jinja2,sha256=Qiv0lxsqVABzdME1MRsmezwtwn8_hHdH9S_v8fJAh-E,2647
glean_parser/templates/kotlin.buildinfo.jinja2,sha256=z9tPgvmNnf8E8gpx7FAWh35oXad8Dlv_UrpqN9CXetY,780
glean_parser/templates/kotlin.geckoview.jinja2,sha256=K0c1BeKSXDVbshC3gpWALCQFp2JtsoqWhGyN1ScPhC0,5077
glean_parser/templates/kotlin.jinja2,sha256=fsFXKI_fKwj5AEO4odJ5sRvoC5geW59_DhU6GATaA90,4475
glean_parser/templates/markdown.jinja2,sha256=tOMN62xEGA1p8QoMKnpCVXUiK_jI5GwLuvCnuOROy8c,3381
glean_parser/templates/qmldir.jinja2,sha256=m6IGsp-tgTiOfQ7VN8XW6GqX0gJqJkt3B6Pkaul6FVo,156
glean_parser/templates/swift.jinja2,sha256=McprjDExS3Ao62_eTvEwl-ZHNIbYDOJe05gv1nd4trM,4791
glean_parser-4.3.1.dist-info/AUTHORS.md,sha256=jBsSsn3EpmpLejgHMhzU1XTFwkCARqYeUs9iGLNgwkQ,432
glean_parser-4.3.1.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
glean_parser-4.3.1.dist-info/METADATA,sha256=WO52mRW8bTLNVllJhXFPdPETSWm74sEm1o7QLJPJF4g,22416
glean_parser-4.3.1.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
glean_parser-4.3.1.dist-info/entry_points.txt,sha256=s-clJTIqp-PpJD-n3AnIQZFkTafIrzsTbAPX9vNY018,69
glean_parser-4.3.1.dist-info/top_level.txt,sha256=q7T3duD-9tYZFyDry6Wv2LcdMsK2jGnzdDFhxWcT2Z8,13
glean_parser-4.3.1.dist-info/RECORD,,
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.36.2)
Generator: bdist_wheel (0.37.0)
Root-Is-Purelib: true
Tag: py3-none-any

18 changes: 16 additions & 2 deletions third_party/python/glean_parser/glean_parser/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@
is_flag=True,
help=("Do not treat missing input files as an error."),
)
def translate(input, format, output, option, allow_reserved, allow_missing_files):
@click.option(
"--require-tags",
is_flag=True,
help=("Require tags to be specified for metrics and pings."),
)
def translate(
input, format, output, option, allow_reserved, allow_missing_files, require_tags
):
"""
Translate metrics.yaml and pings.yaml files to other formats.
"""
Expand All @@ -81,6 +88,7 @@ def translate(input, format, output, option, allow_reserved, allow_missing_files
{
"allow_reserved": allow_reserved,
"allow_missing_files": allow_missing_files,
"require_tags": require_tags,
},
)
)
Expand Down Expand Up @@ -130,7 +138,12 @@ def check(schema):
is_flag=True,
help=("Do not treat missing input files as an error."),
)
def glinter(input, allow_reserved, allow_missing_files):
@click.option(
"--require-tags",
is_flag=True,
help=("Require tags to be specified for metrics and pings."),
)
def glinter(input, allow_reserved, allow_missing_files, require_tags):
"""
Runs a linter over the metrics.
"""
Expand All @@ -140,6 +153,7 @@ def glinter(input, allow_reserved, allow_missing_files):
{
"allow_reserved": allow_reserved,
"allow_missing_files": allow_missing_files,
"require_tags": require_tags,
},
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def generate(
TODO: Fill this in.
11. Where do you intend to share the results of your analys
11. Where do you intend to share the results of your analysis?
TODO: Fill this in.
Expand Down
20 changes: 16 additions & 4 deletions third_party/python/glean_parser/glean_parser/javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import enum
import json
from pathlib import Path
from typing import Any, Dict, List, Optional, Union, Callable # noqa
from typing import Any, Dict, Optional, Callable

from . import metrics
from . import util
Expand Down Expand Up @@ -44,7 +44,7 @@ def iterencode(self, value):
def class_name_factory(platform: str) -> Callable[[str], str]:
"""
Returns a function that receives an obj_type and
returns the correct class name for that time in the current platform.
returns the correct class name for that type in the current platform.
"""

def class_name(obj_type: str) -> str:
Expand All @@ -63,6 +63,16 @@ def class_name(obj_type: str) -> str:
return class_name


def extra_type_name(extra_type: str) -> str:
"""
Returns the equivalent TypeScript type to an extra type.
"""
if extra_type == "quantity":
return "number"

return extra_type


def import_path(obj_type: str) -> str:
"""
Returns the import path of the given object inside the @mozilla/glean package.
Expand Down Expand Up @@ -113,9 +123,10 @@ def output(
options = {}

platform = options.get("platform", "webext")
if platform not in ["qt", "webext"]:
accepted_platforms = ["qt", "webext", "node"]
if platform not in accepted_platforms:
raise ValueError(
f"Unknown platform: {platform}. Accepted platforms are qt and webext."
f"Unknown platform: {platform}. Accepted platforms are: {accepted_platforms}." # noqa
)
version = options.get("version")
if platform == "qt" and version is None:
Expand All @@ -127,6 +138,7 @@ def output(
"javascript.jinja2",
filters=(
("class_name", class_name_factory(platform)),
("extra_type_name", extra_type_name),
("import_path", import_path),
("js", javascript_datatypes_filter),
("args", args),
Expand Down
12 changes: 7 additions & 5 deletions third_party/python/glean_parser/glean_parser/kotlin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

from . import metrics
from . import pings
from . import tags
from . import util
from .util import DictWrapper


def kotlin_datatypes_filter(value: util.JSONType) -> str:
Expand Down Expand Up @@ -176,9 +178,7 @@ def output_gecko_lookup(
# },
# "other-type": {}
# }
gecko_metrics: OrderedDict[
str, OrderedDict[str, List[Dict[str, str]]]
] = OrderedDict()
gecko_metrics: Dict[str, Dict[str, List[Dict[str, str]]]] = DictWrapper()

# Define scalar-like types.
SCALAR_LIKE_TYPES = ["boolean", "string", "quantity"]
Expand All @@ -188,8 +188,10 @@ def output_gecko_lookup(
# Glean SDK and GeckoView. See bug 1566356 for more context.
for metric in category_val.values():
# This is not a Gecko metric, skip it.
if isinstance(metric, pings.Ping) or not getattr(
metric, "gecko_datapoint", False
if (
isinstance(metric, pings.Ping)
or isinstance(metric, tags.Tag)
or not getattr(metric, "gecko_datapoint", False)
):
continue

Expand Down
Loading

0 comments on commit 86576c5

Please sign in to comment.