Skip to content
Draft
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 @@ -44,4 +44,9 @@ public SamplingIntent getSamplingIntent(
public String getDescription() {
return description;
}

@Override
public String toString() {
return getDescription();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ void testDescription() {
"ComposableAnnotatingSampler{ComposableAlwaysOnSampler,{http.route=\"/bear\", size=100}}");
}

@Test
void descriptionInComposedSampler() {
// The annotating sampler must override toString() so that samplers composing it (which build
// their description by concatenating the nested sampler) surface its real description instead
// of
// an Object hash.
String description =
ComposableSampler.parentThreshold(
ComposableSampler.annotating(ComposableSampler.alwaysOn(), Attributes.empty()))
.getDescription();
assertThat(description)
.isEqualTo(
"ComposableParentThresholdSampler{rootSampler=ComposableAnnotatingSampler{ComposableAlwaysOnSampler,{}}}");
assertThat(description).doesNotContain("@");
}

@Test
void setsAttributes() {
SamplingIntent intent =
Expand Down
Loading