Skip to content

Instantly share code, notes, and snippets.

@taiki45
Last active August 8, 2017 04:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taiki45/057d50a5a3e5a9aa0407 to your computer and use it in GitHub Desktop.
Save taiki45/057d50a5a3e5a9aa0407 to your computer and use it in GitHub Desktop.

Install

# For Thrift problem https://issues.apache.org/jira/browse/THRIFT-2219
bundle config build.thrift --with-cppflags='-D_FORTIFY_SOURCE=0'
bundle install
require 'base64' # finagle-tracer needs this
require 'sinatra'
require 'zipkin-tracer'
config = {
service_name: 'test-app',
service_port: 4567,
sample_rate: 1,
}
use ZipkinTracer::RackHandler, config
get '/' do
'hello'
end
require 'base64'
require 'open-uri'
require 'pry'
require 'sinatra'
require 'zipkin-tracer'
require 'faraday'
require 'faraday/zipkin'
set :port, 3000
config = {
service_name: 'test-app2',
service_port: 3000,
sample_rate: 1,
}
use ZipkinTracer::RackHandler, config
get '/' do
conn = Faraday.new(url: 'http://localhost:4567') do |faraday|
faraday.use Faraday::Zipkin::TraceHeaders, 'test-app2'
faraday.response :logger
faraday.adapter Faraday.default_adapter
end
r = conn.get
r.body + '!!!!'
end
## built-in TCP input
## $ echo <json> | fluent-cat <tag>
<source>
type forward
</source>
<source>
type scribe
port 1463
</source>
<match zipkin.**>
type scribe
port 9410
flush_interval 1s
</match>
# A sample Gemfile
source 'https://rubygems.org'
gem 'zipkin-tracer', path: '~/.ghq/github.com/twitter/zipkin/zipkin-gems/zipkin-tracer'
gem 'sinatra'
gem 'thin'
gem 'faraday'
gem 'pry'
gem 'faraday-zipkin', github: 'taiki45/faraday-zipkin', branch: 'zipkin-tracer-compatible'
GIT
remote: git://github.com/taiki45/faraday-zipkin.git
revision: e266ce51d65c6565f6dc3ad615705694eaaa1c98
branch: zipkin-tracer-compatible
specs:
faraday-zipkin (0.2.2)
faraday (>= 0.8)
PATH
remote: ~/.ghq/github.com/twitter/zipkin/zipkin-gems/zipkin-tracer
specs:
zipkin-tracer (0.1.0)
finagle-thrift (~> 1.3.0)
scribe (~> 0.2.4)
GEM
remote: https://rubygems.org/
specs:
coderay (1.1.0)
daemons (1.1.9)
eventmachine (1.0.3)
faraday (0.9.0)
multipart-post (>= 1.2, < 3)
finagle-thrift (1.3.1)
method_source (0.8.2)
multipart-post (2.0.0)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rack (1.5.2)
rack-protection (1.5.3)
rack
rake (10.3.2)
scribe (0.2.4)
rake
thrift_client (~> 0.6)
sinatra (1.4.5)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
slop (3.6.0)
thin (1.6.3)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0)
rack (~> 1.0)
thrift (0.9.1)
thrift_client (0.9.3)
thrift (~> 0.9.0)
tilt (1.4.1)
PLATFORMS
ruby
DEPENDENCIES
faraday
faraday-zipkin!
pry
sinatra
thin
zipkin-tracer!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment