Merge pull request #129 from spring-cloud/dots
Changes http key delimiter to dot and adds size keys
This commit is contained in:
@@ -94,13 +94,13 @@ public class TraceKeys {
|
||||
* The domain portion of the URL or host header. Example:
|
||||
* "mybucket.s3.amazonaws.com". Used to filter by host as opposed to ip address.
|
||||
*/
|
||||
private String host = "http/host";
|
||||
private String host = "http.host";
|
||||
|
||||
/**
|
||||
* The HTTP method, or verb, such as "GET" or "POST". Used to filter against an
|
||||
* http route.
|
||||
*/
|
||||
private String method = "http/method";
|
||||
private String method = "http.method";
|
||||
|
||||
/**
|
||||
* The absolute http path, without any query parameters. Example:
|
||||
@@ -115,29 +115,43 @@ public class TraceKeys {
|
||||
* "/resource/abcd-ff". Historical note: This was commonly expressed as "http.uri"
|
||||
* in zipkin, eventhough it was most often just a path.
|
||||
*/
|
||||
private String path = "http/path";
|
||||
private String path = "http.path";
|
||||
|
||||
/**
|
||||
* The entire URL, including the scheme, host and query parameters if available.
|
||||
* Ex.
|
||||
* "https://mybucket.s3.amazonaws.com/objects/abcd-ff?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Algorithm=AWS4-HMAC-SHA256..."
|
||||
* Combined with {@link #HTTP_METHOD}, you can understand the fully-qualified
|
||||
* Combined with {@link #method}, you can understand the fully-qualified
|
||||
* request line. This is optional as it may include private data or be of
|
||||
* considerable length.
|
||||
*/
|
||||
private String url = "http/url";
|
||||
private String url = "http.url";
|
||||
|
||||
/**
|
||||
* The HTTP response code, when not in 2xx range. Ex. "503" Used to filter for
|
||||
* error status. 2xx range are not logged as success codes are less interesting
|
||||
* for latency troubleshooting. Omitting saves at least 20 bytes per span.
|
||||
*/
|
||||
private String statusCode = "http/status_code";
|
||||
private String statusCode = "http.status_code";
|
||||
|
||||
/**
|
||||
* The size of the non-empty HTTP request body, in bytes. Ex. "16384"
|
||||
*
|
||||
* <p>Large uploads can exceed limits or contribute directly to latency.
|
||||
*/
|
||||
private String requestSize = "http.request.size";
|
||||
|
||||
/**
|
||||
* The size of the non-empty HTTP response body, in bytes. Ex. "16384"
|
||||
*
|
||||
* <p>Large downloads can exceed limits or contribute directly to latency.
|
||||
*/
|
||||
private String responseSize = "http.response.size";
|
||||
|
||||
/**
|
||||
* Prefix for header names if they are added as tags.
|
||||
*/
|
||||
private String prefix = "http/";
|
||||
private String prefix = "http.";
|
||||
|
||||
/**
|
||||
* Additional headers that should be added as tags if they exist. If the header
|
||||
|
||||
@@ -147,7 +147,7 @@ public class TraceFilterTests {
|
||||
this.request.addHeader("X-Foo", "bar");
|
||||
filter.doFilter(this.request, this.response, this.filterChain);
|
||||
|
||||
assertThat(this.span.tags()).contains(entry("http/x-foo", "bar"));
|
||||
assertThat(this.span.tags()).contains(entry("http.x-foo", "bar"));
|
||||
|
||||
assertNull(SpanContextHolder.getCurrentSpan());
|
||||
}
|
||||
@@ -163,7 +163,7 @@ public class TraceFilterTests {
|
||||
this.request.addHeader("X-Foo", "spam");
|
||||
filter.doFilter(this.request, this.response, this.filterChain);
|
||||
|
||||
assertThat(this.span.tags()).contains(entry("http/x-foo", "'bar','spam'"));
|
||||
assertThat(this.span.tags()).contains(entry("http.x-foo", "'bar','spam'"));
|
||||
|
||||
assertNull(SpanContextHolder.getCurrentSpan());
|
||||
}
|
||||
@@ -199,17 +199,17 @@ public class TraceFilterTests {
|
||||
* org.springframework.cloud.sleuth.instrument.TraceKeys}.
|
||||
*/
|
||||
public void verifyHttpTags(HttpStatus status) {
|
||||
assertThat(this.span.tags()).contains(entry("http/host", "localhost"),
|
||||
entry("http/url", "http://localhost/?foo=bar"), entry("http/path", "/"),
|
||||
entry("http/method", "GET"));
|
||||
assertThat(this.span.tags()).contains(entry("http.host", "localhost"),
|
||||
entry("http.url", "http://localhost/?foo=bar"), entry("http.path", "/"),
|
||||
entry("http.method", "GET"));
|
||||
|
||||
// Status is only interesting in non-success case. Omitting it saves at least
|
||||
// 20bytes per span.
|
||||
if (status.is2xxSuccessful()) {
|
||||
assertThat(this.span.tags()).doesNotContainKey("http/status_code");
|
||||
assertThat(this.span.tags()).doesNotContainKey("http.status_code");
|
||||
}
|
||||
else {
|
||||
assertThat(this.span.tags()).containsEntry("http/status_code",
|
||||
assertThat(this.span.tags()).containsEntry("http.status_code",
|
||||
status.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ZipkinMessageListenerTests {
|
||||
@Test
|
||||
public void convertsTimestampAndDurationToMicroseconds() {
|
||||
long start = System.currentTimeMillis();
|
||||
this.span.log("http/request/retry"); // System.currentTimeMillis
|
||||
this.span.log("hystrix/retry"); // System.currentTimeMillis
|
||||
|
||||
zipkin.Span result = ZipkinMessageListener.convert(this.span, this.host);
|
||||
|
||||
@@ -52,7 +52,7 @@ public class ZipkinMessageListenerTests {
|
||||
/** Sleuth host corresponds to annotation/binaryAnnotation.host in zipkin. */
|
||||
@Test
|
||||
public void annotationsIncludeHost() {
|
||||
this.span.log("http/request/retry");
|
||||
this.span.log("hystrix/retry");
|
||||
this.span.tag("spring-boot/version", "1.3.1.RELEASE");
|
||||
|
||||
zipkin.Span result = ZipkinMessageListener.convert(this.span, this.host);
|
||||
|
||||
@@ -75,7 +75,7 @@ public class ZipkinSpanListenerTests {
|
||||
@Test
|
||||
public void convertsTimestampAndDurationToMicroseconds() {
|
||||
long start = System.currentTimeMillis();
|
||||
this.parent.log("http/request/retry"); // System.currentTimeMillis
|
||||
this.parent.log("hystrix/retry"); // System.currentTimeMillis
|
||||
|
||||
zipkin.Span result = this.listener.convert(this.parent);
|
||||
|
||||
@@ -91,7 +91,7 @@ public class ZipkinSpanListenerTests {
|
||||
/** Sleuth host corresponds to annotation/binaryAnnotation.host in zipkin. */
|
||||
@Test
|
||||
public void annotationsIncludeHost() {
|
||||
this.parent.log("http/request/retry");
|
||||
this.parent.log("hystrix/retry");
|
||||
this.parent.tag("spring-boot/version", "1.3.1.RELEASE");
|
||||
|
||||
zipkin.Span result = this.listener.convert(this.parent);
|
||||
|
||||
Reference in New Issue
Block a user