Skip to content

baseline metrics in CircuitBreakerTelemetryTest #655

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

Merged
merged 2 commits into from
Mar 10, 2025

Conversation

Ladicek
Copy link
Contributor

@Ladicek Ladicek commented Mar 5, 2025

The call to baselineMetrics() after creating the TelemetryMetricGetter was missing in this test. Funnily enough, the MP Metrics counterpart of this test (CircuitBreakerMetricTest) baselines metrics correctly.

Fixes #656

The call to `baselineMetrics()` after creating the `TelemetryMetricGetter`
was missing in this test. Funnily enough, the MP Metrics counterpart of this
test (`CircuitBreakerMetricTest`) baselines metrics correctly.
@eclipse-microprofile-bot
Copy link
Contributor

Can one of the admins verify this patch?

Ladicek added a commit to Ladicek/quarkus that referenced this pull request Mar 5, 2025
@Azquelt
Copy link
Member

Azquelt commented Mar 6, 2025

@eclipse-microprofile-bot test this please

Ladicek added a commit to Ladicek/quarkus that referenced this pull request Mar 7, 2025
This requires propagating the "metrics enabled at build time" information
through the `OpenTelemetrySdkBuildItem`. I took the liberty to also add
the tracing and logging build time enablement information, even though
I have no use for it at the moment.

One TCK test remains excluded, because it has a bug [1][2].

[1] microprofile/microprofile-fault-tolerance#656
[2] microprofile/microprofile-fault-tolerance#655
There is not a lot of places in the MicroProfile Fault Tolerance TCK
that require executing some logic before each `@Test` method, but
all of them use `@BeforeMethod`. The only exception is
`CircuitBreakerMetricTest` and `CircuitBreakerTelemetryTest`, which
use `@BeforeTest`. However, `@BeforeTest` in TestNG is nothing like
`@BeforeTest` in JUnit -- in TestNG, it means before the `<test>`
tag in `testng.xml`.

This commit replaces the usage of `@BeforeTest` with `@BeforeMethod`.
If the method was supposed to be called once before the test class,
the proper annotation would be `@BeforeClass`, but this test class
has exactly one `@Test` method, so it doesn't matter. If it had
multiple, `@BeforeMethod` would actually be more appropriate, because
it brings the circuit breaker into the initial (closed) state,
regardless of the state it is currently in.
@Ladicek
Copy link
Contributor Author

Ladicek commented Mar 7, 2025

Added an extra commit that replaces @BeforeTest with @BeforeMethod, which I feel is a lot more appropriate (after, once again, reading upon the difference).

@Azquelt
Copy link
Member

Azquelt commented Mar 7, 2025

Thanks, I think this makes sense. I agree the cleanup in this method probably isn't necessary since the test class only has one test method, but the current behaviour (where the @BeforeTest method seems to run for you but doesn't run for me on Open Liberty) is somewhat disconcerting so I think it makes sense to change it to @BeforeMethod (which was the intended behaviour all along).

@Azquelt
Copy link
Member

Azquelt commented Mar 7, 2025

I'll merge this on Monday unless any objections are raised and then we can do a service release.

@Azquelt Azquelt merged commit a3842af into microprofile:main Mar 10, 2025
2 checks passed
@Ladicek Ladicek deleted the fix-cb-telemetry-test branch March 10, 2025 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TCK Challenge: CircuitBreakerTelemetryTest may fail because metrics are not baselined correctly
5 participants