Skip to content

Commit 9a5dd30

Browse files
committed
add coverage check
Signed-off-by: Gregor Zeitlinger <[email protected]>
1 parent cdf4dcf commit 9a5dd30

File tree

10 files changed

+36
-16
lines changed

10 files changed

+36
-16
lines changed

checkstyle-suppressions.xml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,20 @@
55
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
66

77
<suppressions>
8-
<suppress checks="Javadoc" files="."/>
8+
<!-- Suppress Javadoc paragraph formatting (empty line before <p> tag) globally. This is a
9+
stylistic check that would require fixing hundreds of locations. We still enforce that
10+
public APIs have documentation via other Javadoc checks. -->
11+
<suppress checks="JavadocParagraph" files="."/>
12+
13+
<!-- Suppress all Javadoc checks for internal implementation packages -->
14+
<suppress checks="Javadoc" files=".*[/\\]internal[/\\].*"/>
15+
16+
<!-- Suppress all Javadoc checks for example code -->
17+
<suppress checks="Javadoc" files=".*[/\\]examples[/\\].*"/>
18+
19+
<!-- Suppress all Javadoc checks for benchmark code -->
20+
<suppress checks="Javadoc" files=".*[/\\]benchmarks[/\\].*"/>
21+
22+
<!-- Suppress all Javadoc checks for integration tests -->
23+
<suppress checks="Javadoc" files=".*[/\\]integration-tests[/\\].*"/>
924
</suppressions>

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,11 @@
264264
<value>COVEREDRATIO</value>
265265
<minimum>${jacoco.line-coverage}</minimum>
266266
</limit>
267+
<limit>
268+
<counter>BRANCH</counter>
269+
<value>COVEREDRATIO</value>
270+
<minimum>0.50</minimum>
271+
</limit>
267272
</limits>
268273
</rule>
269274
</rules>

prometheus-metrics-exporter-httpserver/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<properties>
2121
<automatic.module.name>io.prometheus.metrics.exporter.httpserver</automatic.module.name>
22-
<jacoco.line-coverage>0.45</jacoco.line-coverage>
22+
<jacoco.line-coverage>0.60</jacoco.line-coverage>
2323
</properties>
2424

2525
<dependencies>

prometheus-metrics-exposition-textformats/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<properties>
2121
<automatic.module.name>io.prometheus.writer.text</automatic.module.name>
22-
<jacoco.line-coverage>0.50</jacoco.line-coverage>
22+
<jacoco.line-coverage>0.60</jacoco.line-coverage>
2323
</properties>
2424

2525
<dependencies>

prometheus-metrics-instrumentation-dropwizard5/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<properties>
2121
<automatic.module.name>io.prometheus.metrics.instrumentation.dropwizard5</automatic.module.name>
22-
<jacoco.line-coverage>0.50</jacoco.line-coverage>
22+
<jacoco.line-coverage>0.60</jacoco.line-coverage>
2323
</properties>
2424

2525
<dependencies>

prometheus-metrics-instrumentation-jvm/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<properties>
2121
<automatic.module.name>io.prometheus.metrics.instrumentation.jvm</automatic.module.name>
22-
<jacoco.line-coverage>0.55</jacoco.line-coverage>
22+
<jacoco.line-coverage>0.60</jacoco.line-coverage>
2323
</properties>
2424

2525
<dependencies>

prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/Collector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ default MetricSnapshot collect(
6565
* and the metric name is excluded.
6666
* </ol>
6767
*
68-
* Returning {@code null} means checks are omitted (registration the metric always succeeds), and
69-
* the collector is always scraped (the result is dropped after scraping if a name filter is
68+
* <p>Returning {@code null} means checks are omitted (registration the metric always succeeds),
69+
* and the collector is always scraped (the result is dropped after scraping if a name filter is
7070
* present and the metric name is excluded).
7171
*
7272
* <p>If your metric has a name that does not change at runtime it is a good idea to overwrite

prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/MultiCollector.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ default MetricSnapshots collect(
6060
* and all names are excluded.
6161
* </ol>
6262
*
63-
* Returning an empty list means checks are omitted (registration metric always succeeds), and the
64-
* collector is always scraped (if a name filter is present and all names are excluded the result
65-
* is dropped).
63+
* <p>Returning an empty list means checks are omitted (registration metric always succeeds), and
64+
* the collector is always scraped (if a name filter is present and all names are excluded the
65+
* result is dropped).
6666
*
6767
* <p>If your collector returns a constant list of metrics that have names that do not change at
6868
* runtime it is a good idea to overwrite this and return the names.

prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/PrometheusNaming.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class PrometheusNaming {
2727
* <li>OpenTelemetry: {@code process_runtime_jvm_buffer_count}
2828
* </ul>
2929
*
30-
* We do not treat {@code _count} and {@code _sum} as reserved suffixes here for compatibility
30+
* <p>We do not treat {@code _count} and {@code _sum} as reserved suffixes here for compatibility
3131
* with these libraries. However, there is a risk of name conflict if someone creates a gauge
3232
* named {@code my_data_count} and a histogram or summary named {@code my_data}, because the
3333
* histogram or summary will implicitly have a sample named {@code my_data_count}.
@@ -47,9 +47,9 @@ public class PrometheusNaming {
4747
* <li>The name MUST NOT end with one of the {@link #RESERVED_METRIC_NAME_SUFFIXES}.
4848
* </ul>
4949
*
50-
* If a metric has a {@link Unit}, the metric name SHOULD end with the unit as a suffix. Note that
51-
* <a href="https://openmetrics.io/">OpenMetrics</a> requires metric names to have their unit as
52-
* suffix, and we implement this in {@code prometheus-metrics-core}. However, {@code
50+
* <p>If a metric has a {@link Unit}, the metric name SHOULD end with the unit as a suffix. Note
51+
* that <a href="https://openmetrics.io/">OpenMetrics</a> requires metric names to have their unit
52+
* as suffix, and we implement this in {@code prometheus-metrics-core}. However, {@code
5353
* prometheus-metrics-model} does not enforce Unit suffixes.
5454
*
5555
* <p>Example: If you create a Counter for a processing time with Unit {@link Unit#SECONDS

prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/Unit.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
* new Unit("myUnit");
1010
* </pre>
1111
*
12-
* Note that in Prometheus, units are largely based on SI base units (seconds, bytes, joules, grams,
13-
* meters, ratio, volts, amperes, and Celsius).
12+
* <p>Note that in Prometheus, units are largely based on SI base units (seconds, bytes, joules,
13+
* grams, meters, ratio, volts, amperes, and Celsius).
1414
*/
1515
public final class Unit {
1616

0 commit comments

Comments
 (0)