Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

[Full changelog](https://github.com/mozilla/glean/compare/v70.0.0...main)

* General
* Updated to `glean_parser` v21.0.0 ([#3573](https://github.com/mozilla/glean/issues/3573))
* Android
* Implement labeled {custom|memory|timing} distribution ([#3573](https://github.com/mozilla/glean/pull/3573))
* iOS
* Implement labeled {custom|memory|timing} distribution ([#3573](https://github.com/mozilla/glean/pull/3573))
* Python
* Implement labeled {custom|memory|timing} distribution and labeled quantity ([#3573](https://github.com/mozilla/glean/pull/3573))

# v70.0.0 (2026-08-20)

[Full changelog](https://github.com/mozilla/glean/compare/v69.0.0...v70.0.0)
Expand Down
2 changes: 1 addition & 1 deletion 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 Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ docs-python: build-python ## Build the Python documentation
.PHONY: docs docs-rust docs-swift

docs-metrics: setup-python ## Build the internal metrics documentation
$(GLEAN_PYENV)/bin/pip install glean_parser~=20.1
$(GLEAN_PYENV)/bin/pip install glean_parser~=21.0
$(GLEAN_PYENV)/bin/glean_parser translate --allow-reserved \
-f markdown \
-o ./docs/user/user/collected-metrics \
Expand Down
201 changes: 185 additions & 16 deletions docs/user/reference/metrics/labeled_custom_distributions.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,47 @@ Accumulate the provided samples in the metric.

{{#include ../../../shared/tab_header.md}}

<div data-lang="Kotlin" class="tab"></div>
<div data-lang="Java" class="tab"></div>
<div data-lang="Swift" class="tab"></div>
<div data-lang="Python" class="tab"></div>
<div data-lang="Kotlin" class="tab">

```Kotlin
import org.mozilla.yourApplication.GleanMetrics.Network

Network.http3LateAckRatio["ack"].accumulateSamples(listOf((late_ack * 10000) / packets_tx))
Network.http3LateAckRatio["pto"].accumulateSamples(listOf((pto_ack * 10000) / packets_tx))
```

</div>
<div data-lang="Java" class="tab">

```Java
import org.mozilla.yourApplication.GleanMetrics.Network;

Network.INSTANCE.http3LateAckRatio()["ack"].accumulateSamples(listOf((late_ack * 10000) / packets_tx));
Network.INSTANCE.http3LateAckRatio()["pto"].accumulateSamples(listOf((pto_ack * 10000) / packets_tx));
```

</div>
<div data-lang="Swift" class="tab">

```Swift
import Glean

Network.http3LateAckRatio["ack"].accumulateSamples([(late_ack * 10000) / packets_tx]);
Network.http3LateAckRatio["pto"].accumulateSamples([(pto_ack * 10000) / packets_tx]);
```

</div>
<div data-lang="Python" class="tab">

```Python
from glean import load_metrics
metrics = load_metrics("metrics.yaml")

metrics.network.http3_late_ack_ratio["ack"].accumulate_samples([(late_ack * 10000) // packets_tx])
metrics.network.http3_late_ack_ratio["pto"].accumulate_samples([(late_pto * 10000) // packets_tx])
```

</div>
<div data-lang="Rust" class="tab">

```Rust
Expand Down Expand Up @@ -85,10 +122,47 @@ Accumulates one sample and appends it to the metric.

{{#include ../../../shared/tab_header.md}}

<div data-lang="Kotlin" class="tab"></div>
<div data-lang="Java" class="tab"></div>
<div data-lang="Swift" class="tab"></div>
<div data-lang="Python" class="tab"></div>
<div data-lang="Kotlin" class="tab">

```Kotlin
import org.mozilla.yourApplication.GleanMetrics.Network

Network.http3LateAckRatio["ack"].accumulateSingleSample((late_ack * 10000) / packets_tx)
Network.http3LateAckRatio["pto"].accumulateSingleSample((pto_ack * 10000) / packets_tx)
```

</div>
<div data-lang="Java" class="tab">

```Java
import org.mozilla.yourApplication.GleanMetrics.Network;

Network.INSTANCE.http3LateAckRatio()["ack"].accumulateSingleSample((late_ack * 10000) / packets_tx);
Network.INSTANCE.http3LateAckRatio()["pto"].accumulateSingleSample((pto_ack * 10000) / packets_tx);
```

</div>
<div data-lang="Swift" class="tab">

```Swift
import Glean

Network.http3LateAckRatio["ack"].accumulateSingleSample((late_ack * 10000) / packets_tx);
Network.http3LateAckRatio["pto"].accumulateSingleSample((pto_ack * 10000) / packets_tx);
```

</div>
<div data-lang="Python" class="tab">

```Python
from glean import load_metrics
metrics = load_metrics("metrics.yaml")

metrics.network.http3_late_ack_ratio["ack"].accumulate_single_sample([(late_ack * 10000) // packets_tx])
metrics.network.http3_late_ack_ratio["pto"].accumulate_single_sample([(late_pto * 10000) // packets_tx])
```

</div>
<div data-lang="Rust" class="tab">

```Rust
Expand Down Expand Up @@ -159,10 +233,71 @@ in Rust where it's required. `None` or no argument will default to the first val

{{#include ../../../shared/tab_header.md}}

<div data-lang="Kotlin" class="tab"></div>
<div data-lang="Java" class="tab"></div>
<div data-lang="Swift" class="tab"></div>
<div data-lang="Python" class="tab"></div>
<div data-lang="Kotlin" class="tab">

```Kotlin
import org.mozilla.yourApplication.GleanMetrics.Network

// Assert the sum of all `ack` samples is 42.
assertEquals(42, Network.http3LateAckRatio["ack"].testGetValue().sum)

// Assert there's only the one sample
assertEquals(1, Network.http3LateAckRatio["ack"].testGetValue().count)

// Buckets are indexed by their lower bound.
assertEquals(1, Network.http3LateAckRatio["ack"].testGetValue().values[41])
```

</div>
<div data-lang="Java" class="tab">

```Java
import org.mozilla.yourApplication.GleanMetrics.Network

// Assert the sum of all `ack` samples is 42.
assertEquals(42, Network.INSTANCE.http3LateAckRatio()["ack"].testGetValue().sum);

// Assert there's only the one sample
assertEquals(1, Network.INSTANCE.http3LateAckRatio()["ack"].testGetValue().count);

// Buckets are indexed by their lower bound.
assertEquals(1, Network.INSTANCE.http3LateAckRatio()["ack"].testGetValue().values[41]);
```

</div>
<div data-lang="Swift" class="tab">

```Swift
import Glean

// Assert the sum of all `ack` samples is 42.
XCTAssertEqual(42, Network.http3LateAckRatio["ack"].testGetValue().sum)

// Assert there's only the one sample
XCTAssertEqual(1, Network.http3LateAckRatio["ack"].testGetValue().count)

// Buckets are indexed by their lower bound.
XCTAssertEqual(1, Network.http3LateAckRatio["ack"].testGetValue().values[41])
```

</div>
<div data-lang="Python" class="tab">

```Python
from glean import load_metrics
metrics = load_metrics("metrics.yaml")

# Assert the sum of all samples is 42.
assert 42 == metrics.network.http3_late_ack_ratio.get("ack").test_get_value().sum

# Assert there's only the one sample
assert 1 == metrics.network.http3_late_ack_ratio.get("ack").test_get_value().count

# Buckets are indexed by their lower bound.
assert 1 == metrics.network.http3_late_ack_ratio.get("ack").test_get_value().values[41]
```

</div>
<div data-lang="Rust" class="tab">

```Rust
Expand Down Expand Up @@ -209,10 +344,44 @@ Gets the number of errors recorded for a given labeled custom distribution metri

{{#include ../../../shared/tab_header.md}}

<div data-lang="Kotlin" class="tab"></div>
<div data-lang="Java" class="tab"></div>
<div data-lang="Swift" class="tab"></div>
<div data-lang="Python" class="tab"></div>
<div data-lang="Kotlin" class="tab">

```Kotlin
import org.mozilla.yourApplication.GleanMetrics.Network

assertEquals(0, Network.http3LateAckRatio.testGetNumRecordedErrors(ErrorType.INVALID_VALUE)
```

</div>
<div data-lang="Java" class="tab">

```Java
import org.mozilla.yourApplication.GleanMetrics.Network;

assertEquals(0, Network.http3LateAckRatio.testGetNumRecordedErrors(ErrorType.INVALID_VALUE);
```

</div>
<div data-lang="Swift" class="tab">

```Swift
import Glean

XCTAssertEqual(0, Network.http3LateAckRatio.testGetNumRecordedErrors(.invalidValue)
```

</div>
<div data-lang="Python" class="tab">

```Python
from glean import load_metrics
metrics = load_metrics("metrics.yaml")

# Assert there were no negative values instrumented.
assert 0 == metrics.network.http3_late_ack_ratio.get("ack").test_get_num_recorded_errors(ErrorType.INVALID_VALUE)
```

</div>
<div data-lang="Rust" class="tab">

```Rust
Expand Down
Loading
Loading