Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

zipkin-test: TraceGen fixes

* Cleanup Main class
* Fix NPEs

Author: @franklinhu
Fixes #186
URL: #186
  • Loading branch information...
commit d6443632c6d7035290cdbc5f66fa7fcd178e4141 1 parent e0b732a
@franklinhu franklinhu authored Franklin Hu committed
View
27 zipkin-test/src/main/scala/com/twitter/zipkin/tracegen/Main.scala
@@ -16,12 +16,9 @@ package com.twitter.zipkin.tracegen
* limitations under the License.
*
*/
-
+import com.twitter.logging.Logger
import java.net.InetAddress
import java.nio.ByteBuffer
-import com.twitter.logging.Logger
-import scala.Array
-
/**
* Generates a couple of semi-realistic traces and
@@ -31,20 +28,14 @@ object Main {
val log = Logger.get(getClass.getName)
def main(args: Array[String]) {
- var collectorHost = InetAddress.getLocalHost.getHostName
- var collectorPort = 9410
- var queryHost = InetAddress.getLocalHost.getHostName
- var queryPort = 9411
-
- if (args.length < 4) {
- println("Expected args: [collectorhost] [collectorport] [queryhost] [queryport]")
- println("Falling back to defaults of localhost, collectorport 9410 and queryport 9411")
- } else {
- collectorHost = args(0)
- collectorPort = args(1).toInt
- queryHost = args(2)
- queryPort = args(3).toInt
- }
+ val (collectorHost, collectorPort, queryHost, queryPort) =
+ if (args.length < 4) {
+ // Default to localhost:9410, localhost:9411
+ (InetAddress.getLocalHost.getHostAddress, 9410, InetAddress.getLocalHost.getHostAddress, 9411)
+ } else {
+ (args(0), args(1).toInt, args(2), args(3).toInt)
+ }
+ println("Collector: %s:%d; Query: %s:%d".format(collectorHost, collectorPort, queryHost, queryPort))
val traceGen = new TraceGen
val traces = traceGen.generate(1, 7)
View
4 zipkin-test/src/main/scala/com/twitter/zipkin/tracegen/Requests.scala
@@ -78,11 +78,11 @@ class Requests(collectorHost: String, collectorPort: Int, queryHost: String, que
printTrace(ts1, client)
println("Querying for service name: " + service)
- val ts2 = client.getTraceIdsBySpanName(service, null, Long.MaxValue, maxTraces, gen.Order.DurationDesc)()
+ val ts2 = client.getTraceIdsBySpanName(service, "", Long.MaxValue, maxTraces, gen.Order.DurationDesc)()
printTrace(ts2, client)
println("Querying for annotation: " + annotation)
- val ts3 = client.getTraceIdsByAnnotation(service, annotation, null, Long.MaxValue, maxTraces, gen.Order.DurationDesc)()
+ val ts3 = client.getTraceIdsByAnnotation(service, annotation, ByteBuffer.wrap("".getBytes), Long.MaxValue, maxTraces, gen.Order.DurationDesc)()
printTrace(ts3, client)
println("Querying for kv annotation: " + kvAnnotation)
Please sign in to comment.
Something went wrong with that request. Please try again.