Skip to content

Commit

Permalink
Add meaningful .toString to DefaultOpenTelemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
iRevive committed May 31, 2023
1 parent aa1c7f0 commit 52cdc45
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ public MeterProvider getMeterProvider() {
public ContextPropagators getPropagators() {
return propagators;
}

@Override
public String toString() {
return "DefaultOpenTelemetry{" + "propagators=" + propagators + "}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ void getThenSet() {
.hasStackTraceContaining("getOpenTelemetry");
}

@Test
void toString_noop_Valid() {
assertThat(OpenTelemetry.noop().toString())
.isEqualTo(
"DefaultOpenTelemetry{"
+ "propagators=DefaultContextPropagators{textMapPropagator=NoopTextMapPropagator}"
+ "}");
}

private static void setOpenTelemetry() {
GlobalOpenTelemetry.set(OpenTelemetry.noop());
}
Expand Down

0 comments on commit 52cdc45

Please sign in to comment.