Spring Cloud Sleuth + Zipkin
 with Elasticsearch #zipkin_jp

Spring Cloud Sleuth + Zipkin
 with Elasticsearch #zipkin_jp

Ad3fbc316f916a341c24035e34913121?s=128

Shin Tanimoto

June 13, 2017
Tweet

Transcript

  1. Spring Cloud Sleuth + Zipkin
 with Elasticsearch Shin Tanimoto
 Acroquest

    Technology Co., LTD
  2. Copyright © Acroquest Technology Co., Ltd. All rights reserved. ࣗݾ঺հ

    2 • ୩ຊ ৺ (Shin Tanimoto) - Acroquest Technologyגࣜձࣾ - ࠷ۙ͸Elasticsearchؔ܎ͷ࢓ࣄ - ೔ຊJavaϢʔβʔάϧʔϓ - JavaOne / SpringOneεϐʔΧʔ - Twitter : @cero_t - Facebook : shin.tanimoto
  3. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 3 ࢲͱzipkinͷग़ձ͍͸
 2೥લ
  4. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 4 ϚΠΫϩαʔϏε։ൃΛ͓ͯ͠Γ
 ʮαʔϏεͷґଘؔ܎ʯ͕෼͔Βͳ͍
 ͱ͍͏໰୊͕ݦࡏԽ͍ͯͨ͠ͷͰ
 Կ͔πʔϧΛ࡞Ζ͏ͱߟ͍͑ͯͨ
  5. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 5 ͋ΔΑʂ by Josh Long
  6. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 6 Spring Cloud ͢ΓΎʔ͢
 ʢ೔ຊਓʹ͸ฉ͖औΕͳ͍ӳޠʣ
  7. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 7 ຊ೔ͷςʔϚɿ Spring Cloud Sleuthͱ
 zipkinΛ༻͍ͨ
 ʮϚΠΫϩαʔϏεͷՄࢹԽʯ
  8. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 8 αʔϏε͕૿͑Δͱ
 ৽͍͠ࠔΓ͝ͱ͕
 ৭ʑͱग़ͯ͘Δ݅
  9. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 9 #1
 
 ϚΠΫϩαʔϏε։ൃ ͷۤ೰
  10. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 1. ϚΠΫϩαʔϏε։ൃͷۤ೰ JAR Hell͔ΒService Hell΁ αʔϏεͷ਺͕૿େ͢Δ͜ͱͰ
 αʔϏεಉ࢜ͷґଘؔ܎͕෼͔Βͳ͘ͳΔ ͜ͷαʔϏεΛվम͢ΔͱͲ͜ʹӨڹ͢Δʁ ͍·ى͖ͨΤϥʔ͸Ͳ͕͜ݪҼͳͷʁ ͦ΋ͦ΋࢖ΘΕͯͳ͍αʔϏε͸ͳ͍ͷʁ 10
  11. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 1. ϚΠΫϩαʔϏε։ൃͷۤ೰ ӡ༻ऀͩͬͯࠔΔ ؂ࢹ͢΂͖αʔό΍ϓϩηεͷ਺͕ଟ͍ ͢΂ͯͷαʔόͷσΟεΫ΍ϝϞϦ͸େৎ෉ʁ 1000ݸͷϓϩηε͸͢΂ͯਖ਼ৗʹಈ͍͍ͯΔʁ ϩάϑΝΠϧ͕෼ࢄͯ͠͠·͏ ͍·ى͖ͨΤϥʔΛௐ΂ΔͨΊʹɺ
 ͲͷϩάϑΝΠϧΛݟΕ͹͍͍ͷʁ 11
  12. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 1. ϚΠΫϩαʔϏε։ൃͷۤ೰ 12 ཱ৔ʹΑͬͯۤ೰͸ҟͳΔ͕
 ͍ͣΕʹͤΑαʔϏε͚ͩͰͳ͘
 αʔό΍ϩά͕૿͑ͨ͜ͱͰ
 ݟΔ΂͖΋ͷ͕൥ࡶԽ͢Δ
  13. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 13 ͦ͜ͰՄࢹԽͰ͢Α
  14. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 14 #2
 
 ՄࢹԽʹ࢖͏πʔϧ܈
  15. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 2. ՄࢹԽʹ࢖͏πʔϧ܈ ͨͱ͑͹͜͏͍͏πʔϧ܈ αʔϏεؒͷґଘੑΛՄࢹԽʢࠓ೔࿩͢΍ͭʣ Elasticsearch + Spring Cloud Sleuth + Zipkin
 ϩάϑΝΠϧΛՄࢹԽʢࠓ೔͸࿩͞ͳ͍΍ͭʣ Elasticsearch + Logstash + Kibana + Filebeat
 αʔό΍ϓϩηεͷঢ়ଶΛՄࢹԽʢࠓ೔͸࿩͞ͳ͍΍ͭʣ Elasticsearch + Kibana + Metricbeat 15
  16. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 16 ඦฉ͸Ұݟʹ͔ͣ͠
  17. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 2. ՄࢹԽʹ࢖͏πʔϧ܈ Spring Cloud Sleuth + Zipkin 17 ϘτϧωοΫ
 Λ୳͢
  18. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 18 #3
 
 αʔϏεґଘੑͷ
 ՄࢹԽ
  19. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 3. αʔϏεґଘੑͷՄࢹԽ ԿͷͨΊʹ΍Δͷʁ αʔϏεͷվम࣌ʹɺͦͷӨڹൣғΛ֬ೝ͍ͨ͠ Τϥʔ͕ൃੜͨ͠ࡍʹɺ֬ೝ͢΂͖ൣғΛಛఆ͍ͨ͠ ΋͠ɺ࣮ࡍʹ͸࢖ΘΕ͍ͯͳ͍αʔϏε͕͋Ε͹ఀࢭ ͍ͨ͠
 
 → ओʹ։ൃऀ޲͚ͷՄࢹԽͰ͋Δ 19
  20. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 3. αʔϏεґଘੑͷՄࢹԽ Spring Cloud Sleuth + ZipkinͰαʔϏεґଘੑΛՄࢹԽ Spring Cloud Sleuthͱ͸ʁ Distributed Tracing ෳ਺αʔόΛލ͕ΔϦΫΤετʹڞ௨ͷIDΛৼͬͯ
 ʢHTTP/AMQPϔομͳͲͰ఻೻ͤ͞ͳ͕Βʣ
 ॲཧΛ௥੻Ͱ͖ΔΑ͏ʹ͢Δ࢓૊Έ
 Zipkinͱ͸ʁ Distributed Tracing Visualization ෳ਺αʔόΛލ͕ΔϦΫΤετΛՄࢹԽ͢Δ 20
  21. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 3. αʔϏεґଘੑͷՄࢹԽ Spring Cloud Sleuth + ZipkinͷΠϝʔδ 21 Microservice1 Microservice2 طʹ࡞ͬͯ͋Δ
 ϚΠΫϩαʔϏε
  22. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 3. αʔϏεґଘੑͷՄࢹԽ Spring Cloud Sleuth + ZipkinͷΠϝʔδ 22 Microservice1 Microservice2 Zipkin Server HTTP Zipkin UI Server SleuthΛ࢖ͬͯ
 ݺͼग़͠৘ใΛ
 zipkinʹૹΔ ஝ੵ ՄࢹԽ
  23. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 3. αʔϏεґଘੑͷՄࢹԽ Spring Cloud Sleuth + Zipkinͷద༻ Spring Cloud Sleuth ϚΠΫϩαʔϏεͷpom.xmlͷdependenciesʹ
 ʮspring-cloud-starter-zipkinʯΛ௥Ճ ίʔυͷมߋ͸Ұ੾ͳ͠ Zipkin ৽نϓϩδΣΫτΛ࡞ͬͯpom.xmlʹ
 ʮzipkin-serverʯͱʮzipkin-autoconfigure-uiʯΛ௥Ճ MainΫϥεΛҰͭ࡞Δ 23
  24. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 3. αʔϏεґଘੑͷՄࢹԽ Zipkinαʔόͷ։ൃ 24 @SpringBootApplication @EnableZipkinServer public class ZipkinApplication { public static void main(String[] args) { SpringApplication.run(ZipkinApplication.class, args); } }
  25. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 3. αʔϏεґଘੑͷՄࢹԽ Spring Cloud Sleuth + ZipkinͷΠϝʔδ 25 Microservice1 Microservice2 Zipkin Server HTTP Zipkin UI Server Zipkin Client 
 (spring-cloud-starter-zipkin) Zipkin UI (zipkin-autoconfigure-ui)
 Zipkin Server (zipkin-server)
  26. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. ͦΖͦΖσϞ 26 Demo
  27. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 27 ͜͏͍͏ࣄ͕؆୯ʹͰ͖Δ͔Β
 Spring CloudΛ࢖͏Μͩ
 ͍ͬͯ͏ײ֮ɺ͋Γ·͢
  28. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 3. αʔϏεґଘੑͷՄࢹԽ ΋͏গ͠৴པੑͷߴ͍ऩू 28 Microservice1 Microservice2 Zipkin Server Zipkin UI
 Server Kafka
  29. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 3. αʔϏεґଘੑͷՄࢹԽ ΋͏গ͠৴པੑͷߴ͍ऩू 29 Microservice1 Microservice2 Zipkin Server Zipkin UI
 Server Kafka spring-cloud-sleuth-stream
 spring-cloud-stream-binder-kafka zipkin-autoconfigure-ui
 spring-cloud-sleuth-zipkin-stream
 spring-cloud-stream-binder-kafka
  30. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 3. αʔϏεґଘੑͷՄࢹԽ Spring Cloud Sleuth + ZipkinͷΠϝʔδ 30 Name artifactId Log HTTP Kafka Sleuth spring-cloud-starter-sleuth Service Sleuth Stream spring-cloud-sleuth-stream Service Zipkin Client spring-cloud-starter-zipkin Service Zipkin Stream spring-cloud-sleuth-zipkin-stream Zipkin Zipkin UI spring-boot-starter
 zipkin-autoconfigure-ui Zipkin Zipkin Zipkin Server spring-boot-starter
 zipkin-server Zipkin Stream Kafka spring-cloud-stream-binder-kafka Both
  31. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 31 ʢ࠶ʣ
 ͜͏͍͏ࣄ͕؆୯ʹͰ͖Δ͔Β
 Spring CloudΛ࢖͏Μͩ
 ͍ͬͯ͏ײ֮ɺ͋Γ·͢
  32. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 32 #4
 
 ElasticsearchʹΑΔ
 ӬଓԽ
  33. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 4. ElasticsearchʹΑΔӬଓԽ 33 όοΫΤϯυ͸in-memoryҎ֎ʹ
 MySQLɺCassandra
 ElasticsearchͳͲ͕બ΂Δ͚Ͳ
  34. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 4. ElasticsearchʹΑΔӬଓԽ 34 όοΫΤϯυΛ
 Elasticsearchʹ͢Ε͹
 Kibanaͱ͔ͰՄࢹԽͰ͖Μ͡ΌͶʁ
  35. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 4. ElasticsearchʹΑΔӬଓԽ ElasticsearchʹΑΔZipkinͷӬଓԽ ґଘϥΠϒϥϦͷ௥Ճ zipkinϓϩδΣΫτͷpom.xmlͷdependenciesʹ
 ʮzipkin-autoconfigure-storage-elasticsearch-httpʯΛ௥Ճ -elasticsearch-aws͸Amazon ESઐ༻ʢͨͿΜʣ zipkinϓϩδΣΫτͷapplication.ymlʹ
 ʮzipkin.storage.type: elasticsearchʯΛ௥Ճ 35
  36. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. ΋͏Ұ౓σϞ 36 Demo
  37. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 4. ElasticsearchʹΑΔӬଓԽ 37 ·ͩ͋Μ·ΓKibanaͰ
 ՄࢹԽͰ͖΁Μ΍Μɾɾɾ
  38. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 4. ElasticsearchʹΑΔӬଓԽ 38 ࠓޙʹظ଴ɾɾɾʁ Zipkin v2 span model #939 https://github.com/openzipkin/zipkin/issues/939
  39. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. 39 ·ͱΊ
  40. Copyright © Acroquest Technology Co., Ltd. All rights reserved. Copyright

    © Acroquest Technology Co., Ltd. All rights reserved. ·ͱΊ Spring BootͰ։ൃ͍ͯ͠Δօ͞Μ͸
 Spring Cloud SleuthͱZipkinʹΑΔ
 αʔϏεґଘੑͷՄࢹԽ͸͙͢Ͱ͖ΔΑ
 ElasticsearchʹσʔλΛอଘ͢Δ͜ͱ΋Ͱ͖Δ͚Ͳ
 ՄࢹԽ͢Δʹ͸ͪΐͬͱ·ͩਏ͍͔ͳ
 ͪͳΈʹো֐΍γεςϜఀࢭ͕ى͖Δ͜ͱେલఏͱͯ͠ɺ
 KafkaΛ༻͍ͨ҆ఆԽΛݕ౼͢Ε͹ɺؾ͍ͮͨΒSpring Cloud Stream΍
 όοΫϓϨογϟʔͷϝϦοτ͕෼͔ΔΑ͏ʹͳΔΑʂ
 ʢݸਓͷײ૝Ͱ͢ʣ 40
  41. Copyright © Acroquest Technology Co., Ltd. All rights reserved. 41

    Enjoy visualizing your Spring Cloud Applications!