GitHub PullRequestReviewCommentEvent at 2014-01-24 02:55:53
Repository: zipkin
Actor: mosesn
Payload: {"comment":{"url":"https://api.github.com/repos/twitter/zipkin/pulls/comments/9139062","id":9139062,"diff_hunk":"@@ -0,0 +1,64 @@\n+/*\n+ * Copyright 2012 Twitter Inc.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package com.twitter.zipkin.sampler\n+\n+import com.twitter.util.{Await, Future}\n+import com.twitter.finagle.Service\n+import com.twitter.zipkin.common._\n+import org.junit.runner.RunWith\n+import org.scalatest.FunSuite\n+import org.scalatest.junit.JUnitRunner\n+\n+@RunWith(classOf[JUnitRunner])\n+class SpanSamplerFilterTest extends FunSuite {\n+  test(\"filters spans based on their traceId\") {\n+    val spans = Seq(\n+      Span(0, \"svc\", 123L, None, List.empty[Annotation], Seq.empty[BinaryAnnotation]),\n+      Span(1, \"svc\", 123L, None, List.empty[Annotation], Seq.empty[BinaryAnnotation]),\n+      Span(2, \"svc\", 123L, None, List.empty[Annotation], Seq.empty[BinaryAnnotation]),\n+      Span(3, \"svc\", 123L, None, List.empty[Annotation], Seq.empty[BinaryAnnotation]),\n+      Span(4, \"svc\", 123L, None, List.empty[Annotation], Seq.empty[BinaryAnnotation]))\n+\n+    var rcvdSpans = Seq.empty[Span]\n+\n+    val svc = new SpanSamplerFilter(_ > 2) andThen Service.mk[Seq[Span], Unit] { spans =>\n+      rcvdSpans = spans\n+      Future.Unit\n+    }\n+\n+    Await.ready(svc(spans))\n+\n+    assert(rcvdSpans === spans.drop(3))\n+  }\n+\n+  test(\"will not filter debug spans\") {\n+    val spans = Seq(\n+      Span(0, \"svc\", 123L, None, List.empty[Annotation], Seq.empty[BinaryAnnotation], true),\n+      Span(1, \"svc\", 123L, None, List.empty[Annotation], Seq.empty[BinaryAnnotation], true),\n+      Span(1, \"svc\", 123L, None, List.empty[Annotation], Seq.empty[BinaryAnnotation], false))\n+\n+    var rcvdSpans = Seq.empty[Span]\n+\n+    val svc = new SpanSamplerFilter(_  => false) andThen Service.mk[Seq[Span], Unit] { spans =>\n+      rcvdSpans = spans\n+      Future.Unit","path":"zipkin-sampler/src/test/scala/com/twitter/zipkin/sampler/SpanSamplerFilterTest.scala","position":57,"original_position":57,"commit_id":"6c8fa1fb01b0698b626b5c15e321b35f0eec92fc","original_commit_id":"6c8fa1fb01b0698b626b5c15e321b35f0eec92fc","user":{"login":"mosesn","id":156562,"avatar_url":"https://gravatar.com/avatar/7ead26d6d4d0eeaece9e66ce021871a1?d=https%3A%2F%2Fidenticons.github.com%2F6471ed418d8d3123f9404a9f9278ac23.png&r=x","gravatar_id":"7ead26d6d4d0eeaece9e66ce021871a1","url":"https://api.github.com/users/mosesn","html_url":"https://github.com/mosesn","followers_url":"https://api.github.com/users/mosesn/followers","following_url":"https://api.github.com/users/mosesn/following{/other_user}","gists_url":"https://api.github.com/users/mosesn/gists{/gist_id}","starred_url":"https://api.github.com/users/mosesn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mosesn/subscriptions","organizations_url":"https://api.github.com/users/mosesn/orgs","repos_url":"https://api.github.com/users/mosesn/repos","events_url":"https://api.github.com/users/mosesn/events{/privacy}","received_events_url":"https://api.github.com/users/mosesn/received_events","type":"User","site_admin":false},"body":"Future.Done","created_at":"2014-01-24T02:55:53Z","updated_at":"2014-01-24T02:55:53Z","html_url":"https://github.com/twitter/zipkin/pull/327#discussion_r9139062","pull_request_url":"https://api.github.com/repos/twitter/zipkin/pulls/327","_links":{"self":{"href":"https://api.github.com/repos/twitter/zipkin/pulls/comments/9139062"},"html":{"href":"https://github.com/twitter/zipkin/pull/327#discussion_r9139062"},"pull_request":{"href":"https://api.github.com/repos/twitter/zipkin/pulls/327"}}}}