-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce Prometheus Java Client integration test #1468
base: master
Are you sure you want to change the base?
Conversation
3cfe7b9
to
90a8bdd
Compare
Looks good. No mutations were possible for these changes. |
2 similar comments
Looks good. No mutations were possible for these changes. |
Looks good. No mutations were possible for these changes. |
The IT is successful! |
Looks good. No mutations were possible for these changes. |
|
||
class PrometheusInstrumentationScopeTest { | ||
|
||
+ // XXX: Introduce support for rewriting `assertThatThrownBy#havingRootCause()`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed: #1471
3421c71
to
b4c5bed
Compare
Looks good. No mutations were possible for these changes. |
Looks good. No mutations were possible for these changes. |
b4c5bed
to
75534db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebased and added a commit. One point of attention: there appears to be a flaky test:
[ERROR] io.prometheus.metrics.core.metrics.SlidingWindowTest.rotate -- Time elapsed: 0.023 s <<< FAILURE!
org.opentest4j.AssertionFailedError:
[Start time: 1734782202868, current time: 1734782232878, elapsed time: 30010]
expected: [1.0, 1.0, 1.0, 1.0, 1.0]
but was: [1.0, 1.0, 1.0, 1.0]
at io.prometheus.metrics.core.metrics.SlidingWindowTest$Observer.assertValues(SlidingWindowTest.java:30)
at io.prometheus.metrics.core.metrics.SlidingWindowTest.rotate(SlidingWindowTest.java:57)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
@mohamedsamehsalah if you review #1471 then we can strike one precondition off the list :)
# XXX: Minimize the diff by including | ||
# `-XepOpt:Slf4jLoggerDeclaration:CanonicalStaticLoggerName=logger` once such | ||
# flags are supported in patch mode. See | ||
# https://github.com/google/error-prone/pull/4699. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment doesn't apply here 👀
<junit-jupiter.version>5.11.3</junit-jupiter.version> | ||
<otel.instrumentation.version>2.10.0-alpha</otel.instrumentation.version> | ||
- <java.version>8</java.version> | ||
+ <java.version>11</java.version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can specify this using additional_build_flags='-Djava.version=11'
instead, keeping the patch minimal.
<showWarnings>true</showWarnings> | ||
<compilerArgs> | ||
<arg>-Xlint:all,-serial,-processing,-options</arg> | ||
- <arg>${warnings}</arg> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can instead set -Dwarnings=
, keeping the patch minimal.
--- a/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/MetricNameFilter.java | ||
+++ b/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/MetricNameFilter.java | ||
@@ -8,6 +8,8 @@ import java.util.Collection; | ||
import java.util.function.Predicate; | ||
|
||
/** Filter samples (i.e. time series) by name. */ | ||
+// XXX: Don't suggest changes when there are local methods with the same name. | ||
+@SuppressWarnings("ExplicitArgumentEnumeration") | ||
public class MetricNameFilter implements Predicate<String> { | ||
|
||
/** For convenience, a filter that allows all names. */ | ||
--- a/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/Quantiles.java | ||
+++ b/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/Quantiles.java | ||
@@ -41,6 +41,8 @@ public class Quantiles implements Iterable<Quantile> { | ||
* Create a new Quantiles instance. You can either create Quantiles with one of the static {@code | ||
* Quantiles.of(...)} methods, or you can use the {@link Quantiles#builder()}. | ||
*/ | ||
+ // XXX: Don't suggest changes when there are local methods with the same name. | ||
+ @SuppressWarnings("ExplicitArgumentEnumeration") | ||
public static Quantiles of(Quantile... quantiles) { | ||
return of(Arrays.asList(quantiles)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline, we should try to fix ExplicitArgumentEnumeration
so that thee suppressions aren't necessary. (I may have time for this ~tomorrow.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may have time for this ~tomorrow
If not, I'll try to make time for it on Monday! Today won't work for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I filed #1475 and rebased this PR to exclude these suppressions from the patch file.
--- a/prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/MetricSnapshotTest.java | ||
+++ b/prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/MetricSnapshotTest.java | ||
@@ -7,6 +7,8 @@ import org.junit.jupiter.api.Test; | ||
|
||
class MetricSnapshotTest { | ||
|
||
+ // XXX: Investigate the `satisfies` and how to rewrite this. | ||
+ @SuppressWarnings("AssertThatThrownBy") | ||
@Test | ||
public void testDuplicateLabels() { | ||
assertThatExceptionOfType(DuplicateLabelsException.class) | ||
--- a/prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/PrometheusNamingTest.java | ||
+++ b/prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/PrometheusNamingTest.java | ||
@@ -6,6 +6,8 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
+// XXX: Fix this edge case in the `JUnitMethodDeclaration` check. | ||
+@SuppressWarnings("JUnitMethodDeclaration") | ||
class PrometheusNamingTest { | ||
|
||
@Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should either fix these cases or formulate better XXX
comments. (Can have a look ~tomorrow.)
Looks good. No mutations were possible for these changes. |
75534db
to
e8ff396
Compare
Found a few flaky test issues on their GitHub about the same class as what you noticed: prometheus/client_java#956, prometheus/client_java#946. I also experienced the issue on my local machine. Maybe for now we should report and exclude the specific case via |
Looks good. No mutations were possible for these changes. |
1 similar comment
Looks good. No mutations were possible for these changes. |
Yeah, agree. I filed prometheus/client_java#1242 and will reference that issue in an accompanying comment. |
61ccda6
to
a8d83fb
Compare
Looks good. No mutations were possible for these changes. |
And disable flaky test.
77ddee5
to
758bf21
Compare
Looks good. No mutations were possible for these changes. |
Looks good. No mutations were possible for these changes. |
Added a commit to document some possible follow-up work. Open points:
|
Looks good. No mutations were possible for these changes. |
Looks good. No mutations were possible for these changes. |
Looks good. No mutations were possible for these changes. |
Looks good. No mutations were possible for these changes. |
Quality Gate passedIssues Measures |
There are some XXX's left to resolve, but apart from those, I think the PR is ready to be reviewed!
For those XXX's I'll still work on creating a PR for them.