Parameterized the path key (OTel uses http.route)

This commit is contained in:
Marcin Grzejszczak
2021-03-09 08:50:21 +01:00
parent a9f8efed73
commit 3d8012fc56

View File

@@ -146,18 +146,21 @@ public abstract class WebClientTests {
then(this.spans).isNotEmpty();
Optional<FinishedSpan> noTraceSpan = this.spans.reportedSpans().stream()
.filter(span -> span.getName().contains("GET") && !span.getTags().isEmpty()
&& span.getTags().containsKey("http.path"))
&& span.getTags().containsKey(pathKey()))
.findFirst();
then(noTraceSpan.isPresent()).isTrue();
then(noTraceSpan.get().getTags()).containsEntry("http.path", "/notrace").containsEntry("http.method",
"GET");
then(noTraceSpan.get().getTags()).containsEntry(pathKey(), "/notrace").containsEntry("http.method", "GET");
// TODO: matches cause there is an issue with Feign not providing the full URL
// at the interceptor level
then(noTraceSpan.get().getTags().get("http.path")).matches(".*/notrace");
then(noTraceSpan.get().getTags().get(pathKey())).matches(".*/notrace");
});
thenThereIsNoCurrentSpan();
}
protected String pathKey() {
return "http.path";
}
private void thenThereIsNoCurrentSpan() {
log.info("Current span [" + this.tracer.currentSpan() + "]");
then(this.tracer.currentSpan()).isNull();