Skip to content
Merged
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 @@ -106,7 +106,6 @@ protected void configure(HttpClientTestOptions.Builder optionsBuilder) {
optionsBuilder.setExpectedClientSpanNameMapper(
(uri, method) -> method + " " + getTemplate(uri));
optionsBuilder.setExpectedUrlTemplateMapper(SpringRestTemplateTest::getTemplate);
optionsBuilder.setHasUrlTemplate(true);
}

private static String getTemplate(URI uri) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1134,11 +1134,10 @@ protected SpanDataAssert assertClientSpan(
if (httpClientAttributes.contains(UrlAttributes.URL_FULL)) {
assertThat(attrs).containsEntry(UrlAttributes.URL_FULL, uri.toString());
}
if (options.getHasUrlTemplate()) {
String expectedUrlTemplate = options.getExpectedUrlTemplateMapper().apply(uri);
if (expectedUrlTemplate != null) {
assertThat(attrs)
.containsEntry(
UrlIncubatingAttributes.URL_TEMPLATE,
options.getExpectedUrlTemplateMapper().apply(uri));
.containsEntry(UrlIncubatingAttributes.URL_TEMPLATE, expectedUrlTemplate);
}
if (httpClientAttributes.contains(HttpAttributes.HTTP_REQUEST_METHOD)) {
assertThat(attrs).containsEntry(HttpAttributes.HTTP_REQUEST_METHOD, method);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public abstract class HttpClientTestOptions {
public static final BiFunction<URI, String, String> DEFAULT_EXPECTED_CLIENT_SPAN_NAME_MAPPER =
(uri, method) -> HttpConstants._OTHER.equals(method) ? "HTTP" : method;

public static final Function<URI, String> DEFAULT_EXPECTED_URL_TEMPLATE_MAPPER = URI::getPath;
public static final Function<URI, String> DEFAULT_EXPECTED_URL_TEMPLATE_MAPPER = uri -> null;

public static final int FOUND_STATUS_CODE = HttpStatus.FOUND.code();

Expand Down Expand Up @@ -99,8 +99,6 @@ public boolean isLowLevelInstrumentation() {

public abstract Function<URI, String> getHttpProtocolVersion();

public abstract boolean getHasUrlTemplate();

public abstract boolean getTestPeerService();

public abstract Function<URI, String> getExpectedPeerServiceName();
Expand Down Expand Up @@ -148,7 +146,6 @@ default Builder withDefaults() {
.setTestNonStandardHttpMethod(true)
.setTestCaptureHttpHeaders(true)
.setHasSendRequest(true)
.setHasUrlTemplate(false)
.setTestPeerService(true)
.setExpectedPeerServiceName(uri -> "test-peer-service")
.setHttpProtocolVersion(uri -> "1.1");
Expand Down Expand Up @@ -200,8 +197,6 @@ default Builder withDefaults() {

Builder setHasSendRequest(boolean value);

Builder setHasUrlTemplate(boolean value);

Builder setTestPeerService(boolean value);

Builder setExpectedPeerServiceName(Function<URI, String> value);
Expand Down Expand Up @@ -283,11 +278,6 @@ default Builder spanEndsAfterBody() {
return setSpanEndsAfterType(SpanEndsAfterType.BODY);
}

@CanIgnoreReturnValue
default Builder enableUrlTemplate() {
return setHasUrlTemplate(true);
}

HttpClientTestOptions build();
}

Expand Down
Loading