Bug 1773255 - Update to Glean v50.1.0 r=chutten,supply-chain-reviewers

Including glean_parser 6.1.1

Two important things in there:
* glean_parser: [data-review] Include extra keys' names and descriptions in data review template
* Glean: Derive `serde::{Deserialize, Serialize}` on `Lifetime` and `CommonMetricData`

Differential Revision: https://phabricator.services.mozilla.com/D149381
This commit is contained in:
Jan-Erik Rediger 2022-06-15 15:39:33 +00:00
Родитель 8662f38c59
Коммит 51f960bd09
39 изменённых файлов: 465 добавлений и 106 удалений

8
Cargo.lock сгенерированный
Просмотреть файл

@ -2256,9 +2256,9 @@ dependencies = [
[[package]]
name = "glean"
version = "50.0.1"
version = "50.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea3a101f9b9ccffbbcb7fe5159aabc22f7a5b8a266a9a810abff92ffe4b7bfc1"
checksum = "0857be0c251ae1fc3b5672237c99f5115a6546cd8b171cb240173098ab5e9629"
dependencies = [
"chrono",
"crossbeam-channel",
@ -2276,9 +2276,9 @@ dependencies = [
[[package]]
name = "glean-core"
version = "50.0.1"
version = "50.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e474434da0bdd88a97e06b9b47cd2eaa419e3707c21fee02f5c4d66577f3360"
checksum = "f1bdfa0e2e6476190b4762c4cdc87c1a7a0347f601864b091cf9ad674a909c68"
dependencies = [
"android_logger",
"bincode",

Просмотреть файл

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

8
gfx/wr/Cargo.lock сгенерированный
Просмотреть файл

@ -877,9 +877,9 @@ dependencies = [
[[package]]
name = "glean"
version = "50.0.1"
version = "50.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea3a101f9b9ccffbbcb7fe5159aabc22f7a5b8a266a9a810abff92ffe4b7bfc1"
checksum = "0857be0c251ae1fc3b5672237c99f5115a6546cd8b171cb240173098ab5e9629"
dependencies = [
"chrono",
"crossbeam-channel",
@ -897,9 +897,9 @@ dependencies = [
[[package]]
name = "glean-core"
version = "50.0.1"
version = "50.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e474434da0bdd88a97e06b9b47cd2eaa419e3707c21fee02f5c4d66577f3360"
checksum = "f1bdfa0e2e6476190b4762c4cdc87c1a7a0347f601864b091cf9ad674a909c68"
dependencies = [
"android_logger",
"bincode",

Просмотреть файл

@ -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 = "50.0.1"
glean = "50.1.0"
fog = { version = "0.1.0", optional = true }
swgl = { path = "../swgl", optional = true }
topological-sort = "0.1"

Просмотреть файл

@ -129,7 +129,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==50.0.1:telemetry will not be collected
pypi-optional:glean-sdk==50.1.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).

Просмотреть файл

@ -19,6 +19,18 @@ criteria = "safe-to-deploy"
version = "0.6.3"
notes = "Another crate I own via contain-rs that is ancient and in maintenance mode but otherwise perfectly fine."
[[audits.glean]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
version = "50.1.0"
notes = "Maintained by the Glean team at Mozilla"
[[audits.glean-core]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
version = "50.1.0"
notes = "Maintained by the Glean team at Mozilla"
[[audits.linked-hash-map]]
who = "Aria Beingessner <a.beingessner@gmail.com>"
criteria = "safe-to-deploy"

Просмотреть файл

@ -655,14 +655,6 @@ criteria = "safe-to-deploy"
version = "0.13.1"
criteria = "safe-to-deploy"
[[unaudited.glean]]
version = "50.0.1"
criteria = "safe-to-deploy"
[[unaudited.glean-core]]
version = "50.0.1"
criteria = "safe-to-deploy"
[[unaudited.glob]]
version = "0.3.0"
criteria = "safe-to-deploy"

Просмотреть файл

@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: glean-parser
Version: 6.0.1
Version: 6.1.1
Summary: Parser tools for Mozilla's Glean telemetry
Home-page: https://github.com/mozilla/glean_parser
Author: The Glean Team
@ -86,6 +86,16 @@ $ glean_parser check < ping.json
## Unreleased
## 6.1.1
- Rust: Use correct name for a ping in generated code.
## 6.1.0
- [data-review] Include extra keys' names and descriptions in data review template ([bug 1767027](https://bugzilla.mozilla.org/show_bug.cgi?id=1767027))
- Raise limit on number of statically-defined labels to 4096. ([bug 1772163](https://bugzilla.mozilla.org/show_bug.cgi?id=1772163))
- Fix Rust code generation for new UniFFI interface ([#491](https://github.com/mozilla/glean_parser/pull/491), [#494](https://github.com/mozilla/glean_parser/pull/494), [#495](https://github.com/mozilla/glean_parser/pull/495))
## 6.0.1
- Relax version requirement for MarkupSafe.

Просмотреть файл

@ -1,7 +1,7 @@
glean_parser/__init__.py,sha256=bJljD052_0y-efcBhYpllICVCXOMHLcXRLNyrvfgt5A,533
glean_parser/__main__.py,sha256=rLs4QpTvLIRGF223xSYkshGD9_aJmuDNOGj8PfZLqRE,7002
glean_parser/coverage.py,sha256=2IwC4XMDtDamMkBFoYilmqJzW4gyypq65YVCur8SNas,4405
glean_parser/data_review.py,sha256=0Mqt8AGGGELxKL_NMg4ShbGlcefPfdC_o2GtRXux_K4,5040
glean_parser/data_review.py,sha256=s_aguo4tCiPhpJoHUfsE1Z91N7wXyQt11hjH11jmqiM,5507
glean_parser/javascript.py,sha256=okBdomD628U0kO-r23mWC8lXPuVbZmL97wMCufgBYA8,11443
glean_parser/kotlin.py,sha256=kMCpULsg_LTx4UI1HMtRXtkA3YtEruqtvfOIauMlO74,13271
glean_parser/lint.py,sha256=_N294HLf5-PgGa-oQxb64xcLP24W9874IGheGzjO6jk,17088
@ -9,7 +9,7 @@ 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/pings.py,sha256=6XakkO9jnQc2oojLQJvTCMwF7w-BEm6rR54tunCb38o,2805
glean_parser/rust.py,sha256=KyibtG4ftz7Cy6FG5XlysTlLThpK7v7FpkAdxXkQxsw,6103
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
@ -17,7 +17,7 @@ glean_parser/translation_options.py,sha256=TpsvgaejlmOWkmTkarMx7cBVcjhshlJi33jsA
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=P5-hNS1Tz-kTo66v4xThU1mS21iwpgjg7CWC4Iybl1E,23886
glean_parser/schemas/metrics.2-0-0.schema.yaml,sha256=cw6nR9cjd1E0O0_daSZ-w1dFvClMcOrpJsFb-PNnMSw,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
@ -28,12 +28,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=dvGb8LL6GuxfmHrppfl3QdnDHVjdOEEHhc8jen1Xp7w,10869
glean_parser/templates/rust.jinja2,sha256=rskbE0LMcCTO488faVXrGAP_e-l7rUpysbkNZXKk1Ck,11083
glean_parser/templates/swift.jinja2,sha256=a8m1T3bLWieywYacpima16AwGBLjiEzCIzYGtYxm2D4,5214
glean_parser-6.0.1.dist-info/AUTHORS.md,sha256=yxgj8MioO4wUnrh0gmfb8l3DJJrf-l4HmmEDbQsbbNI,455
glean_parser-6.0.1.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
glean_parser-6.0.1.dist-info/METADATA,sha256=F_50cQI2pwTuDMFg-dhYpan_kfpF6RNQp4ivIQdHe8w,25339
glean_parser-6.0.1.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
glean_parser-6.0.1.dist-info/entry_points.txt,sha256=s-clJTIqp-PpJD-n3AnIQZFkTafIrzsTbAPX9vNY018,69
glean_parser-6.0.1.dist-info/top_level.txt,sha256=q7T3duD-9tYZFyDry6Wv2LcdMsK2jGnzdDFhxWcT2Z8,13
glean_parser-6.0.1.dist-info/RECORD,,
glean_parser-6.1.1.dist-info/AUTHORS.md,sha256=yxgj8MioO4wUnrh0gmfb8l3DJJrf-l4HmmEDbQsbbNI,455
glean_parser-6.1.1.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
glean_parser-6.1.1.dist-info/METADATA,sha256=sQ9fjwllYlvTTt05MAk0UalTMJ7tjdEAhRk1GKSn2eE,25928
glean_parser-6.1.1.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
glean_parser-6.1.1.dist-info/entry_points.txt,sha256=s-clJTIqp-PpJD-n3AnIQZFkTafIrzsTbAPX9vNY018,69
glean_parser-6.1.1.dist-info/top_level.txt,sha256=q7T3duD-9tYZFyDry6Wv2LcdMsK2jGnzdDFhxWcT2Z8,13
glean_parser-6.1.1.dist-info/RECORD,,

Просмотреть файл

@ -59,6 +59,13 @@ def generate(
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"
)
durations.add(metric.expires)

Просмотреть файл

@ -196,7 +196,7 @@ def output_rust(
template.render(
parser_version=__version__,
categories=categories,
extra_args=util.metric_args,
extra_metric_args=util.extra_metric_args,
common_metric_args=util.common_metric_args,
)
)

Просмотреть файл

@ -360,7 +360,7 @@ definitions:
uniqueItems: true
items:
$ref: "#/definitions/labeled_metric_id"
maxItems: 100
maxItems: 4096
- type: "null"
extra_keys:

Просмотреть файл

@ -32,10 +32,10 @@ pub struct {{ obj.name|Camelize }}{{ suffix }} {
impl ExtraKeys for {{ obj.name|Camelize }}{{ suffix }} {
const ALLOWED_KEYS: &'static [&'static str] = {{ obj.allowed_extra_keys|extra_keys }};
fn into_ffi_extra(self) -> ::std::collections::HashMap<i32, String> {
fn into_ffi_extra(self) -> ::std::collections::HashMap<::std::string::String, ::std::string::String> {
let mut map = ::std::collections::HashMap::new();
{% for key, _ in obj|attr(name) %}
self.{{key|snake_case}}.and_then(|val| map.insert({{loop.index-1}}, val));
self.{{key|snake_case}}.and_then(|val| map.insert("{{key}}".to_string(), val));
{% endfor %}
map
}
@ -43,21 +43,17 @@ impl ExtraKeys for {{ obj.name|Camelize }}{{ suffix }} {
{% endmacro %}
{% for category in categories %}
{% if category.contains_pings %}
use glean::private::Ping;
use once_cell::sync::Lazy;
{% for obj in category.objs.values() %}
#[allow(non_upper_case_globals, dead_code)]
/// {{ obj.description|wordwrap() | replace('\n', '\n/// ') }}
#[rustfmt::skip]
pub static {{ obj.name|snake_case }}: Lazy<Ping> =
Lazy::new(|| Ping::new("{{ obj.name }}", {{ obj.include_client_id|rust }}, {{ obj.send_if_empty|rust }}, {{ obj.reason_codes|rust }}));
pub static {{ obj.name|snake_case }}: ::glean::private::__export::Lazy<::glean::private::PingType> =
::glean::private::__export::Lazy::new(|| ::glean::private::PingType::new("{{ obj.name }}", {{ obj.include_client_id|rust }}, {{ obj.send_if_empty|rust }}, {{ obj.reason_codes|rust }}));
{% endfor %}
{% 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 once_cell::sync::Lazy;
{% for obj in category.objs.values() %}
{% if obj|attr("_generate_enums") %}
@ -67,7 +63,7 @@ pub mod {{ category.name|snake_case }} {
/// generated from {{ category.name }}.{{ obj.name }}
///
/// {{ obj.description|wordwrap() | replace('\n', '\n /// ') }}
pub static {{ obj.name|snake_case }}: Lazy<{{ obj|type_name }}> = Lazy::new(|| {
pub static {{ obj.name|snake_case }}: ::glean::private::__export::Lazy<{{ obj|type_name }}> = ::glean::private::__export::Lazy::new(|| {
{{ obj|ctor }}(CommonMetricData {
category: {{ obj.category|rust }},
name: {{ obj.name|rust }},
@ -76,7 +72,7 @@ pub mod {{ category.name|snake_case }} {
disabled: {{ obj.is_disabled()|rust }},
..Default::default()
}
{%- for arg_name in extra_args if obj[arg_name] is defined and arg_name not in common_metric_args and arg_name != 'allowed_extra_keys' -%}
{%- for arg_name in extra_metric_args if obj[arg_name] is defined and arg_name != 'allowed_extra_keys' -%}
, {{ obj[arg_name]|rust }}
{%- endfor -%}
{{ ", " if obj.labeled else ")\n" }}
@ -100,10 +96,9 @@ pub(crate) mod __glean_metric_maps {
use super::{id_for_extra_key, extra_keys_len};
use crate::private::*;
use once_cell::sync::Lazy;
{% for typ, metrics in metric_by_type.items() %}
pub static {{typ.0}}: Lazy<HashMap<MetricId, &Lazy<{{typ.1}}>>> = Lazy::new(|| {
pub static {{typ.0}}: ::glean::private::__export::Lazy<HashMap<MetricId, &Lazy<{{typ.1}}>>> = ::glean::private::__export::Lazy::new(|| {
let mut map = HashMap::with_capacity({{metrics|length}});
{% for metric in metrics %}
map.insert({{metric.0}}.into(), &super::{{metric.1}});
@ -269,13 +264,13 @@ pub(crate) mod __glean_metric_maps {
pub(crate) const MIN_LABELED_SUBMETRIC_ID: u32 = {{min_submetric_id}};
pub(crate) static NEXT_LABELED_SUBMETRIC_ID: AtomicU32 = AtomicU32::new(MIN_LABELED_SUBMETRIC_ID);
pub(crate) static LABELED_METRICS_TO_IDS: Lazy<RwLock<HashMap<(u32, String), u32>>> = Lazy::new(||
pub(crate) static LABELED_METRICS_TO_IDS: ::glean::private::__export::Lazy<RwLock<HashMap<(u32, String), u32>>> = ::glean::private::__export::Lazy::new(||
RwLock::new(HashMap::new())
);
{% for typ, metrics in metric_by_type.items() %}
{% if typ.0 in ('BOOLEAN_MAP', 'COUNTER_MAP', 'STRING_MAP') %}
pub static {{typ.0}}: Lazy<RwLock<HashMap<MetricId, Labeled{{typ.1}}>>> = Lazy::new(||
pub static {{typ.0}}: ::glean::private::__export::Lazy<RwLock<HashMap<MetricId, Labeled{{typ.1}}>>> = ::glean::private::__export::Lazy::new(||
RwLock::new(HashMap::new())
);
{% endif %}

8
third_party/python/poetry.lock сгенерированный поставляемый
Просмотреть файл

@ -196,7 +196,7 @@ python-versions = "*"
[[package]]
name = "glean-parser"
version = "6.0.1"
version = "6.1.1"
description = "Parser tools for Mozilla's Glean telemetry"
category = "main"
optional = false
@ -729,7 +729,7 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pyt
[metadata]
lock-version = "1.1"
python-versions = "^3.6"
content-hash = "9e86d62b3aa4e09f6c555e561e383a6a2e3c8935694858aea94db3a96eebdc1d"
content-hash = "f473795bdc4bd0ee2360afd9b5346ede7792e1befae9cc7dd5bf6b9b814a7874"
[metadata.files]
aiohttp = [
@ -843,8 +843,8 @@ esprima = [
{file = "fluent.syntax-0.18.1.tar.gz", hash = "sha256:3a55f5e605d1b029a65cc8b6492c86ec4608e15447e73db1495de11fd46c104f"},
]
glean-parser = [
{file = "glean_parser-6.0.1-py3-none-any.whl", hash = "sha256:d7cc9c12b1b64bb2ac84db10d2e853c1aa94b036351e2f41f6bafc94ba29b2e4"},
{file = "glean_parser-6.0.1.tar.gz", hash = "sha256:05acc5d25285ecf9d59adb402719bc9ffbddb11b156e8f0479c3d503bf7ad347"},
{file = "glean_parser-6.1.1-py3-none-any.whl", hash = "sha256:225dc6d30d9c04459df2aebbd1950691fa32602a9be0228759a5bfaf2ece8581"},
{file = "glean_parser-6.1.1.tar.gz", hash = "sha256:bc41a57aa432b4d632cbf0df1f0ab1ac720e3028f8b194dabdfbb1c837393b7d"},
]
idna = [
{file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"},

2
third_party/python/requirements.in поставляемый
Просмотреть файл

@ -10,7 +10,7 @@ ecdsa==0.15
esprima==4.0.1
fluent.migrate==0.11
fluent.syntax==0.18.1
glean_parser==6.0.1
glean_parser==6.1.1
# Pin importlib-metadata to a version compatible with poetry
importlib-metadata==1.7.0
jsmin==2.1.0

6
third_party/python/requirements.txt поставляемый
Просмотреть файл

@ -89,9 +89,9 @@ fluent.migrate==0.11 \
fluent.syntax==0.18.1 \
--hash=sha256:0e63679fa4f1b3042565220a5127b4bab842424f07d6a13c12299e3b3835486a \
--hash=sha256:3a55f5e605d1b029a65cc8b6492c86ec4608e15447e73db1495de11fd46c104f
glean-parser==6.0.1 \
--hash=sha256:d7cc9c12b1b64bb2ac84db10d2e853c1aa94b036351e2f41f6bafc94ba29b2e4 \
--hash=sha256:05acc5d25285ecf9d59adb402719bc9ffbddb11b156e8f0479c3d503bf7ad347
glean-parser==6.1.1 \
--hash=sha256:225dc6d30d9c04459df2aebbd1950691fa32602a9be0228759a5bfaf2ece8581 \
--hash=sha256:bc41a57aa432b4d632cbf0df1f0ab1ac720e3028f8b194dabdfbb1c837393b7d
idna-ssl==1.1.0; python_version < "3.7" and python_version >= "3.6" \
--hash=sha256:a933e3bb13da54383f9e8f35dc4f9cb9eb9b3b78c6b36f311254d6d0d92c6c7c
idna==2.10; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" or python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.7" or python_version < "3.7" and python_version >= "3.6" and python_full_version >= "3.4.0" or python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6" \

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

4
third_party/rust/glean-core/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
edition = "2018"
name = "glean-core"
version = "50.0.1"
version = "50.1.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.0.1"
glean-parser = "6.1.1"
[dependencies.bincode]
version = "1.2.1"

Просмотреть файл

@ -7,12 +7,14 @@ use std::convert::TryFrom;
use crate::error::{Error, ErrorKind};
use crate::metrics::labeled::validate_dynamic_label;
use crate::Glean;
use serde::{Deserialize, Serialize};
/// The supported metrics' lifetimes.
///
/// A metric's lifetime determines when its stored data gets reset.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[repr(i32)] // Use i32 to be compatible with our JNA definition
#[serde(rename_all = "lowercase")]
pub enum Lifetime {
/// The metric is reset with each sent ping
Ping,
@ -53,7 +55,7 @@ impl TryFrom<i32> for Lifetime {
}
/// The common set of data shared across all different metric types.
#[derive(Default, Debug, Clone)]
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
pub struct CommonMetricData {
/// The metric's name.
pub name: String,

10
third_party/rust/glean-core/src/glean.udl поставляемый
Просмотреть файл

@ -537,3 +537,13 @@ interface NumeratorMetric {
i32 test_get_num_recorded_errors(ErrorType error, optional string? ping_name = null);
};
interface TextMetric {
constructor(CommonMetricData meta);
void set(string value);
string? test_get_value(optional string? ping_name = null);
i32 test_get_num_recorded_errors(ErrorType error, optional string? ping_name = null);
};

24
third_party/rust/glean-core/src/lib.rs поставляемый
Просмотреть файл

@ -59,8 +59,8 @@ pub use crate::metrics::{
BooleanMetric, CounterMetric, CustomDistributionMetric, Datetime, DatetimeMetric,
DenominatorMetric, DistributionData, EventMetric, MemoryDistributionMetric, MemoryUnit,
NumeratorMetric, PingType, QuantityMetric, Rate, RateMetric, RecordedEvent, RecordedExperiment,
StringListMetric, StringMetric, TimeUnit, TimerId, TimespanMetric, TimingDistributionMetric,
UrlMetric, UuidMetric,
StringListMetric, StringMetric, TextMetric, TimeUnit, TimerId, TimespanMetric,
TimingDistributionMetric, UrlMetric, UuidMetric,
};
pub use crate::upload::{PingRequest, PingUploadTask, UploadResult};
@ -486,26 +486,6 @@ pub fn persist_ping_lifetime_data() {
});
}
/// Unblock the global dispatcher to start processing queued tasks.
pub extern "C" fn rlb_flush_dispatcher() {
let was_initialized = was_initialize_called();
// Panic in debug mode
debug_assert!(!was_initialized);
// In release do a check and bail out
if was_initialized {
log::error!(
"Tried to flush the dispatcher from outside, but Glean was initialized in the RLB."
);
return;
}
if let Err(err) = dispatcher::flush_init() {
log::error!("Unable to flush the preinit queue: {}", err);
}
}
fn initialize_core_metrics(glean: &Glean, client_info: &ClientInfoMetrics) {
core_metrics::internal_metrics::app_build.set_sync(glean, &client_info.app_build[..]);
core_metrics::internal_metrics::app_display_version

Просмотреть файл

@ -402,6 +402,7 @@ fn correct_order() {
}
// One of every metric type. The values are arbitrary and don't matter.
let long_string = "0123456789".repeat(200);
let all_metrics = vec![
Boolean(false),
Counter(0),
@ -418,6 +419,7 @@ fn correct_order() {
MemoryDistribution(Histogram::functional(2.0, 8.0)),
Jwe("eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ.OKOawDo13gRp2ojaHV7LFpZcgV7T6DVZKTyKOMTYUmKoTCVJRgckCL9kiMT03JGeipsEdY3mx_etLbbWSrFr05kLzcSr4qKAq7YN7e9jwQRb23nfa6c9d-StnImGyFDbSv04uVuxIp5Zms1gNxKKK2Da14B8S4rzVRltdYwam_lDp5XnZAYpQdb76FdIKLaVmqgfwX7XWRxv2322i-vDxRfqNzo_tETKzpVLzfiwQyeyPGLBIO56YJ7eObdv0je81860ppamavo35UgoRdbYaBcoh9QcfylQr66oc6vFWXRcZ_ZT2LawVCWTIy3brGPi6UklfCpIMfIjf7iGdXKHzg.48V1_ALb6US04U3b.5eym8TW_c8SuK0ltJ3rpYIzOeDQz7TALvtu6UG9oMo4vpzs9tX_EFShS8iB7j6jiSdiwkIr3ajwQzaBtQD_A.XFBoMYUZodetZdvTiFvSkQ".into()),
Rate(0, 0),
Text(long_string),
];
for metric in all_metrics {
@ -445,6 +447,7 @@ fn correct_order() {
Jwe(..) => assert_eq!(13, disc),
Rate(..) => assert_eq!(14, disc),
Url(..) => assert_eq!(15, disc),
Text(..) => assert_eq!(16, disc),
}
}
}

Просмотреть файл

@ -27,6 +27,7 @@ mod rate;
mod recorded_experiment;
mod string;
mod string_list;
mod text;
mod time_unit;
mod timespan;
mod timing_distribution;
@ -56,6 +57,7 @@ pub use self::quantity::QuantityMetric;
pub use self::rate::{Rate, RateMetric};
pub use self::string::StringMetric;
pub use self::string_list::StringListMetric;
pub use self::text::TextMetric;
pub use self::time_unit::TimeUnit;
pub use self::timespan::TimespanMetric;
pub use self::timing_distribution::TimerId;
@ -125,6 +127,8 @@ pub enum Metric {
Rate(i32, i32),
/// A URL metric. See [`UrlMetric`] for more information.
Url(String),
/// A Text metric. See [`TextMetric`] for more information.
Text(String),
}
/// A [`MetricType`] describes common behavior across all metrics.
@ -181,6 +185,7 @@ impl Metric {
Metric::Uuid(_) => "uuid",
Metric::MemoryDistribution(_) => "memory_distribution",
Metric::Jwe(_) => "jwe",
Metric::Text(_) => "text",
}
}
@ -209,6 +214,7 @@ impl Metric {
Metric::Uuid(s) => json!(s),
Metric::MemoryDistribution(hist) => json!(memory_distribution::snapshot(hist)),
Metric::Jwe(s) => json!(s),
Metric::Text(s) => json!(s),
}
}
}

180
third_party/rust/glean-core/src/metrics/text.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,180 @@
// 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 https://mozilla.org/MPL/2.0/.
use std::sync::Arc;
use crate::error_recording::{test_get_num_recorded_errors, ErrorType};
use crate::metrics::Metric;
use crate::metrics::MetricType;
use crate::storage::StorageManager;
use crate::util::truncate_string_at_boundary_with_error;
use crate::CommonMetricData;
use crate::Glean;
// The maximum number of characters for text.
const MAX_LENGTH_VALUE: usize = 200 * 1024;
/// A text metric.
///
/// Records a single long Unicode text,
/// used when the limits on `String` are too low.
/// Text is length-limited to `MAX_LENGTH_VALUE` bytes.
#[derive(Clone, Debug)]
pub struct TextMetric {
meta: Arc<CommonMetricData>,
}
impl MetricType for TextMetric {
fn meta(&self) -> &CommonMetricData {
&self.meta
}
fn with_name(&self, name: String) -> Self {
let mut meta = (*self.meta).clone();
meta.name = name;
Self {
meta: Arc::new(meta),
}
}
fn with_dynamic_label(&self, label: String) -> Self {
let mut meta = (*self.meta).clone();
meta.dynamic_label = Some(label);
Self {
meta: Arc::new(meta),
}
}
}
// IMPORTANT:
//
// When changing this implementation, make sure all the operations are
// also declared in the related trait in `../traits/`.
impl TextMetric {
/// Creates a new text metric.
pub fn new(meta: CommonMetricData) -> Self {
Self {
meta: Arc::new(meta),
}
}
/// Sets to the specified value.
///
/// # Arguments
///
/// * `value` - The text to set the metric to.
///
/// ## Notes
///
/// Truncates the value (at codepoint boundaries) if it is longer than `MAX_LENGTH_VALUE` bytes
/// and logs an error.
pub fn set(&self, value: String) {
let metric = self.clone();
crate::launch_with_glean(move |glean| metric.set_sync(glean, &value))
}
/// Sets to the specified value synchronously,
/// truncating and recording an error if longer than `MAX_LENGTH_VALUE`.
#[doc(hidden)]
pub fn set_sync<S: Into<String>>(&self, glean: &Glean, value: S) {
if !self.should_record(glean) {
return;
}
let s = truncate_string_at_boundary_with_error(glean, &self.meta, value, MAX_LENGTH_VALUE);
let value = Metric::Text(s);
glean.storage().record(glean, &self.meta, &value)
}
/// Gets the currently-stored value as a string, or None if there is no value.
#[doc(hidden)]
pub fn get_value<'a, S: Into<Option<&'a str>>>(
&self,
glean: &Glean,
ping_name: S,
) -> Option<String> {
let queried_ping_name = ping_name
.into()
.unwrap_or_else(|| &self.meta().send_in_pings[0]);
match StorageManager.snapshot_metric_for_test(
glean.storage(),
queried_ping_name,
&self.meta.identifier(glean),
self.meta.lifetime,
) {
Some(Metric::Text(s)) => Some(s),
_ => None,
}
}
/// **Test-only API (exported for FFI purposes).**
///
/// Gets the currently stored value as a string.
///
/// This doesn't clear the stored value.
pub fn test_get_value(&self, ping_name: Option<String>) -> Option<String> {
crate::block_on_dispatcher();
crate::core::with_glean(|glean| self.get_value(glean, ping_name.as_deref()))
}
/// **Exported for test purposes.**
///
/// Gets the number of recorded errors for the given metric and error type.
///
/// # Arguments
///
/// * `error` - The type of error
/// * `ping_name` - represents the optional name of the ping to retrieve the
/// metric for. Defaults to the first value in `send_in_pings`.
///
/// # Returns
///
/// The number of errors reported.
pub fn test_get_num_recorded_errors(&self, error: ErrorType, ping_name: Option<String>) -> i32 {
crate::block_on_dispatcher();
crate::core::with_glean(|glean| {
test_get_num_recorded_errors(glean, self.meta(), error, ping_name.as_deref())
.unwrap_or(0)
})
}
}
#[cfg(test)]
mod test {
use super::*;
use crate::test_get_num_recorded_errors;
use crate::tests::new_glean;
use crate::util::truncate_string_at_boundary;
use crate::ErrorType;
use crate::Lifetime;
#[test]
fn setting_a_long_string_records_an_error() {
let (glean, _) = new_glean(None);
let metric = TextMetric::new(CommonMetricData {
name: "text_metric".into(),
category: "test".into(),
send_in_pings: vec!["store1".into()],
lifetime: Lifetime::Application,
disabled: false,
dynamic_label: None,
});
let sample_string = "0123456789".repeat(200 * 1024);
metric.set_sync(&glean, sample_string.clone());
let truncated = truncate_string_at_boundary(sample_string, MAX_LENGTH_VALUE);
assert_eq!(truncated, metric.get_value(&glean, "store1").unwrap());
assert_eq!(
1,
test_get_num_recorded_errors(&glean, metric.meta(), ErrorType::InvalidOverflow, None)
.unwrap()
);
}
}

Просмотреть файл

@ -20,6 +20,7 @@ mod quantity;
mod rate;
mod string;
mod string_list;
mod text;
mod timespan;
mod timing_distribution;
mod url;
@ -41,6 +42,7 @@ pub use self::quantity::Quantity;
pub use self::rate::Rate;
pub use self::string::String;
pub use self::string_list::StringList;
pub use self::text::Text;
pub use self::timespan::Timespan;
pub use self::timing_distribution::TimingDistribution;
pub use self::url::Url;

56
third_party/rust/glean-core/src/traits/text.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,56 @@
// 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 https://mozilla.org/MPL/2.0/.
use crate::ErrorType;
/// A description for the [`TextMetric`](crate::metrics::TextMetric) type.
///
/// When changing this trait, make sure all the operations are
/// implemented in the related type in `../metrics/`.
pub trait Text {
/// Sets to the specified value.
///
/// # Arguments
///
/// * `value` - The string to set the metric to.
///
/// ## Notes
///
/// Truncates the value if it is longer than `MAX_LENGTH_VALUE` bytes and logs an error.
fn set<S: Into<std::string::String>>(&self, value: S);
/// **Exported for test purposes.**
///
/// Gets the currently stored value as a string.
///
/// This doesn't clear the stored value.
///
/// # Arguments
///
/// * `ping_name` - represents the optional name of the ping to retrieve the
/// metric for. Defaults to the first value in `send_in_pings`.
fn test_get_value<'a, S: Into<Option<&'a str>>>(
&self,
ping_name: S,
) -> Option<std::string::String>;
/// **Exported for test purposes.**
///
/// Gets the number of recorded errors for the given metric and error type.
///
/// # Arguments
///
/// * `error` - The type of error
/// * `ping_name` - represents the optional name of the ping to retrieve the
/// metric for. Defaults to the first value in `send_in_pings`.
///
/// # Returns
///
/// The number of errors reported.
fn test_get_num_recorded_errors<'a, S: Into<Option<&'a str>>>(
&self,
error: ErrorType,
ping_name: S,
) -> i32;
}

115
third_party/rust/glean-core/tests/text.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,115 @@
// 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 https://mozilla.org/MPL/2.0/.
mod common;
use crate::common::*;
use serde_json::json;
use glean_core::metrics::*;
use glean_core::storage::StorageManager;
use glean_core::{test_get_num_recorded_errors, ErrorType};
use glean_core::{CommonMetricData, Lifetime};
#[test]
fn text_serializer_should_correctly_serialize_strings() {
let (mut tempdir, _) = tempdir();
{
// We give tempdir to the `new_glean` function...
let (glean, dir) = new_glean(Some(tempdir));
// And then we get it back once that function returns.
tempdir = dir;
let metric = TextMetric::new(CommonMetricData {
name: "text_metric".into(),
category: "telemetry".into(),
send_in_pings: vec!["store1".into()],
disabled: false,
lifetime: Lifetime::User,
..Default::default()
});
metric.set_sync(&glean, "test_text_value");
let snapshot = StorageManager
.snapshot_as_json(glean.storage(), "store1", true)
.unwrap();
assert_eq!(
json!({"text": {"telemetry.text_metric": "test_text_value"}}),
snapshot
);
}
// Make a new Glean instance here, which should force reloading of the data from disk
// so we can ensure it persisted, because it has User lifetime
{
let (glean, _) = new_glean(Some(tempdir));
let snapshot = StorageManager
.snapshot_as_json(glean.storage(), "store1", true)
.unwrap();
assert_eq!(
json!({"text": {"telemetry.text_metric": "test_text_value"}}),
snapshot
);
}
}
#[test]
fn set_properly_sets_the_value_in_all_stores() {
let (glean, _t) = new_glean(None);
let store_names: Vec<String> = vec!["store1".into(), "store2".into()];
let metric = TextMetric::new(CommonMetricData {
name: "text_metric".into(),
category: "telemetry".into(),
send_in_pings: store_names.clone(),
disabled: false,
lifetime: Lifetime::Ping,
..Default::default()
});
metric.set_sync(&glean, "test_text_value");
// Check that the data was correctly set in each store.
for store_name in store_names {
let snapshot = StorageManager
.snapshot_as_json(glean.storage(), &store_name, true)
.unwrap();
assert_eq!(
json!({"text": {"telemetry.text_metric": "test_text_value"}}),
snapshot
);
}
}
#[test]
fn long_text_values_are_truncated() {
let (glean, _t) = new_glean(None);
let metric = TextMetric::new(CommonMetricData {
name: "text_metric".into(),
category: "telemetry".into(),
send_in_pings: vec!["store1".into()],
disabled: false,
lifetime: Lifetime::Ping,
..Default::default()
});
let test_sting = "01234567890".repeat(200 * 1024);
metric.set_sync(&glean, test_sting.clone());
// Check that data was truncated
assert_eq!(
test_sting[..(200 * 1024)],
metric.get_value(&glean, "store1").unwrap()
);
// Make sure that the errors have been recorded
assert_eq!(
Ok(1),
test_get_num_recorded_errors(&glean, metric.meta(), ErrorType::InvalidOverflow, None)
);
}

2
third_party/rust/glean/.cargo-checksum.json поставляемый
Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"35377575513ab7eda34c4e4ed92d714674a6a053720770392302bb2b9e227f04","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"fd9e0ca6907917ea6bec5de05e15dd21d20fae1cb7f3250467bb20231a8e1065","src/common_test.rs":"68f6d408cb7b683fa32c8b38a4df1e6c45bfd77c0c90ca35976ea7548bbc4b2f","src/configuration.rs":"37ad5b3e7d4e31dd04a7d6690179168b5f2768d87dd36056dee5d08bdbe20fb2","src/core_metrics.rs":"76ac5350cb6f82d9a193d519b085a08f138dceba77da3514bd0c636bcdefefca","src/lib.rs":"1f49d9414a4ea1624a124b4b7c7b9704d01899669fcf792df3eef467bf449912","src/net/http_uploader.rs":"43812a70d19a38e8d7a093c8076c2b6345372c3c861b0f3511428762700a65e0","src/net/mod.rs":"86cbcb0b46f9d13923a20db9e482b65da49d7daa4e335a3f3092f1d760f572b0","src/private/event.rs":"f6cd799c7764c53510180a1cef6a5a9b435fae27b87270519d5b4e59201e8ecc","src/private/mod.rs":"33b644527ab5f362b4bc511cdf66260d689100286dbcf53d1f8842ca5abd23f1","src/private/ping.rs":"cbdc57f41fc9d46e56b4dfff91ac683753d1f8b3ecd0aa9bc3419e3595b8b81b","src/system.rs":"ff23a5b94f52dab484342dfed702412bc29ab1bbfd5af326033d8e07e7b9075f","src/test.rs":"30d62d967c56a7ca76c097e27bfb6d6d3779ccd5d374cf5a07a04216e4e0880b","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":"ea3a101f9b9ccffbbcb7fe5159aabc22f7a5b8a266a9a810abff92ffe4b7bfc1"}
{"files":{"Cargo.toml":"0b561e6268bc36b36c8c29d82fde25a451bd8fb7d618efa2145255033616a73b","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":"86cbcb0b46f9d13923a20db9e482b65da49d7daa4e335a3f3092f1d760f572b0","src/private/event.rs":"f6cd799c7764c53510180a1cef6a5a9b435fae27b87270519d5b4e59201e8ecc","src/private/mod.rs":"0364ecf5f0439443a5b209583f4ff2c474b79f7c253c981ab0b7cdc528368698","src/private/ping.rs":"cbdc57f41fc9d46e56b4dfff91ac683753d1f8b3ecd0aa9bc3419e3595b8b81b","src/system.rs":"ff23a5b94f52dab484342dfed702412bc29ab1bbfd5af326033d8e07e7b9075f","src/test.rs":"30d62d967c56a7ca76c097e27bfb6d6d3779ccd5d374cf5a07a04216e4e0880b","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":"0857be0c251ae1fc3b5672237c99f5115a6546cd8b171cb240173098ab5e9629"}

4
third_party/rust/glean/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
edition = "2018"
name = "glean"
version = "50.0.1"
version = "50.1.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 = "50.0.1"
version = "50.1.0"
[dependencies.inherent]
version = "1"

6
third_party/rust/glean/README.md поставляемый
Просмотреть файл

@ -1,4 +1,4 @@
# glean
# Glean
The `Glean SDK` is a modern approach for a Telemetry library and is part of the [Glean project](https://docs.telemetry.mozilla.org/concepts/glean/glean.html).
@ -6,8 +6,6 @@ The `Glean SDK` is a modern approach for a Telemetry library and is part of the
This library provides a Rust language bindings on top of `glean-core`, targeted to Rust consumers.
**Note: `glean` is currently under development and not yet ready for use.**
## Documentation
All documentation is available online:
@ -16,7 +14,7 @@ All documentation is available online:
* [API documentation][apidocs]
[book]: https://mozilla.github.io/glean/
[apidocs]: https://mozilla.github.io/glean/docs/glean_preview/index.html
[apidocs]: https://mozilla.github.io/glean/docs/glean/index.html
## Example

15
third_party/rust/glean/src/lib.rs поставляемый
Просмотреть файл

@ -128,21 +128,6 @@ pub fn shutdown() {
glean_core::shutdown()
}
/// Unblock the global dispatcher to start processing queued tasks.
///
/// This should _only_ be called if it is guaranteed that `initialize` will never be called.
///
/// **Note**: Exported as a FFI function to be used by other language bindings (e.g. Kotlin/Swift)
/// to unblock the RLB-internal dispatcher.
/// This allows the usage of both the RLB and other language bindings (e.g. Kotlin/Swift)
/// within the same application.
#[no_mangle]
#[inline(never)]
pub extern "C" fn rlb_flush_dispatcher() {
log::trace!("FLushing RLB dispatcher through the FFI");
glean_core::rlb_flush_dispatcher()
}
/// Sets whether upload is enabled or not.
///
/// See [`glean_core::Glean::set_upload_enabled`].

6
third_party/rust/glean/src/private/mod.rs поставляемый
Просмотреть файл

@ -26,3 +26,9 @@ pub use glean_core::UuidMetric;
pub use glean_core::{AllowLabeled, LabeledMetric};
pub use glean_core::{Datetime, DatetimeMetric};
pub use ping::PingType;
// Re-export types that are used by the glean_parser-generated code.
#[doc(hidden)]
pub mod __export {
pub use once_cell::sync::Lazy;
}

Просмотреть файл

@ -6,7 +6,7 @@ edition = "2018"
license = "MPL-2.0"
[dependencies]
glean = { version = "50.0.1", features = ["rkv-safe-mode"] }
glean = { version = "50.1.0", features = ["rkv-safe-mode"] }
log = "0.4"
nserror = { path = "../../../xpcom/rust/nserror" }
nsstring = { path = "../../../xpcom/rust/nsstring" }

Просмотреть файл

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