oboe 2.7.7.1 → 2.7.8.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e12e0be2eaca4139071f49e208ec204361471e53
4
- data.tar.gz: fcfbe0144510290a381a8fbc35920e4d3bdec921
3
+ metadata.gz: 2b9bbd08a173607dee7479100a3d26a882dda4f1
4
+ data.tar.gz: 8ae72fb3f10506ccc4947628e77a55f3af33c6b7
5
5
  SHA512:
6
- metadata.gz: 4678a5789e8b976ce37ff8581121172eca657aace4f8f061b848e4fc09bfbcc42e111bae4133dedd53e2ed8dd0b1514d5c5dfe4b1eb4d2a976cfd37d3742ab76
7
- data.tar.gz: a44ed9f77128673584d096a169f47098b77f8406495af01117dc81c8cecf294c483969123f143e01997003a6bd50583e39cf6b14ab3799e8c06ea75dd907a98b
6
+ metadata.gz: c2b91731560f39824bb91dd58c25cfc4b5c4f16a799477d29c1e8e1565100962665b273c4ac920c47fe413bad7c635b6d7071905f6f4df352fb5d11859643af4
7
+ data.tar.gz: ae29ddce04ecec926340fedd43167a277e1afc05993c2405f868da6e37552d6ea7ff37e7770358547ebc9667b7ebf7c9f73abb61a66008ea6f1b9aa3b7594cce
data/Gemfile CHANGED
@@ -39,7 +39,11 @@ if defined?(JRUBY_VERSION)
39
39
  else
40
40
  gem 'mysql'
41
41
  gem 'mysql2'
42
- gem 'pg'
42
+ if RUBY_VERSION < '1.9.3'
43
+ gem 'pg', '0.17.1'
44
+ else
45
+ gem 'pg'
46
+ end
43
47
  end
44
48
 
45
49
  if RUBY_VERSION >= '1.9'
@@ -153,14 +153,17 @@ module Oboe
153
153
  # Store the returned SampleRateConfig into Oboe::Config
154
154
  if sr_cfg
155
155
  begin
156
- Oboe.sample_rate = sr_cfg.sampleRate
157
- Oboe.sample_source = sr_cfg.sampleRateSource.a
156
+ Oboe::Config.sample_rate = cfg.sampleRate
157
+ Oboe::Config.sample_source = cfg.sampleRateSourceValue
158
158
  # If we fail here, we do so quietly. This was we don't spam logs
159
159
  # on every request
160
160
  end
161
+ else
162
+ Oboe.sample_rate = -1
163
+ Oboe.sample_source = -1
161
164
  end
162
165
 
163
- sr_cfg
166
+ sr_cfg ? true : false
164
167
  rescue => e
165
168
  Oboe.logger.debug "[oboe/debug] #{e.message}"
166
169
  false
@@ -69,9 +69,33 @@ module Oboe
69
69
  Oboe::Context.fromString(xtrace) if Oboe.pickup_context?(xtrace)
70
70
 
71
71
  if Oboe.tracing?
72
+ # Pre-existing context. Either we inherited context from an
73
+ # incoming X-Trace request header or under JRuby, Joboe started
74
+ # tracing before the JRuby code was called (e.g. Tomcat)
72
75
  Oboe.is_continued_trace = true
76
+
77
+ if Oboe.has_xtrace_header
78
+ opts[:TraceOrigin] = :continued_header
79
+ elsif Oboe.has_incoming_context
80
+ opts[:TraceOrigin] = :continued_context
81
+ else
82
+ opts[:TraceOrigin] = :continued
83
+ end
84
+
73
85
  log_entry(layer, opts)
74
- elsif opts.key?('Force') || Oboe.sample?(opts.merge(:layer => layer, :xtrace => xtrace))
86
+
87
+ elsif opts.key?('Force')
88
+ # Forced tracing: used by __Init reporting
89
+ opts[:TraceOrigin] = :forced
90
+ log_event(layer, 'entry', Oboe::Context.startTrace, opts)
91
+
92
+ elsif Oboe.sample?(opts.merge(:layer => layer, :xtrace => xtrace))
93
+ # Probablistic tracing of a subset of requests based off of
94
+ # sample rate and sample source
95
+ opts[:SampleRate] = Oboe.sample_rate
96
+ opts[:SampleSource] = Oboe.sample_source
97
+ opts[:TraceOrigin] = :always_sampled
98
+
75
99
  log_event(layer, 'entry', Oboe::Context.startTrace, opts)
