Skip to content

Commit d8c05cd

Browse files
author
Adrian Cole
committed
Adds test for http api when service name is absent
1 parent 615d74b commit d8c05cd

File tree

1 file changed

+261
-0
lines changed

1 file changed

+261
-0
lines changed

zipkin-query/src/test/scala/com/twitter/zipkin/query/ZipkinQueryServerFeatureTest.scala

+261
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,267 @@ class ZipkinQueryServerFeatureTest extends FeatureTest with MockitoSugar with Be
375375
""".stripMargin)
376376
}
377377

378+
"find traces" in {
379+
app.injector.instance[SpanStore].apply(allSpans)
380+
381+
// Notice annotations are in order by timestamp, and all spans came back
382+
server.httpGet(
383+
path = "/api/v1/traces",
384+
andExpect = Ok,
385+
withJsonBody =
386+
"""
387+
|[
388+
| [
389+
| {
390+
| "traceId" : "0000000000000002",
391+
| "name" : "methodcall",
392+
| "id" : "0000000000000002",
393+
| "timestamp" : 101000,
394+
| "duration" : 400000,
395+
| "annotations" : [
396+
| {
397+
| "timestamp" : 101000,
398+
| "value" : "cs",
399+
| "endpoint" : {
400+
| "serviceName" : "service2",
401+
| "ipv4" : "0.0.0.234",
402+
| "port" : 234
403+
| }
404+
| },
405+
| {
406+
| "timestamp" : 501000,
407+
| "value" : "cr",
408+
| "endpoint" : {
409+
| "serviceName" : "service2",
410+
| "ipv4" : "0.0.0.234",
411+
| "port" : 234
412+
| }
413+
| },
414+
| {
415+
| "timestamp" : 101000,
416+
| "value" : "sr",
417+
| "endpoint" : {
418+
| "serviceName" : "service1",
419+
| "ipv4" : "0.0.0.123",
420+
| "port" : 123
421+
| }
422+
| },
423+
| {
424+
| "timestamp" : 501000,
425+
| "value" : "ss",
426+
| "endpoint" : {
427+
| "serviceName" : "service1",
428+
| "ipv4" : "0.0.0.123",
429+
| "port" : 123
430+
| }
431+
| }
432+
| ],
433+
| "binaryAnnotations" : [ ]
434+
| },
435+
| {
436+
| "traceId" : "0000000000000002",
437+
| "name" : "methodcall",
438+
| "id" : "000000000000029a",
439+
| "parentId" : "0000000000000002",
440+
| "timestamp" : 276000,
441+
| "duration" : 50000,
442+
| "annotations" : [
443+
| {
444+
| "timestamp" : 276000,
445+
| "value" : "cs",
446+
| "endpoint" : {
447+
| "serviceName" : "service1",
448+
| "ipv4" : "0.0.0.123",
449+
| "port" : 123
450+
| }
451+
| },
452+
| {
453+
| "timestamp" : 286000,
454+
| "value" : "sr",
455+
| "endpoint" : {
456+
| "serviceName" : "service2",
457+
| "ipv4" : "0.0.0.234",
458+
| "port" : 234
459+
| }
460+
| },
461+
| {
462+
| "timestamp" : 316000,
463+
| "value" : "ss",
464+
| "endpoint" : {
465+
| "serviceName" : "service2",
466+
| "ipv4" : "0.0.0.234",
467+
| "port" : 234
468+
| }
469+
| },
470+
| {
471+
| "timestamp" : 326000,
472+
| "value" : "cr",
473+
| "endpoint" : {
474+
| "serviceName" : "service1",
475+
| "ipv4" : "0.0.0.123",
476+
| "port" : 123
477+
| }
478+
| }
479+
| ],
480+
| "binaryAnnotations" : [ ]
481+
| }
482+
| ],
483+
| [
484+
| {
485+
| "traceId" : "0000000000000001",
486+
| "name" : "methodcall",
487+
| "id" : "000000000000029a",
488+
| "parentId" : "0000000000000002",
489+
| "timestamp" : 100000,
490+
| "duration" : 50000,
491+
| "annotations" : [
492+
| {
493+
| "timestamp" : 100000,
494+
| "value" : "cs",
495+
| "endpoint" : {
496+
| "serviceName" : "service1",
497+
| "ipv4" : "0.0.0.123",
498+
| "port" : 123
499+
| }
500+
| },
501+
| {
502+
| "timestamp" : 150000,
503+
| "value" : "cr",
504+
| "endpoint" : {
505+
| "serviceName" : "service1",
506+
| "ipv4" : "0.0.0.123",
507+
| "port" : 123
508+
| }
509+
| }
510+
| ],
511+
| "binaryAnnotations" : [ ]
512+
| }
513+
| ],
514+
| [
515+
| {
516+
| "traceId" : "0000000000000006",
517+
| "name" : "some-method",
518+
| "id" : "000000000000029d",
519+
| "parentId" : "0000000000000002",
520+
| "timestamp" : 100000,
521+
| "duration" : 50000,
522+
| "annotations" : [
523+
| {
524+
| "timestamp" : 100000,
525+
| "value" : "cs",
526+
| "endpoint" : {
527+
| "serviceName" : "service4",
528+
| "ipv4" : "0.0.1.200",
529+
| "port" : 456
530+
| }
531+
| },
532+
| {
533+
| "timestamp" : 150000,
534+
| "value" : "cr",
535+
| "endpoint" : {
536+
| "serviceName" : "service4",
537+
| "ipv4" : "0.0.1.200",
538+
| "port" : 456
539+
| }
540+
| }
541+
| ],
542+
| "binaryAnnotations" : [ ]
543+
| }
544+
| ],
545+
| [
546+
| {
547+
| "traceId" : "0000000000000003",
548+
| "name" : "methodcall",
549+
| "id" : "0000000000000003",
550+
| "timestamp" : 99000,
551+
| "duration" : 100000,
552+
| "annotations" : [
553+
| {
554+
| "timestamp" : 99000,
555+
| "value" : "cs",
556+
| "endpoint" : {
557+
| "serviceName" : "service2",
558+
| "ipv4" : "0.0.0.234",
559+
| "port" : 234
560+
| }
561+
| },
562+
| {
563+
| "timestamp" : 199000,
564+
| "value" : "cr",
565+
| "endpoint" : {
566+
| "serviceName" : "service2",
567+
| "ipv4" : "0.0.0.234",
568+
| "port" : 234
569+
| }
570+
| }
571+
| ],
572+
| "binaryAnnotations" : [ ]
573+
| }
574+
| ],
575+
| [
576+
| {
577+
| "traceId" : "0000000000000005",
578+
| "name" : "other-method",
579+
| "id" : "000000000000029a",
580+
| "parentId" : "0000000000000002",
581+
| "timestamp" : 60000,
582+
| "duration" : 40000,
583+
| "annotations" : [
584+
| {
585+
| "timestamp" : 60000,
586+
| "value" : "cs",
587+
| "endpoint" : {
588+
| "serviceName" : "service3",
589+
| "ipv4" : "0.0.1.89",
590+
| "port" : 345
591+
| }
592+
| },
593+
| {
594+
| "timestamp" : 65000,
595+
| "value" : "annotation",
596+
| "endpoint" : {
597+
| "serviceName" : "service3",
598+
| "ipv4" : "0.0.1.89",
599+
| "port" : 345
600+
| }
601+
| },
602+
| {
603+
| "timestamp" : 100000,
604+
| "value" : "cr",
605+
| "endpoint" : {
606+
| "serviceName" : "service3",
607+
| "ipv4" : "0.0.1.89",
608+
| "port" : 345
609+
| }
610+
| }
611+
| ],
612+
| "binaryAnnotations" : [
613+
| {
614+
| "key" : "annotation",
615+
| "value" : "ann",
616+
| "endpoint" : {
617+
| "serviceName" : "service3",
618+
| "ipv4" : "0.0.1.89",
619+
| "port" : 345
620+
| }
621+
| },
622+
| {
623+
| "key" : "binary",
624+
| "value" : "YW5u",
625+
| "type" : "BYTES",
626+
| "endpoint" : {
627+
| "serviceName" : "service3",
628+
| "ipv4" : "0.0.1.89",
629+
| "port" : 345
630+
| }
631+
| }
632+
| ]
633+
| }
634+
| ]
635+
|]
636+
""".stripMargin)
637+
}
638+
378639
"find traces missing service" in {
379640
server.httpGet(
380641
path = "/api/v1/traces?serviceName=",

0 commit comments

Comments
 (0)