Merge branch 'master' into 2.0.x
This commit is contained in:
@@ -66,7 +66,9 @@ abstract class AbstractTraceHttpRequestInterceptor {
|
||||
}
|
||||
|
||||
private String getName(URI uri) {
|
||||
return SpanNameUtil.shorten(uriScheme(uri) + ":" + uri.getPath());
|
||||
// The returned name should comply with RFC 882 - Section 3.1.2.
|
||||
// i.e Header values must composed of printable ASCII values.
|
||||
return SpanNameUtil.shorten(uriScheme(uri) + ":" + uri.getRawPath());
|
||||
}
|
||||
|
||||
private String uriScheme(URI uri) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
@@ -156,6 +157,23 @@ public class TraceRestTemplateInterceptorTests {
|
||||
then(this.testController.span).hasNameEqualTo("http:/");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createdSpanNameHasOnlyPrintableAsciiCharactersForNonEncodedURIWithNonAsciiChars() {
|
||||
this.tracer.continueSpan(Span.builder().traceId(1L).spanId(2L).exportable(false).build());
|
||||
|
||||
try {
|
||||
this.template.getForEntity("/cas~fs~划", Map.class).getBody();
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
String spanName = this.spanAccumulator.getSpans().get(0).getName();
|
||||
then(this.spanAccumulator.getSpans().get(0).getName()).isEqualTo("http:/cas~fs~%C3%A5%CB%86%E2%80%99");
|
||||
then(StringUtils.isAsciiPrintable(spanName));
|
||||
then(ExceptionUtils.getLastException()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void willShortenTheNameOfTheSpan() {
|
||||
this.tracer.continueSpan(Span.builder().traceId(1L).spanId(2L).exportable(false).build());
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.9.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
Reference in New Issue
Block a user