76
100
  end
77
101
  end
@@ -31,8 +31,8 @@ module OboeBase
31
31
 
32
32
  attr_accessor :reporter
33
33
  attr_accessor :loaded
34
- attr_accessor :sample_source
35
- attr_accessor :sample_rate
34
+ thread_local :sample_source
35
+ thread_local :sample_rate
36
36
  thread_local :layer
37
37
  thread_local :layer_op
38
38
 
@@ -37,6 +37,8 @@ module Oboe
37
37
  report_kvs['Forwarded-Port'] = env['HTTP_X_FORWARDED_PORT'] if env.key?('HTTP_X_FORWARDED_PORT')
38
38
 
39
39
  report_kvs['Ruby.Oboe.Version'] = ::Oboe::Version::STRING
40
+ report_kvs['ProcessID'] = Process.pid
41
+ report_kvs['ThreadID'] = Thread.current.to_s[/0x\w*/]
40
42
  rescue StandardError => e
41
43
  # Discard any potential exceptions. Debug log and report whatever we can.
42
44
  Oboe.logger.debug "[oboe/debug] Rack KV collection error: #{e.inspect}"
@@ -50,13 +52,6 @@ module Oboe
50
52
  report_kvs = {}
51
53
  report_kvs[:URL] = URI.unescape(req.path)
52
54
 
53
- if Oboe.always?
54
- # Only report these KVs under tracing_mode 'always' (never for 'through')
55
- # These KVs need to be in the entry event for server side.
56
- report_kvs[:SampleRate] = Oboe.sample_rate
57
- report_kvs[:SampleSource] = Oboe.sample_source
58
- end
59
-
60
55
  # Under JRuby, JOboe may have already started a trace. Make note of this
61
56
  # if so and don't clear context on log_end (see oboe/api/logging.rb)
62
57
  Oboe.has_incoming_context = Oboe.tracing?
@@ -8,7 +8,7 @@ module Oboe
8
8
  module Version
9
9
  MAJOR = 2
10
10
  MINOR = 7
11
- PATCH = 7
11
+ PATCH = 8
12
12
  BUILD = 1
13
13
 
14
14
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
@@ -85,7 +85,7 @@ module Oboe
85
85
  class << self
86
86
  def sample?(opts = {})
87
87
  begin
88
- return false unless Oboe.always?
88
+ return false unless Oboe.always? && Oboe.loaded
89
89
 
90
90
  # Assure defaults since SWIG enforces Strings
91
91
  layer = opts[:layer] ? opts[:layer].strip : ''
@@ -94,13 +94,23 @@ module Oboe
94
94
 
95
95
  rv = Oboe::Context.sampleRequest(layer, xtrace, tv_meta)
96
96
 
97
- # For older liboboe that returns true/false, just return that.
98
- return rv if [TrueClass, FalseClass].include?(rv.class) || (rv == 0)
99
-
100
- # liboboe version > 1.3.1 returning a bit masked integer with SampleRate and
101
- # source embedded
102
- Oboe.sample_rate = (rv & SAMPLE_RATE_MASK)
103
- Oboe.sample_source = (rv & SAMPLE_SOURCE_MASK) >> 24
97
+ if rv == 0
98
+ if ENV.key?('OBOE_GEM_TEST')
99
+ # When in test, always trace and don't clear
100
+ # the stored sample rate/source
101
+ true
102
+ else
103
+ Oboe.sample_rate = -1
104
+ Oboe.sample_source = -1
105
+ false
106
+ end
107
+ else
108
+ # liboboe version > 1.3.1 returning a bit masked integer with SampleRate and
109
+ # source embedded
110
+ Oboe.sample_rate = (rv & SAMPLE_RATE_MASK)
111
+ Oboe.sample_source = (rv & SAMPLE_SOURCE_MASK) >> 24
112
+ true
113
+ end
104
114
  rescue StandardError => e
