Skip to content

Commit 0d30476

Browse files
committed
Remove support for GLEAN_TEST_COVERAGE
1 parent 43c3ed8 commit 0d30476

File tree

23 files changed

+20
-146
lines changed

23 files changed

+20
-146
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

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

5+
* General
6+
* Remove support for generating metric testing coverage ([#3397](https://github.com/mozilla/glean/pull/3397))
7+
58
# v67.0.0 (2026-01-21)
69

710
[Full changelog](https://github.com/mozilla/glean/compare/v66.3.0...v67.0.0)

docs/dev/code_coverage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
> which suggests it has a lower chance of containing undetected software bugs compared to a program with low test coverage.
66
> ([Wikipedia](https://en.wikipedia.org/wiki/Code_coverage))
77
8-
This chapter describes how to generate a traditional code coverage report over the Kotlin, Swift and Python code in the Glean SDK repository. To learn how to generate a coverage report about what metrics your project is testing, see the user documentation on [generating testing coverage reports](https://mozilla.github.io/glean/book/user/testing-metrics.html#generating-testing-coverage-reports).
8+
This chapter describes how to generate a traditional code coverage report over the Kotlin, Swift and Python code in the Glean SDK repository.
99

1010
## Generating Kotlin reports locally
1111

docs/user/user/metrics/testing-metrics.md

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ in any client application it may be used in.
77
These functions expose a way to inspect and validate recorded metric values within the client application. but are restricted to test code only.
88
(Outside of a testing context, Glean APIs are otherwise write-only so that it can enforce semantics and constraints about data).
99

10-
To encourage using the testing APIs, it is also possible to [generate testing coverage reports](#generating-testing-coverage-reports) to show which metrics in your project are tested.
11-
1210
## Example of using the test API
1311

1412
In order to enable metrics testing APIs in each SDK, Glean must be reset and put in testing mode.
@@ -84,53 +82,3 @@ assert 1 == metrics.url.visit.test_get_value()
8482
</div>
8583

8684
{{#include ../../../shared/tab_footer.md}}
87-
88-
## Generating testing coverage reports
89-
90-
Glean can generate coverage reports to track which metrics are tested in your unit test suite.
91-
92-
There are three steps to integrate it into your continuous integration workflow: recording coverage, post-processing the results, and uploading the results.
93-
94-
### Recording coverage
95-
96-
Glean testing coverage is enabled by setting the `GLEAN_TEST_COVERAGE` environment variable to the name of a file to store results.
97-
It is good practice to set it to the absolute path to a file, since some testing harnesses (such as `cargo test`) may change the current working directory.
98-
99-
```bash
100-
GLEAN_TEST_COVERAGE=$(realpath glean_coverage.txt) make test
101-
```
102-
103-
### Post-processing the results
104-
105-
A post-processing step is required to convert the raw output in the file specified by `GLEAN_TEST_COVERAGE` into usable output for coverage reporting tools. Currently, the only coverage reporting tool supported is [codecov.io](https://codecov.io).
106-
107-
This post-processor is available in the `coverage` subcommand in the [`glean_parser`](https://github.com/mozilla/glean_parser) tool.
108-
109-
For some build systems, `glean_parser` is already installed for you by the build system integration at the following locations:
110-
111-
- On Android/Gradle, `$GRADLE_HOME/glean/bootstrap-4.5.11/Miniconda3/bin/glean_parser`
112-
- On iOS, `$PROJECT_ROOT/.venv/bin/glean_parser`
113-
- For other systems, install `glean_parser` using `pip install glean_parser`
114-
115-
The `glean_parser coverage` command requires the following parameters:
116-
117-
- `-f`: The output format to produce, for example `codecovio` to produce [codecov.io](https://codecov.io)'s custom format.
118-
- `-o`: The path to the output file, for example `codecov.json`.
119-
- `-c`: The input raw coverage file. `glean_coverage.txt` in the example above.
120-
- A list of the `metrics.yaml` files in your repository.
121-
122-
For example, to produce output for [codecov.io](https://codecov.io):
123-
124-
```bash
125-
glean_parser coverage -f codecovio -o glean_coverage.json -c glean_coverage.txt app/metrics.yaml
126-
```
127-
128-
In this example, the `glean_coverage.json` file is now ready for uploading to codecov.io.
129-
130-
### Uploading coverage
131-
132-
If using `codecov.io`, the uploader doesn't send coverage results for YAML files by default. Pass the `-X yaml` option to the uploader to make sure they are included:
133-
134-
```bash
135-
bash <(curl -s https://codecov.io/bash) -X yaml
136-
```

glean-core/src/coverage.rs

Lines changed: 0 additions & 47 deletions
This file was deleted.

glean-core/src/event_database/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use serde::{Deserialize, Serialize};
2121
use serde_json::{json, Value as JsonValue};
2222

2323
use crate::common_metric_data::CommonMetricDataInternal;
24-
use crate::coverage::record_coverage;
2524
use crate::error_recording::{record_error, ErrorType};
2625
use crate::metrics::{DatetimeMetric, TimeUnit};
2726
use crate::storage::INTERNAL_STORAGE;
@@ -684,8 +683,6 @@ impl EventDatabase {
684683
meta: &'a CommonMetricDataInternal,
685684
store_name: &str,
686685
) -> Option<Vec<RecordedEvent>> {
687-
record_coverage(&meta.base_identifier());
688-
689686
let value: Vec<RecordedEvent> = self
690687
.event_stores
691688
.read()

glean-core/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ use metrics::RemoteSettingsConfig;
3535
mod common_metric_data;
3636
mod core;
3737
mod core_metrics;
38-
mod coverage;
3938
mod database;
4039
mod debug;
4140
#[cfg(feature = "benchmark")]

glean-core/src/metrics/boolean.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl BooleanMetric {
8989
pub fn get_value(&self, glean: &Glean, ping_name: Option<&str>) -> Option<bool> {
9090
let queried_ping_name = ping_name.unwrap_or_else(|| &self.meta().inner.send_in_pings[0]);
9191

92-
match StorageManager.snapshot_metric_for_test(
92+
match StorageManager.snapshot_metric(
9393
glean.storage(),
9494
queried_ping_name,
9595
&self.meta.identifier(glean),

glean-core/src/metrics/counter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl CounterMetric {
126126
.into()
127127
.unwrap_or_else(|| &self.meta().inner.send_in_pings[0]);
128128

129-
match StorageManager.snapshot_metric_for_test(
129+
match StorageManager.snapshot_metric(
130130
glean.storage(),
131131
queried_ping_name,
132132
&self.meta.identifier(glean),

glean-core/src/metrics/custom_distribution.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl CustomDistributionMetric {
218218
.into()
219219
.unwrap_or_else(|| &self.meta().inner.send_in_pings[0]);
220220

221-
match StorageManager.snapshot_metric_for_test(
221+
match StorageManager.snapshot_metric(
222222
glean.storage(),
223223
queried_ping_name,
224224
&self.meta.identifier(glean),

glean-core/src/metrics/denominator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl DenominatorMetric {
9696
.into()
9797
.unwrap_or_else(|| &self.meta().inner.send_in_pings[0]);
9898

99-
match StorageManager.snapshot_metric_for_test(
99+
match StorageManager.snapshot_metric(
100100
glean.storage(),
101101
queried_ping_name,
102102
&self.meta().identifier(glean),

0 commit comments

Comments
 (0)