Sha256: 21574cb40ad1d7c1ab993770511e75270b16e7d5f648f1b599a49fe0b6bce1ea
Contents?: true
Size: 970 Bytes
Versions: 6
Compression:
Stored size: 970 Bytes
Contents
#!/usr/bin/env ruby require 'bundler' Bundler.setup require 'zipkin/tracer' url = ENV['ZIPKIN_URL'] || 'http://localhost:9411' tracer1 = Zipkin::Tracer.build(url: url, service_name: 'test-service') tracer2 = Zipkin::Tracer.build(url: url, service_name: 'downstream-service') outer_span = tracer1.start_span('receive request', tags: { 'span.kind' => 'server' }) sleep 1 inner_span = tracer1.start_span('fetch info from downstream', child_of: outer_span, tags: { 'span.kind' => 'client', 'peer.service' => 'downstream-service', 'peer.ipv4' => '6.6.6.6', 'peer.port' => 443 }) sleep 0.3 # emulate network delay downstream_span = tracer2.start_span('downstream operation', child_of: inner_span, tags: { 'span.kind' => 'server' }) sleep 0.5 downstream_span.finish sleep 0.2 # emulate network delay inner_span.finish sleep 0.1 # doing something with fetched info outer_span.finish puts "Finishing..." sleep 3 tracer1.stop tracer2.stop puts "Finished"
Version data entries
6 entries across 6 versions & 1 rubygems