Data Model

Note this page is out-of-date. Please view the Zipkin Api doc which elaborates the fields in the model until this page is updated.

In order to illustrate the tracing data that Zipkin displays, let’s relate it to the equivalent information in the Zipkin data model. By comparing these, we see that

  • inbound and outbound requests are in different spans
  • spans that include cs can log an sa annotation of where they are going
    • This helps when the destination protocol isn’t Zipkin instrumented, such as MySQL.

First, we see one trace as shown in the Zipkin trace viewer:

Zipkin Screenshot

And the same trace in the data model of Zipkin:

  1. [
  2. {
  3. "traceId": "bd7a977555f6b982",
  4. "name": "get",
  5. "id": "bd7a977555f6b982",
  6. "timestamp": 1458702548467000,
  7. "duration": 386000,
  8. "annotations": [
  9. {
  10. "endpoint": {
  11. "serviceName": "zipkin-query",
  12. "ipv4": "192.168.1.2",
  13. "port": 9411
  14. },
  15. "timestamp": 1458702548467000,
  16. "value": "sr"
  17. },
  18. {
  19. "endpoint": {
  20. "serviceName": "zipkin-query",
  21. "ipv4": "192.168.1.2",
  22. "port": 9411
  23. },
  24. "timestamp": 1458702548853000,
  25. "value": "ss"
  26. }
  27. ],
  28. "binaryAnnotations": []
  29. },
  30. {
  31. "traceId": "bd7a977555f6b982",
  32. "name": "get-traces",
  33. "id": "ebf33e1a81dc6f71",
  34. "parentId": "bd7a977555f6b982",
  35. "timestamp": 1458702548478000,
  36. "duration": 354374,
  37. "annotations": [],
  38. "binaryAnnotations": [
  39. {
  40. "key": "lc",
  41. "value": "JDBCSpanStore",
  42. "endpoint": {
  43. "serviceName": "zipkin-query",
  44. "ipv4": "192.168.1.2",
  45. "port": 9411
  46. }
  47. },
  48. {
  49. "key": "request",
  50. "value": "QueryRequest{serviceName=zipkin-query, spanName=null, annotations=[], binaryAnnotations={}, minDuration=null, maxDuration=null, endTs=1458702548478, lookback=86400000, limit=1}",
  51. "endpoint": {
  52. "serviceName": "zipkin-query",
  53. "ipv4": "192.168.1.2",
  54. "port": 9411
  55. }
  56. }
  57. ]
  58. },
  59. {
  60. "traceId": "bd7a977555f6b982",
  61. "name": "query",
  62. "id": "be2d01e33cc78d97",
  63. "parentId": "ebf33e1a81dc6f71",
  64. "timestamp": 1458702548786000,
  65. "duration": 13000,
  66. "annotations": [
  67. {
  68. "endpoint": {
  69. "serviceName": "zipkin-query",
  70. "ipv4": "192.168.1.2",
  71. "port": 9411
  72. },
  73. "timestamp": 1458702548786000,
  74. "value": "cs"
  75. },
  76. {
  77. "endpoint": {
  78. "serviceName": "zipkin-query",
  79. "ipv4": "192.168.1.2",
  80. "port": 9411
  81. },
  82. "timestamp": 1458702548799000,
  83. "value": "cr"
  84. }
  85. ],
  86. "binaryAnnotations": [
  87. {
  88. "key": "jdbc.query",
  89. "value": "select distinct `zipkin_spans`.`trace_id` from `zipkin_spans` join `zipkin_annotations` on (`zipkin_spans`.`trace_id` = `zipkin_annotations`.`trace_id` and `zipkin_spans`.`id` = `zipkin_annotations`.`span_id`) where (`zipkin_annotations`.`endpoint_service_name` = ? and `zipkin_spans`.`start_ts` between ? and ?) order by `zipkin_spans`.`start_ts` desc limit ?",
  90. "endpoint": {
  91. "serviceName": "zipkin-query",
  92. "ipv4": "192.168.1.2",
  93. "port": 9411
  94. }
  95. },
  96. {
  97. "key": "sa",
  98. "value": true,
  99. "endpoint": {
  100. "serviceName": "spanstore-jdbc",
  101. "ipv4": "127.0.0.1",
  102. "port": 3306
  103. }
  104. }
  105. ]
  106. },
  107. {
  108. "traceId": "bd7a977555f6b982",
  109. "name": "query",
  110. "id": "13038c5fee5a2f2e",
  111. "parentId": "ebf33e1a81dc6f71",
  112. "timestamp": 1458702548817000,
  113. "duration": 1000,
  114. "annotations": [
  115. {
  116. "endpoint": {
  117. "serviceName": "zipkin-query",
  118. "ipv4": "192.168.1.2",
  119. "port": 9411
  120. },
  121. "timestamp": 1458702548817000,
  122. "value": "cs"
  123. },
  124. {
  125. "endpoint": {
  126. "serviceName": "zipkin-query",
  127. "ipv4": "192.168.1.2",
  128. "port": 9411
  129. },
  130. "timestamp": 1458702548818000,
  131. "value": "cr"
  132. }
  133. ],
  134. "binaryAnnotations": [
  135. {
  136. "key": "jdbc.query",
  137. "value": "select `zipkin_spans`.`trace_id`, `zipkin_spans`.`id`, `zipkin_spans`.`name`, `zipkin_spans`.`parent_id`, `zipkin_spans`.`debug`, `zipkin_spans`.`start_ts`, `zipkin_spans`.`duration` from `zipkin_spans` where `zipkin_spans`.`trace_id` in (?)",
  138. "endpoint": {
  139. "serviceName": "zipkin-query",
  140. "ipv4": "192.168.1.2",
  141. "port": 9411
  142. }
  143. },
  144. {
  145. "key": "sa",
  146. "value": true,
  147. "endpoint": {
  148. "serviceName": "spanstore-jdbc",
  149. "ipv4": "127.0.0.1",
  150. "port": 3306
  151. }
  152. }
  153. ]
  154. },
  155. {
  156. "traceId": "bd7a977555f6b982",
  157. "name": "query",
  158. "id": "37ee55f3d3a94336",
  159. "parentId": "ebf33e1a81dc6f71",
  160. "timestamp": 1458702548827000,
  161. "duration": 2000,
  162. "annotations": [
  163. {
  164. "endpoint": {
  165. "serviceName": "zipkin-query",
  166. "ipv4": "192.168.1.2",
  167. "port": 9411
  168. },
  169. "timestamp": 1458702548827000,
  170. "value": "cs"
  171. },
  172. {
  173. "endpoint": {
  174. "serviceName": "zipkin-query",
  175. "ipv4": "192.168.1.2",
  176. "port": 9411
  177. },
  178. "timestamp": 1458702548829000,
  179. "value": "cr"
  180. }
  181. ],
  182. "binaryAnnotations": [
  183. {
  184. "key": "jdbc.query",
  185. "value": "select `zipkin_annotations`.`trace_id`, `zipkin_annotations`.`span_id`, `zipkin_annotations`.`a_key`, `zipkin_annotations`.`a_value`, `zipkin_annotations`.`a_type`, `zipkin_annotations`.`a_timestamp`, `zipkin_annotations`.`endpoint_ipv4`, `zipkin_annotations`.`endpoint_port`, `zipkin_annotations`.`endpoint_service_name` from `zipkin_annotations` where `zipkin_annotations`.`trace_id` in (?) order by `zipkin_annotations`.`a_timestamp` asc, `zipkin_annotations`.`a_key` asc",
  186. "endpoint": {
  187. "serviceName": "zipkin-query",
  188. "ipv4": "192.168.1.2",
  189. "port": 9411
  190. }
  191. },
  192. {
  193. "key": "sa",
  194. "value": true,
  195. "endpoint": {
  196. "serviceName": "spanstore-jdbc",
  197. "ipv4": "127.0.0.1",
  198. "port": 3306
  199. }
  200. }
  201. ]
  202. }
  203. ]