Skip to content
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

Polish #5759

Merged
merged 1 commit into from
Jan 10, 2025
Merged

Polish #5759

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
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void countedWithSuccessfulMetrics() {

Counter counter = meterRegistry.get("metric.success")
.tag("method", "succeedWithMetrics")
.tag("class", getClass().getName() + "$CountedService")
.tag("class", CountedService.class.getName())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember exactly, but I think the reason I didn't do this before is because we moved this test to another module and it did not move cleanly with this. It was trying to reference the class from the other module or something. But it's already moved, so I guess there's no harm in making this change now.

.tag("extra", "tag")
.tag("result", "success")
.counter();
Expand Down Expand Up @@ -89,7 +89,7 @@ void countedWithFailure() {

Counter counter = meterRegistry.get("metric.failing")
.tag("method", "fail")
.tag("class", getClass().getName() + "$CountedService")
.tag("class", CountedService.class.getName())
.tag("exception", "RuntimeException")
.tag("result", "failure")
.counter();
Expand Down Expand Up @@ -129,7 +129,7 @@ void countedWithSuccessfulMetricsWhenCompleted() {

assertThat(meterRegistry.find("metric.success")
.tag("method", "succeedWithMetrics")
.tag("class", getClass().getName() + "$AsyncCountedService")
.tag("class", AsyncCountedService.class.getName())
.tag("extra", "tag")
.tag("exception", "none")
.tag("result", "success")
Expand All @@ -140,7 +140,7 @@ void countedWithSuccessfulMetricsWhenCompleted() {

Counter counterAfterCompletion = meterRegistry.get("metric.success")
.tag("method", "succeedWithMetrics")
.tag("class", getClass().getName() + "$AsyncCountedService")
.tag("class", AsyncCountedService.class.getName())
.tag("extra", "tag")
.tag("exception", "none")
.tag("result", "success")
Expand All @@ -157,7 +157,7 @@ void countedWithFailureWhenCompleted() {

assertThat(meterRegistry.find("metric.failing")
.tag("method", "fail")
.tag("class", getClass().getName() + "$AsyncCountedService")
.tag("class", AsyncCountedService.class.getName())
.tag("exception", "RuntimeException")
.tag("result", "failure")
.counter()).isNull();
Expand All @@ -167,7 +167,7 @@ void countedWithFailureWhenCompleted() {

Counter counter = meterRegistry.get("metric.failing")
.tag("method", "fail")
.tag("class", getClass().getName() + "$AsyncCountedService")
.tag("class", AsyncCountedService.class.getName())
.tag("exception", "RuntimeException")
.tag("result", "failure")
.counter();
Expand Down Expand Up @@ -218,7 +218,7 @@ void countedWithSuccessfulMetricsWhenReturnsCompletionStageNull() {

assertThat(meterRegistry.get("metric.success")
.tag("method", "successButNull")
.tag("class", getClass().getName() + "$AsyncCountedService")
.tag("class", AsyncCountedService.class.getName())
.tag("extra", "tag")
.tag("exception", "none")
.tag("result", "success")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void timeMethod() {
service.call();

assertThat(registry.get("call")
.tag("class", getClass().getName() + "$TimedService")
.tag("class", TimedService.class.getName())
.tag("method", "call")
.tag("extra", "tag")
.timer()
Expand Down Expand Up @@ -88,7 +88,7 @@ void timeMethodWithLongTaskTimer() {
service.longCall();

assertThat(registry.get("longCall")
.tag("class", getClass().getName() + "$TimedService")
.tag("class", TimedService.class.getName())
.tag("method", "longCall")
.tag("extra", "tag")
.longTaskTimers()).hasSize(1);
Expand Down Expand Up @@ -136,7 +136,7 @@ void timeMethodWithError() {
assertThatThrownBy(service::callRaisingError).isInstanceOf(TestError.class);

assertThat(registry.get("callRaisingError")
.tag("class", getClass().getName() + "$TimedService")
.tag("class", TimedService.class.getName())
.tag("method", "callRaisingError")
.tag("extra", "tag")
.tag("exception", "TestError")
Expand All @@ -158,7 +158,7 @@ void timeMethodWithErrorAndLongTaskTimer() {
assertThatThrownBy(service::longCallRaisingError).isInstanceOf(TestError.class);

assertThat(registry.get("longCallRaisingError")
.tag("class", getClass().getName() + "$TimedService")
.tag("class", TimedService.class.getName())
.tag("method", "longCallRaisingError")
.tag("extra", "tag")
.longTaskTimer()
Expand All @@ -183,7 +183,7 @@ void timeMethodWhenCompleted() {
completableFuture.join();

assertThat(registry.get("call")
.tag("class", getClass().getName() + "$AsyncTimedService")
.tag("class", AsyncTimedService.class.getName())
.tag("method", "call")
.tag("extra", "tag")
.tag("exception", "none")
Expand All @@ -209,7 +209,7 @@ void timeMethodWhenCompletedExceptionally() {
assertThatThrownBy(completableFuture::join).isInstanceOf(CompletionException.class);

assertThat(registry.get("call")
.tag("class", getClass().getName() + "$AsyncTimedService")
.tag("class", AsyncTimedService.class.getName())
.tag("method", "call")
.tag("extra", "tag")
.tag("exception", "IllegalStateException")
Expand All @@ -232,7 +232,7 @@ void timeMethodWhenReturnCompletionStageNull() {
assertThat(registry.getMeters()).isNotEmpty();

assertThat(registry.get("callNull")
.tag("class", getClass().getName() + "$AsyncTimedService")
.tag("class", AsyncTimedService.class.getName())
.tag("method", "callNull")
.tag("extra", "tag")
.tag("exception", "none")
Expand All @@ -253,7 +253,7 @@ void timeMethodWithLongTaskTimerWhenCompleted() {
CompletableFuture<?> completableFuture = service.longCall(guardedResult);

assertThat(registry.find("longCall")
.tag("class", getClass().getName() + "$AsyncTimedService")
.tag("class", AsyncTimedService.class.getName())
.tag("method", "longCall")
.tag("extra", "tag")
.longTaskTimer()
Expand All @@ -263,7 +263,7 @@ void timeMethodWithLongTaskTimerWhenCompleted() {
completableFuture.join();

assertThat(registry.get("longCall")
.tag("class", getClass().getName() + "$AsyncTimedService")
.tag("class", AsyncTimedService.class.getName())
.tag("method", "longCall")
.tag("extra", "tag")
.longTaskTimer()
Expand All @@ -283,7 +283,7 @@ void timeMethodWithLongTaskTimerWhenCompletedExceptionally() {
CompletableFuture<?> completableFuture = service.longCall(guardedResult);

assertThat(registry.find("longCall")
.tag("class", getClass().getName() + "$AsyncTimedService")
.tag("class", AsyncTimedService.class.getName())
.tag("method", "longCall")
.tag("extra", "tag")
.longTaskTimer()
Expand All @@ -293,7 +293,7 @@ void timeMethodWithLongTaskTimerWhenCompletedExceptionally() {
assertThatThrownBy(completableFuture::join).isInstanceOf(CompletionException.class);

assertThat(registry.get("longCall")
.tag("class", getClass().getName() + "$AsyncTimedService")
.tag("class", AsyncTimedService.class.getName())
.tag("method", "longCall")
.tag("extra", "tag")
.longTaskTimer()
Expand All @@ -313,13 +313,13 @@ void timeMethodWithLongTaskTimerWhenReturnCompletionStageNull() {
assertThat(completableFuture).isNull();

assertThat(registry.get("longCallNull")
.tag("class", getClass().getName() + "$AsyncTimedService")
.tag("class", AsyncTimedService.class.getName())
.tag("method", "longCallNull")
.tag("extra", "tag")
.longTaskTimers()).hasSize(1);

assertThat(registry.find("longCallNull")
.tag("class", getClass().getName() + "$AsyncTimedService")
.tag("class", AsyncTimedService.class.getName())
.tag("method", "longCallNull")
.tag("extra", "tag")
.longTaskTimer()
Expand Down
Loading