ruby-zipkin 0.2.906 → 0.2.907
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/ruby-zipkin.rb +13 -29
- data/lib/ruby-zipkin/version.rb +1 -1
- metadata +4 -32
data/lib/ruby-zipkin.rb
CHANGED
@@ -7,7 +7,6 @@ require 'ruby-zipkin/metadata_logger'
|
|
7
7
|
require 'ruby-zipkin/tracesampler'
|
8
8
|
require 'ruby-zipkin/trace_filter'
|
9
9
|
require 'base64'
|
10
|
-
require 'raven'
|
11
10
|
|
12
11
|
module RubyZipkin extend self
|
13
12
|
|
@@ -22,34 +21,21 @@ module RubyZipkin extend self
|
|
22
21
|
@uri_filter_list = uri_filter_list
|
23
22
|
@http_header_filter_list = http_header_filter_list
|
24
23
|
@scribe = Scribe.new("#{scribe_server}:#{scribe_port}")
|
25
|
-
|
26
|
-
#sentry logging
|
27
|
-
Raven.configure do |config|
|
28
|
-
config.dsn = 'https://311886275dcd4698b08192e03fec9416:689d930e50244bec9ab695575ed4e774@app.getsentry.com/14698'
|
29
|
-
end
|
30
|
-
|
31
|
-
Raven.capture_message( "using scribe server: #{@scribe.to_s} - #{scribe_server}:#{scribe_port}")
|
32
|
-
puts "#{scribe_server}:#{scribe_port}"
|
33
24
|
::Trace.tracer = ::Trace::ZipkinTracer.new(Scriber.new(@scribe), scribe_max_buffer)
|
34
|
-
|
25
|
+
end
|
35
26
|
|
36
27
|
def call(env)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
#Tracing errors shouldn't block a request.
|
49
|
-
puts "Zipkin error: #{e} \n #{e.backtrace}"
|
50
|
-
Raven.capture_message "Zipkin error: #{e} \n #{e.backtrace}"
|
51
|
-
raise e
|
52
|
-
end
|
28
|
+
begin
|
29
|
+
::Trace.default_endpoint = ::Trace.default_endpoint.with_service_name(@service_name + "_#{normalized_uri(env['PATH_INFO'])}")
|
30
|
+
::Trace.sample_rate = 1
|
31
|
+
env[ZipkinTraceHeader::PARENT_SPAN_ID] = @spanid
|
32
|
+
env[ZipkinTraceHeader::TRACE_ID] = @tid
|
33
|
+
@status, @headers, @response = @app.call(env)
|
34
|
+
tracing_filter(get_or_create_trace_id2(env), env, @headers)
|
35
|
+
rescue => e
|
36
|
+
#Tracing errors shouldn't block a request.
|
37
|
+
puts "Zipkin error: #{e} \n #{e.backtrace}"
|
38
|
+
raise e
|
53
39
|
end
|
54
40
|
[@status, @headers, @response]
|
55
41
|
end
|
@@ -131,9 +117,7 @@ module RubyZipkin extend self
|
|
131
117
|
end
|
132
118
|
|
133
119
|
def get_or_create_trace_id2(env)
|
134
|
-
|
135
|
-
Raven.capture_message id.inspect
|
136
|
-
id
|
120
|
+
::Trace::TraceId.new(::Trace.generate_id, nil, ::Trace.generate_id, true, ::Trace::Flags::DEBUG)
|
137
121
|
end
|
138
122
|
end
|
139
123
|
end
|
data/lib/ruby-zipkin/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-zipkin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1793
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 907
|
10
|
+
version: 0.2.907
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ivan Marcin
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-10-
|
18
|
+
date: 2013-10-23 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: finagle-thrift
|
@@ -49,34 +49,6 @@ dependencies:
|
|
49
49
|
version: 0.2.4
|
50
50
|
type: :runtime
|
51
51
|
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: thin
|
54
|
-
prerelease: false
|
55
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
-
none: false
|
57
|
-
requirements:
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
hash: 3
|
61
|
-
segments:
|
62
|
-
- 0
|
63
|
-
version: "0"
|
64
|
-
type: :runtime
|
65
|
-
version_requirements: *id003
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
name: sentry-raven
|
68
|
-
prerelease: false
|
69
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
|
-
requirements:
|
72
|
-
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
hash: 3
|
75
|
-
segments:
|
76
|
-
- 0
|
77
|
-
version: "0"
|
78
|
-
type: :runtime
|
79
|
-
version_requirements: *id004
|
80
52
|
description: Track rack header requests on zipkin
|
81
53
|
email:
|
82
54
|
- ivan.marcin@lookout.com
|