Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Rubyで試すZipkin

6a713ccbc001bb4d1efcc77c391257d9?s=47 nomlab
February 29, 2020

 Rubyで試すZipkin

6a713ccbc001bb4d1efcc77c391257d9?s=128

nomlab

February 29, 2020
Tweet

More Decks by nomlab

Other Decks in Programming

Transcript

  1. Ruby  Zipkin  2020 229    

  2. No.2      (   1

    ( % !&"'$#
  3. No.3 @DF=E;=>?B =>?B0+65C:9>@7$#,5=>?B H I =>?B2G1.1C:9>@*!<FA>73-)0 !1<FA>0+65=>?B ( (1) =>?B11*'

    @DF=E;=>?B7)/G <FA>1%4<FA> 1D8?E=7 " ( (2) &4D8?E=1G 1<FA>1 *'
  4. No.4 Zipkin (1) Twitter ,OSS  &)+!*!"$( (2) Google 

    Dapper  - . (1)  +'"API %+# (2) %+#UI 
  5. No.5 Zipkin

  6. No.6 Zipkin    <Reporter> (1)  (2) Zipkin

    
  7. No.7 Zipkin    <Collerctor> (1)  

  8. No.8 Zipkin    <Storage> (1)   

  9. No.9 Zipkin  <API> (1) Storage    

    
  10. No.10 Zipkin   <UI> (1) Storage   

  11. No.11 Zipkin

  12. No.12 Zipkin

  13. No.13 Zipkin  (1) User CodeHTTP GET /foo  

  14. No.14 Zipkin  (2) Trace Instrumentation    

  15. No.15 Zipkin (3) Trace InstrumentationHttp Client  

  16. No.16 Zipkin (4) Http Client   Trace Instrumentation

  17. No.17 Zipkin   (5) Trace Instrumentation   

    
  18. No.18 Zipkin (6) Trace InstrumentationUser Code   

  19. No.19 Zipkin  (7) Trace Instrumentation    

    Zipkin Collector  
  20. No.20  (1) Web  HTTP  (2) Zipkin 

    Web1 localhost:8081 Web2 localhost:8082 Web3 localhost:9000  Zipkin localhost:9411
  21. No.21  (1) Web  (2) HTTP   (3)

    Zipkin   (Trace ID   ) (4) Zipkin   Web1 localhost:8081 Web2 localhost:8082 Web3 localhost:9000  Zipkin localhost:9411
  22. No.22  (1) Web  (2) HTTP   (3)

    Zipkin   (Trace ID   ) (4) Zipkin   Web1 localhost:8081 Web2 localhost:8082 Web3 localhost:9000  Zipkin localhost:9411
  23. No.23 (1) Web  (1) Sinatra: Web  (2) GET

        
  24. No.24  (1) Web  (2) HTTP   (3)

    Zipkin   (Trace ID   ) (4) Zipkin   Web1 localhost:8081 Web2 localhost:8082 Web3 localhost:9000  Zipkin localhost:9411
  25. No.25 (2) HTTP   (1) Faraday: HTTP  

    (2)  HTTP  (3) localhost:9000/api GET 
  26. No.26  (1) Web  (2) HTTP   (3)

    Zipkin   (Trace ID   ) (4) Zipkin   Web1 localhost:8081 Web2 localhost:8082 Web3 localhost:9000  Zipkin localhost:9411
  27. No.27 Zipkin &$&' (2) )zipkin-ruby  )Ruby (1) %(! 

    &$&' ("#(  C)C++)Python&$&'
  28. No.28 Rack (1/2) (1) Web Web    

    (2) gem () Rails, Sinatra, Faraday sinatra rails Faraday rack middleware handler
  29. No.29 Rack (2/2) sinatra rails Faraday rack middleware handler RackA:F)*(

    call# " '&-D3 HTTPE-+39##  ' Rack;H:D "Web0I<' &-D3 Rack(>E.I1CH callB47:'$&,=2*-9 httpE-+39?76! '%Hash' JKMML#38I53 /I:JG3@H3?76JG3@H3body'B47:
  30. No.30 Rack&#* Rack&#* ,Zipkin($() (3a) FaradayZipkin($() (3b) SinatraZipkin($() HTTP) "

       () !' !+% ,Trace ID
  31. No.31 (3a) FaradayZipkin   (1) Faraday  use 

    
  32. No.32 (3b) Sinatra Zipkin (1) Rack use  ∵ Sinatra!Rack

     
  33. No.33  (1) Web  Web1 Web2 Web3  Zipkin

    (2) HTTP   (3) Zipkin   (Trace ID   ) (4) Zipkin  
  34. No.34 (4) Zipkin  (1) Docker (2) Java $ curl

    -sSL https://zipkin.io/quickstart.sh | bash -s $ java -jar zipkin.jar (3) Running from source # get the latest source $ git clone https://github.com/openzipkin/zipkin cd zipkin # Build the server and also make its dependencies $ ./mvnw -DskipTests --also-make -pl zipkin-server clean install # Run the server $ java -jar ./zipkin-server/target/zipkin-server-*exec.jar $ docker run –d –p 9411:9411 openzipkin/zipkin
  35. No.35  (1) http://localhost:8081/  (2) http://localhost:9411/   :

    2020-02-14T14:01:18+09:00
  36. No.36  (1) OpenZipkin &middot; A distributed tracing system, https://zipkin.io/

    '  (2) zipkin, https://github.com/openzipkin/zipkin (3)  "$&% !#Zipkin, https://qiita.com/miya10kei/items/2532b80fcd8d19eb2e75 (4) Rack' https://qiita.com/k0kubun/items/248395f68164b52aec4a (5) zipkin-ruby-example, https://github.com/openzipkin/zipkin-ruby-example