105
115
  Oboe.logger.debug "[oboe/error] sample? error: #{e.inspect}"
106
116
  false
@@ -1,7 +1,6 @@
1
1
  require 'grape'
2
2
 
3
3
  class GrapeSimple < Grape::API
4
- set :reload, true
5
4
 
6
5
  get '/json_endpoint' do
7
6
  present({ :test => true })
@@ -45,6 +45,8 @@ class RackTestApp < Minitest::Test
45
45
 
46
46
  assert traces[0].has_key?('SampleRate')
47
47
  assert traces[0].has_key?('SampleSource')
48
+ assert traces[1].has_key?('ProcessID')
49
+ assert traces[1].has_key?('ThreadID')
48
50
 
49
51
  assert last_response.ok?
50
52
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oboe
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.7.1
4
+ version: 2.7.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Giacomo Lombardo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-14 00:00:00.000000000 Z
12
+ date: 2015-01-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -187,36 +187,36 @@ signing_key:
187
187
  specification_version: 4
188
188
  summary: AppNeta TraceView performance instrumentation gem for Ruby
189
189
  test_files:
190
- - test/support/config_test.rb
191
- - test/support/xtrace_test.rb
192
- - test/support/liboboe_settings_test.rb
193
- - test/profiling/method_test.rb
194
- - test/minitest_helper.rb
195
- - test/frameworks/sinatra_test.rb
196
190
  - test/frameworks/grape_test.rb
191
+ - test/frameworks/padrino_test.rb
192
+ - test/frameworks/sinatra_test.rb
197
193
  - test/frameworks/apps/sinatra_simple.rb
198
- - test/frameworks/apps/grape_simple.rb
199
194
  - test/frameworks/apps/padrino_simple.rb
200
- - test/frameworks/padrino_test.rb
201
- - test/instrumentation/memcache_test.rb
202
- - test/instrumentation/moped_test.rb
203
- - test/instrumentation/rack_test.rb
204
- - test/instrumentation/http_test.rb
195
+ - test/frameworks/apps/grape_simple.rb
196
+ - test/minitest_helper.rb
197
+ - test/instrumentation/mongo_test.rb
205
198
  - test/instrumentation/redis_hashes_test.rb
206
- - test/instrumentation/em_http_request_test.rb
199
+ - test/instrumentation/sequel_pg_test.rb
207
200
  - test/instrumentation/redis_misc_test.rb
208
- - test/instrumentation/redis_sets_test.rb
209
- - test/instrumentation/memcached_test.rb
201
+ - test/instrumentation/dalli_test.rb
210
202
  - test/instrumentation/redis_keys_test.rb
203
+ - test/instrumentation/redis_sortedsets_test.rb
204
+ - test/instrumentation/redis_strings_test.rb
205
+ - test/instrumentation/sequel_mysql_test.rb
206
+ - test/instrumentation/redis_sets_test.rb
207
+ - test/instrumentation/http_test.rb
211
208
  - test/instrumentation/typhoeus_test.rb
212
209
  - test/instrumentation/resque_test.rb
210
+ - test/instrumentation/em_http_request_test.rb
211
+ - test/instrumentation/moped_test.rb
212
+ - test/instrumentation/rack_test.rb
213
+ - test/instrumentation/memcache_test.rb
213
214
  - test/instrumentation/faraday_test.rb
214
- - test/instrumentation/redis_sortedsets_test.rb
215
- - test/instrumentation/dalli_test.rb
216
- - test/instrumentation/sequel_mysql_test.rb
217
215
  - test/instrumentation/redis_lists_test.rb
218
- - test/instrumentation/cassandra_test.rb
219
- - test/instrumentation/redis_strings_test.rb
220
- - test/instrumentation/sequel_pg_test.rb
221
- - test/instrumentation/mongo_test.rb
222
216
  - test/instrumentation/sequel_mysql2_test.rb
217
+ - test/instrumentation/cassandra_test.rb
218
+ - test/instrumentation/memcached_test.rb
219
+ - test/profiling/method_test.rb
220
+ - test/support/liboboe_settings_test.rb
221
+ - test/support/config_test.rb
222
+ - test/support/xtrace_test.rb