Skip to content

Commit 205b51b

Browse files
committed
add toString for the baggage processor
1 parent 945c4c0 commit 205b51b

4 files changed

Lines changed: 18 additions & 2 deletions

File tree

baggage-processor/src/main/java/io/opentelemetry/contrib/baggage/processor/BaggageLogRecordProcessor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,9 @@ public void onEmit(Context context, ReadWriteLogRecord logRecord) {
4646
}
4747
});
4848
}
49+
50+
@Override
51+
public String toString() {
52+
return "BaggageLogRecordProcessor{" + "baggageKeyPredicate=" + baggageKeyPredicate + '}';
53+
}
4954
}

baggage-processor/src/main/java/io/opentelemetry/contrib/baggage/processor/BaggageSpanProcessor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,9 @@ public void onEnd(ReadableSpan span) {}
5858
public boolean isEndRequired() {
5959
return false;
6060
}
61+
62+
@Override
63+
public String toString() {
64+
return "BaggageSpanProcessor{" + "baggageKeyPredicate=" + baggageKeyPredicate + '}';
65+
}
6166
}

baggage-processor/src/test/java/io/opentelemetry/contrib/baggage/processor/BaggageLogRecordComponentProviderTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ void declarativeConfig() {
3030
new ByteArrayInputStream(yaml.getBytes(StandardCharsets.UTF_8)))
3131
.getSdk();
3232

33-
assertThat(sdk).asString().contains("BaggageLogRecordProcessor");
33+
assertThat(sdk)
34+
.asString()
35+
.contains("BaggageLogRecordProcessor")
36+
.containsPattern("IncludeExcludePredicate.*, included=\\[foo], excluded=\\[bar]");
3437
}
3538
}

baggage-processor/src/test/java/io/opentelemetry/contrib/baggage/processor/BaggageSpanComponentProviderTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ void declarativeConfig() {
3030
new ByteArrayInputStream(yaml.getBytes(StandardCharsets.UTF_8)))
3131
.getSdk();
3232

33-
assertThat(sdk).asString().contains("BaggageSpanProcessor");
33+
assertThat(sdk)
34+
.asString()
35+
.contains("BaggageSpanProcessor")
36+
.containsPattern("IncludeExcludePredicate.*, included=\\[foo], excluded=\\[bar]");
3437
}
3538
}

0 commit comments

Comments
 (0)