zipkin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-zipkin] adriancole commented on a change in pull request #2572: trim whitespace from the annotation query elements
Date Thu, 09 May 2019 00:20:54 GMT
adriancole commented on a change in pull request #2572: trim whitespace from the annotation
query elements
URL: https://github.com/apache/incubator-zipkin/pull/2572#discussion_r282301553
 
 

 ##########
 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:
   the backend will do a redundant query. Technically, the most specific would win based on
the query rules.

----------------------------------------------------------------
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

Mime
View raw message