glean-parser 20.0.0__tar.gz → 20.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {glean_parser-20.0.0 → glean_parser-20.1.0}/PKG-INFO +1 -1
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/lint.py +2 -29
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/metrics.py +1 -1
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/schemas/metrics.2-0-0.schema.yaml +2 -1
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/templates/rust.jinja2 +0 -2
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/util.py +12 -1
- {glean_parser-20.0.0 → glean_parser-20.1.0}/server_telemetry/sdk-metrics-compat.yaml +0 -8
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/conftest.py +0 -1
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_lint.py +8 -6
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_parser.py +62 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/.gitignore +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/AUTHORS.md +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/LICENSE +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/README.md +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/__init__.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/__main__.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/data_review.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/go_server.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/javascript.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/javascript_server.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/kotlin.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/markdown.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/parser.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/pings.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/python_server.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/ruby_server.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/rust.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/rust_server.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/rust_sym.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/schemas/metrics.1-0-0.schema.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/schemas/pings.1-0-0.schema.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/schemas/pings.2-0-0.schema.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/schemas/tags.1-0-0.schema.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/swift.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/tags.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/templates/data_review.jinja2 +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/templates/go_server.jinja2 +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/templates/javascript.buildinfo.jinja2 +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/templates/javascript.jinja2 +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/templates/javascript_server.jinja2 +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/templates/kotlin.buildinfo.jinja2 +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/templates/kotlin.jinja2 +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/templates/markdown.jinja2 +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/templates/python_server.jinja2 +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/templates/qmldir.jinja2 +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/templates/ruby_server.jinja2 +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/templates/rust_server.jinja2 +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/templates/rust_sym.jinja2 +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/templates/swift.jinja2 +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/translate.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/translation_options.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/validate_ping.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/pyproject.toml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/server_telemetry/server-side-pings.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/all_metrics.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/all_pings.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/attribution.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/bad_attribution.yamlx +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/bad_ping.yamlx +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/core.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/custom_ping_no_event_metrics.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/custom_ping_no_event_pings.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/dual_labeled.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/dual_labeled_invalid.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/duplicate_labeled.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/duplicate_send_in_ping.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/empty.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/event_key_ordering.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/events_data_sensitivity.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/events_with_types.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/fxa-server-metrics.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/fxa-server-pings.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/go_server_custom_ping_only_metrics.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/go_server_custom_ping_only_pings.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/go_server_events_and_custom_ping_metrics.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/go_server_events_and_custom_ping_pings.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/go_server_events_only_metrics.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/go_server_labeled_boolean_metrics.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/go_server_metrics_unsupported.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/invalid-ping-names.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/invalid.yamlx +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/jwe.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/metric-with-tags.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/mixed-expirations.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/name_too_similar.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/object.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/old_event_api.yamlx +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/ordering.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/pings.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/python_server_metrics_unsupported.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/rate.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/redefined_category.yamlx +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/redefined_metric.yamlx +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/redefined_ping.yamlx +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/reserved_categories.yamlx +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/ruby_server_metrics_unsupported.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/ruby_server_pings_unsupported.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/rust_server_custom_ping_only_metrics.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/rust_server_custom_ping_only_pings.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/rust_server_events_and_custom_ping_metrics.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/rust_server_events_and_custom_ping_pings.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/rust_server_events_only_metrics.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/rust_server_metrics_unsupported.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/same_name_different_category.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/schema-violation.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/send_if_empty_with_metrics.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/server_custom_ping_only_compare.go +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/server_custom_ping_only_compare.rs +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/server_events_and_custom_ping_compare.go +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/server_events_and_custom_ping_compare.rs +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/server_events_compare.rb +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/server_events_only_compare.go +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/server_events_only_compare.rs +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/server_metrics_no_events_no_pings.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/server_metrics_with_event.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/server_pings.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/single_labeled.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/smaller.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/tags.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/telemetry_mirror.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/text.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/text_invalid.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/unknown_ping_used.yaml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/wrong_key.yamlx +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/yaml_nits.yamlx +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/detekt.yml +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test-go/test.go.tmpl +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test-go/test_publisher.go.tmpl +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test-js/package.json +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test-js/test.js.tmpl +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test-py/test.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test-rb/test.rb.tmpl +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test-rs/test.rs.tmpl +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_cli.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_go_server.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_go_server_pubsub.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_javascript.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_javascript_server.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_kotlin.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_markdown.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_metrics.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_pings.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_python_server.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_ruby_server.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_rust.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_rust_server.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_rust_sym.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_swift.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_tags.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_translate.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_utils.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/test_validate_ping.py +0 -0
- {glean_parser-20.0.0 → glean_parser-20.1.0}/tests/util.py +0 -0
|
@@ -84,34 +84,6 @@ def _hamming_distance(str1: str, str2: str) -> int:
|
|
|
84
84
|
return diffs
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
def check_common_prefix(
|
|
88
|
-
category_name: str, metrics: Iterable[metrics.Metric]
|
|
89
|
-
) -> LintGenerator:
|
|
90
|
-
"""
|
|
91
|
-
Check if all metrics begin with a common prefix.
|
|
92
|
-
"""
|
|
93
|
-
metric_words = sorted([_split_words(metric.name) for metric in metrics])
|
|
94
|
-
|
|
95
|
-
if len(metric_words) < 2:
|
|
96
|
-
return
|
|
97
|
-
|
|
98
|
-
first = metric_words[0]
|
|
99
|
-
last = metric_words[-1]
|
|
100
|
-
|
|
101
|
-
for i in range(min(len(first), len(last))):
|
|
102
|
-
if first[i] != last[i]:
|
|
103
|
-
break
|
|
104
|
-
|
|
105
|
-
if i > 0:
|
|
106
|
-
common_prefix = "_".join(first[:i])
|
|
107
|
-
yield (
|
|
108
|
-
f"Within category '{category_name}', all metrics begin with "
|
|
109
|
-
f"prefix '{common_prefix}'. "
|
|
110
|
-
"Remove the prefixes on the metric names and (possibly) "
|
|
111
|
-
"rename the category."
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
|
|
115
87
|
def check_unit_in_name(
|
|
116
88
|
metric: metrics.Metric, parser_config: Dict[str, Any]
|
|
117
89
|
) -> LintGenerator:
|
|
@@ -465,7 +437,8 @@ def check_name_too_similar(
|
|
|
465
437
|
CATEGORY_CHECKS: Dict[
|
|
466
438
|
str, Tuple[Callable[[str, Iterable[metrics.Metric]], LintGenerator], CheckType]
|
|
467
439
|
] = {
|
|
468
|
-
|
|
440
|
+
# Keeping it to not break when it is listed in `no_lint`
|
|
441
|
+
"COMMON_PREFIX": (noop, CheckType.error),
|
|
469
442
|
"CATEGORY_GENERIC": (check_category_generic, CheckType.error),
|
|
470
443
|
}
|
|
471
444
|
|
|
@@ -99,7 +99,7 @@ class Metric:
|
|
|
99
99
|
self.defined_in = defined_in
|
|
100
100
|
if telemetry_mirror is not None:
|
|
101
101
|
self.telemetry_mirror = telemetry_mirror
|
|
102
|
-
if in_session:
|
|
102
|
+
if not hasattr(self, "in_session"):
|
|
103
103
|
self.in_session = in_session
|
|
104
104
|
|
|
105
105
|
# _validated indicates whether this metric has already been jsonschema
|
|
@@ -633,9 +633,10 @@ definitions:
|
|
|
633
633
|
Whether this metric participates in session sampling.
|
|
634
634
|
When `true`, the metric is subject to session-level sampling and
|
|
635
635
|
session metadata is attached to it.
|
|
636
|
-
When `false
|
|
636
|
+
When `false`, the metric bypasses session sampling entirely.
|
|
637
637
|
|
|
638
638
|
Only valid when `type`_ is `event`.
|
|
639
|
+
Defaults to `true` when `type`_ is `event`, `false` otherwise.
|
|
639
640
|
type: boolean
|
|
640
641
|
default: false
|
|
641
642
|
|
|
@@ -102,9 +102,7 @@ CommonMetricData {
|
|
|
102
102
|
send_in_pings: {{ obj.send_in_pings|rust }},
|
|
103
103
|
lifetime: {{ obj.lifetime|rust }},
|
|
104
104
|
disabled: {{ obj.is_disabled()|rust }},
|
|
105
|
-
{% if obj.in_session is defined %}
|
|
106
105
|
in_session: {{ obj.in_session|rust }},
|
|
107
|
-
{% endif %}
|
|
108
106
|
..Default::default()
|
|
109
107
|
}
|
|
110
108
|
{%- endmacro -%}
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
6
|
|
|
7
7
|
import datetime
|
|
8
|
+
import time
|
|
9
|
+
import os
|
|
8
10
|
import functools
|
|
9
11
|
import json
|
|
10
12
|
from pathlib import Path
|
|
@@ -412,6 +414,15 @@ def parse_expiration_version(expires: str) -> int:
|
|
|
412
414
|
)
|
|
413
415
|
|
|
414
416
|
|
|
417
|
+
def now_epoch():
|
|
418
|
+
try:
|
|
419
|
+
epoch_ts = int(os.environ.get("SOURCE_DATE_EPOCH", time.time()))
|
|
420
|
+
except ValueError:
|
|
421
|
+
raise ValueError("Invalid SOURCE_DATE_EPOCH")
|
|
422
|
+
|
|
423
|
+
return datetime.datetime.fromtimestamp(epoch_ts, tz=datetime.timezone.utc)
|
|
424
|
+
|
|
425
|
+
|
|
415
426
|
def is_expired(expires: str, major_version: Optional[int] = None) -> bool:
|
|
416
427
|
"""
|
|
417
428
|
Parses the `expires` field in a metric or ping and returns whether
|
|
@@ -425,7 +436,7 @@ def is_expired(expires: str, major_version: Optional[int] = None) -> bool:
|
|
|
425
436
|
return parse_expiration_version(expires) <= major_version
|
|
426
437
|
else:
|
|
427
438
|
date = parse_expiration_date(expires)
|
|
428
|
-
return date <=
|
|
439
|
+
return date <= now_epoch().date()
|
|
429
440
|
|
|
430
441
|
|
|
431
442
|
def validate_expires(expires: str, major_version: Optional[int] = None) -> None:
|
|
@@ -47,8 +47,6 @@ glean.error:
|
|
|
47
47
|
expires: never
|
|
48
48
|
send_in_pings:
|
|
49
49
|
- events
|
|
50
|
-
no_lint:
|
|
51
|
-
- COMMON_PREFIX
|
|
52
50
|
|
|
53
51
|
invalid_label:
|
|
54
52
|
type: labeled_counter
|
|
@@ -66,8 +64,6 @@ glean.error:
|
|
|
66
64
|
expires: never
|
|
67
65
|
send_in_pings:
|
|
68
66
|
- events
|
|
69
|
-
no_lint:
|
|
70
|
-
- COMMON_PREFIX
|
|
71
67
|
|
|
72
68
|
invalid_state:
|
|
73
69
|
type: labeled_counter
|
|
@@ -85,8 +81,6 @@ glean.error:
|
|
|
85
81
|
expires: never
|
|
86
82
|
send_in_pings:
|
|
87
83
|
- events
|
|
88
|
-
no_lint:
|
|
89
|
-
- COMMON_PREFIX
|
|
90
84
|
|
|
91
85
|
invalid_overflow:
|
|
92
86
|
type: labeled_counter
|
|
@@ -104,5 +98,3 @@ glean.error:
|
|
|
104
98
|
expires: never
|
|
105
99
|
send_in_pings:
|
|
106
100
|
- events
|
|
107
|
-
no_lint:
|
|
108
|
-
- COMMON_PREFIX
|
|
@@ -54,7 +54,6 @@ def pytest_collection_modifyitems(config, items):
|
|
|
54
54
|
subprocess.check_output(["node", "--version"]).decode("utf-8").strip()
|
|
55
55
|
)
|
|
56
56
|
major_version = int(node_version[1:].split(".")[0])
|
|
57
|
-
print(f"jer. {node_version=}, {major_version=}")
|
|
58
57
|
if major_version >= 24:
|
|
59
58
|
skip_node = pytest.mark.skip(reason="Node.js < v24 required")
|
|
60
59
|
for item in items:
|
|
@@ -20,6 +20,11 @@ ROOT = Path(__file__).parent
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
def test_common_prefix():
|
|
23
|
+
"""
|
|
24
|
+
The `COMMON_PREFIX` lint has been silenced.
|
|
25
|
+
This ensures we're not breaking anyone that lists it in `no_lint`
|
|
26
|
+
"""
|
|
27
|
+
|
|
23
28
|
contents = [
|
|
24
29
|
{
|
|
25
30
|
"telemetry": {
|
|
@@ -44,8 +49,7 @@ def test_common_prefix():
|
|
|
44
49
|
|
|
45
50
|
nits = lint.lint_metrics(all_metrics.value)
|
|
46
51
|
|
|
47
|
-
assert len(nits) ==
|
|
48
|
-
assert nits[0].check_name == "COMMON_PREFIX"
|
|
52
|
+
assert len(nits) == 0
|
|
49
53
|
|
|
50
54
|
# Now make sure the override works
|
|
51
55
|
contents[0]["no_lint"] = ["COMMON_PREFIX"]
|
|
@@ -149,10 +153,8 @@ def test_combined():
|
|
|
149
153
|
|
|
150
154
|
nits = lint.lint_metrics(all_metrics.value)
|
|
151
155
|
|
|
152
|
-
assert len(nits) ==
|
|
153
|
-
assert set(["
|
|
154
|
-
v.check_name for v in nits
|
|
155
|
-
)
|
|
156
|
+
assert len(nits) == 3
|
|
157
|
+
assert set(["CATEGORY_GENERIC", "UNIT_IN_NAME"]) == set(v.check_name for v in nits)
|
|
156
158
|
|
|
157
159
|
|
|
158
160
|
def test_baseline_restriction():
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
# http://creativecommons.org/publicdomain/zero/1.0/
|
|
5
5
|
|
|
6
6
|
from pathlib import Path
|
|
7
|
+
import datetime
|
|
7
8
|
import json
|
|
9
|
+
import os
|
|
8
10
|
import re
|
|
9
11
|
import textwrap
|
|
10
12
|
|
|
@@ -1203,6 +1205,7 @@ def test_no_internal_fields_exposed():
|
|
|
1203
1205
|
"disabled": False,
|
|
1204
1206
|
"expires": "never",
|
|
1205
1207
|
"gecko_datapoint": "",
|
|
1208
|
+
"in_session": False,
|
|
1206
1209
|
"keys": None,
|
|
1207
1210
|
"lifetime": "ping",
|
|
1208
1211
|
"metadata": {},
|
|
@@ -1449,3 +1452,62 @@ def test_forbid_non_ext_non_object_attribution_distribution():
|
|
|
1449
1452
|
"Extended attribution/distribution metrics must be of type 'object'"
|
|
1450
1453
|
in errors[1]
|
|
1451
1454
|
)
|
|
1455
|
+
|
|
1456
|
+
|
|
1457
|
+
def test_expire_epoch_can_be_overriden():
|
|
1458
|
+
metrics = [
|
|
1459
|
+
{
|
|
1460
|
+
"category": {
|
|
1461
|
+
"metric": {
|
|
1462
|
+
"type": "boolean",
|
|
1463
|
+
"expires": "2023-12-31", # definitely in the past
|
|
1464
|
+
},
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
]
|
|
1468
|
+
metrics = [util.add_required(x) for x in metrics]
|
|
1469
|
+
|
|
1470
|
+
all_metrics = parser.parse_objects(metrics)
|
|
1471
|
+
errors = list(all_metrics)
|
|
1472
|
+
assert len(errors) == 0
|
|
1473
|
+
assert all_metrics.value["category"]["metric"].disabled is True
|
|
1474
|
+
|
|
1475
|
+
# A date definitely before the above expiry.
|
|
1476
|
+
dt = datetime.datetime.strptime("2020-01-01", "%Y-%m-%d")
|
|
1477
|
+
os.environ["SOURCE_DATE_EPOCH"] = str(int(dt.timestamp()))
|
|
1478
|
+
|
|
1479
|
+
all_metrics = parser.parse_objects(metrics)
|
|
1480
|
+
errors = list(all_metrics)
|
|
1481
|
+
assert len(errors) == 0
|
|
1482
|
+
assert all_metrics.value["category"]["metric"].disabled is False
|
|
1483
|
+
|
|
1484
|
+
del os.environ["SOURCE_DATE_EPOCH"]
|
|
1485
|
+
|
|
1486
|
+
|
|
1487
|
+
@pytest.mark.parametrize(
|
|
1488
|
+
"invalid_epoch",
|
|
1489
|
+
[
|
|
1490
|
+
"not-a-date",
|
|
1491
|
+
"2020-01-01",
|
|
1492
|
+
"",
|
|
1493
|
+
],
|
|
1494
|
+
)
|
|
1495
|
+
def test_overriden_expire_epoch_must_be_valid(invalid_epoch):
|
|
1496
|
+
metrics = [
|
|
1497
|
+
{
|
|
1498
|
+
"category": {
|
|
1499
|
+
"metric": {
|
|
1500
|
+
"type": "boolean",
|
|
1501
|
+
"expires": "2023-12-31", # definitely in the past
|
|
1502
|
+
},
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
]
|
|
1506
|
+
metrics = [util.add_required(x) for x in metrics]
|
|
1507
|
+
|
|
1508
|
+
with pytest.raises(ValueError, match="Invalid SOURCE_DATE_EPOCH"):
|
|
1509
|
+
os.environ["SOURCE_DATE_EPOCH"] = invalid_epoch
|
|
1510
|
+
all_metrics = parser.parse_objects(metrics)
|
|
1511
|
+
list(all_metrics)
|
|
1512
|
+
|
|
1513
|
+
del os.environ["SOURCE_DATE_EPOCH"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{glean_parser-20.0.0 → glean_parser-20.1.0}/glean_parser/templates/javascript.buildinfo.jinja2
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/go_server_custom_ping_only_metrics.yaml
RENAMED
|
File without changes
|
{glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/go_server_custom_ping_only_pings.yaml
RENAMED
|
File without changes
|
{glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/go_server_events_and_custom_ping_metrics.yaml
RENAMED
|
File without changes
|
{glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/go_server_events_and_custom_ping_pings.yaml
RENAMED
|
File without changes
|
|
File without changes
|
{glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/go_server_labeled_boolean_metrics.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/python_server_metrics_unsupported.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/rust_server_custom_ping_only_metrics.yaml
RENAMED
|
File without changes
|
{glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/rust_server_custom_ping_only_pings.yaml
RENAMED
|
File without changes
|
|
File without changes
|
{glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/rust_server_events_and_custom_ping_pings.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/server_events_and_custom_ping_compare.go
RENAMED
|
File without changes
|
{glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/server_events_and_custom_ping_compare.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{glean_parser-20.0.0 → glean_parser-20.1.0}/tests/data/server_metrics_no_events_no_pings.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|