You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zipkin.apache.org by GitBox <gi...@apache.org> on 2019/05/08 17:17:36 UTC

[GitHub] [incubator-zipkin] jorgheymans commented on a change in pull request #2572: trim spaces from the annotation query elements

jorgheymans commented on a change in pull request #2572: trim spaces from the annotation query elements
URL: https://github.com/apache/incubator-zipkin/pull/2572#discussion_r282164538
 
 

 ##########
 File path: zipkin/src/test/java/zipkin2/storage/QueryRequestTest.java
 ##########
 @@ -75,6 +76,26 @@
       .isEmpty();
   }
 
+  @Test public void annotationQueryTrimsSpaces() {
+    // spaces in http.path mixed with 'and'
+    assertThat(queryBuilder.parseAnnotationQuery("fo and o and bar and http.path = /a ").annotationQuery)
+      .containsOnly(entry("fo", ""), entry("o", ""), entry("bar", ""), entry("http.path", "/a"));
+    // http.path in the beginning, more spaces
+    assertThat(queryBuilder.parseAnnotationQuery(" http.path = /a   and fo and o   and bar").annotationQuery)
+      .containsOnly(entry("fo", ""), entry("o", ""), entry("bar", ""), entry("http.path", "/a"));
+    // @adriancole said this would be hard to parse, annotation containing spaces
+    assertThat(queryBuilder.parseAnnotationQuery("L O L").annotationQuery)
+      .containsOnly(entry("L O L", ""));
+    // annotation with spaces combined with tag
+    assertThat(queryBuilder.parseAnnotationQuery("L O L and http.path = /a").annotationQuery)
+      .containsOnly(entry("L O L", ""), entry("http.path", "/a"));
+    assertThat(queryBuilder.parseAnnotationQuery("bar =123 and L O L and http.path = /a and A B C").annotationQuery)
+      .containsOnly(entry("L O L", ""), entry("http.path", "/a"), entry("bar", "123"), entry("A B C", ""));
+    // border case, L O L as a tag and annotation, seems that the annotation takes precedence
+    assertThat(queryBuilder.parseAnnotationQuery("L O L=123 and L O L and http.path = /a").annotationQuery)
 
 Review comment:
   what is the expected behavior when a query contains a tag with the same key as an annotation in said query ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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