You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicecomb.apache.org by GitBox <gi...@apache.org> on 2018/01/09 01:55:45 UTC

[GitHub] seanyinx commented on a change in pull request #488: [SCB-172] upgrade zipkin libraries to zipkin2

seanyinx commented on a change in pull request #488: [SCB-172] upgrade zipkin libraries to zipkin2
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/488#discussion_r160303178
 
 

 ##########
 File path: integration-tests/test-common/src/test/java/io/servicecomb/tests/tracing/TracingTestBase.java
 ##########
 @@ -74,27 +75,33 @@ protected void assertThatSpansReceivedByZipkin(Collection<String> logs, String..
         .map(this::extractIds)
         .collect(Collectors.toList());
 
-    String url = zipkin.httpUrl() + "/api/v1/trace/{traceId}";
+    String url = zipkin.httpUrl() + "/api/v2/trace/{traceId}";
+    log.info("rest url:" + url);
     ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class, traceId(loggedIds));
 
     assertThat(responseEntity.getStatusCode(), is(OK));
     String body = responseEntity.getBody();
     log.info("Received trace json: {}", body);
-    List<Span> spans = Codec.JSON.readSpans(body.getBytes());
+    List<Span> spans = new ArrayList<Span>();
+    SpanBytesDecoder.JSON_V2.decodeList(body.getBytes(), spans);
 
     List<String> tracedValues = tracedValues(spans);
     tracedValues.forEach(value -> log.info("Received value {}", value));
-    assertThat(tracedValues, contains(values));
+    log.info("values: " + String.join(",",values));
+    assertThat(tracedValues, containsInAnyOrder(values));
   }
 
   private List<String> tracedValues(List<Span> spans) {
     return spans.stream()
-        .filter(span -> span.binaryAnnotations != null)
-        .map(span -> span.binaryAnnotations)
+        .filter(span -> span.tags() != null)
+        .map(span -> span.tags().entrySet())
         .flatMap(Collection::stream)
-        .filter(span -> "call.path".equals(span.key) || "http.path".equals(span.key) || "http.status_code".equals(span.key))
-        .filter(span -> span.value != null)
-        .map(annotation -> new String(annotation.value))
+        .filter(span -> "call.path".equals(span.getKey()) || "http.path".equals(span.getKey()) || "http.status_code"
+            .equals
 
 Review comment:
   the format is out of order

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services