oboe 2.1.3 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -83,10 +83,6 @@ module Oboe
83
83
  Oboe::Config[:tracing_mode].to_s == "always"
84
84
  end
85
85
 
86
- def self.continue?
87
- Oboe::Context.isValid and not Oboe.never?
88
- end
89
-
90
86
  def self.log(layer, label, options = {})
91
87
  Context.log(layer, label, options = options)
92
88
  end
@@ -95,22 +91,18 @@ module Oboe
95
91
  Oboe::Config[:tracing_mode].to_s == "never"
96
92
  end
97
93
 
98
- def self.now?
99
- Oboe::Context.isValid and not Oboe.never?
100
- end
101
-
102
94
  def self.passthrough?
103
95
  ["always", "through"].include?(Oboe::Config[:tracing_mode])
104
96
  end
105
97
 
106
- def self.sample?
107
- Java::ComTracelyticsJoboeSettingsReader.shouldTraceRequest('', '')
98
+ def self.sample?(opts = {})
99
+ # Assure defaults since SWIG enforces Strings
100
+ opts[:layer] ||= ''
101
+ opts[:xtrace] ||= ''
102
+ opts['X-TV-Meta'] ||= ''
103
+ Java::ComTracelyticsJoboeSettingsReader.shouldTraceRequest(opts[:layer], opts[:xtrace], opts['X-TV-Meta'])
108
104
  end
109
105
 
110
- def self.start?
111
- not Oboe::Context.isValid and Oboe.always?
112
- end
113
-
114
106
  def self.through?
115
107
  Oboe::Config[:tracing_mode] == "through"
116
108
  end
@@ -6,18 +6,27 @@ module Oboe
6
6
  # layer.
7
7
  #
8
8
  def report_init(layer)
9
- platform_info = { '__Init' => 1 }
10
- platform_info['RubyPlatformVersion'] = RUBY_PLATFORM
11
- platform_info['RubyVersion'] = RUBY_VERSION
12
- platform_info['RailsVersion'] = ::Rails.version if defined?(Rails)
13
- platform_info['OboeRubyVersion'] = Gem.loaded_specs['oboe'].version if Gem.loaded_specs['oboe']
14
-
15
- force_trace do
16
- start_trace(layer, nil, platform_info) { }
9
+ platform_info = { '__Init' => 1 }
10
+
11
+ begin
12
+ platform_info['Force'] = true
13
+ platform_info['RubyPlatformVersion'] = RUBY_PLATFORM
14
+ platform_info['RubyVersion'] = RUBY_VERSION
15
+ platform_info['RailsVersion'] = ::Rails.version if defined?(Rails)
16
+ platform_info['OboeRubyVersion'] = Oboe::Version::STRING
17
+ platform_info['OboeHerokuRubyVersion'] = OboeHeroku::Version::STRING if defined?(OboeHeroku)
18
+ rescue
17
19
  end
20
+
21
+ start_trace(layer, nil, platform_info) { }
18
22
  end
19
23
 
24
+ ##
25
+ # force_trace has been deprecated and will be removed in a subsequent version.
26
+ #
20
27
  def force_trace
28
+ Oboe.logger.warn "Oboe::API::LayerInit.force_trace has been deprecated and will be removed in a subsequent version."
29
+
21
30
  saved_mode = Oboe::Config[:tracing_mode]
22
31
  Oboe::Config[:tracing_mode] = 'always'
23
32
  yield
@@ -68,7 +68,7 @@ module Oboe
68
68
 
69
69
  if Oboe.tracing?
70
70
  log_entry(layer, opts)
71
- elsif Oboe.always? or Oboe.sample?
71
+ elsif Oboe.sample?(opts.merge(:layer => layer, :xtrace => xtrace)) or opts.has_key?('Force')
72
72
  log_event(layer, 'entry', Oboe::Context.startTrace, opts)
73
73
  end
74
74
  end
@@ -2,6 +2,12 @@
2
2
  # All rights reserved.
3
3
 
4
4
  module Oboe
5
+ ##
6
+ # This module exposes a nested configuration hash that can be used to
7
+ # configure and/or modify the functionality of the oboe gem.
8
+ #
9
+ # Use Oboe::Config.show to view the entire nested hash.
10
+ #
5
11
  module Config
6
12
  @@config = {}
7
13
 
@@ -9,6 +15,9 @@ module Oboe
9
15
  :moped, :rack, :resque, :action_controller, :action_view,
10
16
  :active_record ]
11
17
 
18
+ ##
19
+ # Return the raw nested hash.
20
+ #
12
21
  def self.show
13
22
  @@config
14
23
  end
@@ -108,6 +108,7 @@ if defined?(::Rails)
108
108
 
109
109
  config.after_initialize do
110
110
  Oboe::Loading.setup_logger
111
+ Oboe::Loading.set_tracing_mode
111
112
  Oboe::Loading.load_access_key
112
113
  Oboe::Inst.load_instrumentation
113
114
  Oboe::Rails.load_instrumentation
@@ -117,6 +118,7 @@ if defined?(::Rails)
117
118
  else
118
119
  Oboe::Loading.setup_logger
119
120
  Oboe::Rails.load_initializer
121
+ Oboe::Loading.set_tracing_mode
120
122
  Oboe::Loading.load_access_key
121
123
 
122
124
  Rails.configuration.after_initialize do
@@ -43,13 +43,11 @@ end
43
43
 
44
44
  if defined?(ActionController::Base) and Oboe::Config[:action_controller][:enabled]
45
45
  if ::Rails::VERSION::MAJOR == 3
46
- Oboe::API.report_init('rails')
47
46
 
48
47
  class ActionController::Base
49
48
  include Oboe::Inst::Rails3ActionController
50
49
  end
51
50
  elsif ::Rails::VERSION::MAJOR == 2
52
- Oboe::API.report_init('rails')
53
51
 
54
52
  ActionController::Base.class_eval do
55
53
  alias :perform_action_without_oboe :perform_action
@@ -24,6 +24,7 @@ module Oboe
24
24
  report_kvs[:URL] = req.path
25
25
  report_kvs[:Method] = req.request_method
26
26
  report_kvs['AJAX'] = true if req.xhr?
27
+ report_kvs['X-TV-Meta'] = req.headers['X-TV-Meta'] if req.headers.has_key?('X-TV-Meta')
27
28
  rescue
28
29
  # Discard any potential exceptions. Report whatever we can.
29
30
  end
@@ -121,10 +121,10 @@ module Oboe
121
121
  rescue
122
122
  end
123
123
 
124
- Oboe::API.force_trace do
125
- Oboe::API.start_trace('resque', nil, report_kvs) do
126
- perform_without_oboe(job)
127
- end
124
+ # Force this trace regardless of sampling rate so that child trace can be
125
+ # link to parent trace.
126
+ Oboe::API.start_trace('resque', nil, report_kvs.merge('Force' => true)) do
127
+ perform_without_oboe(job)
128
128
  end
129
129
 
130
130
  else
@@ -5,6 +5,9 @@ require 'digest/sha1'
5
5
 
6
6
  module Oboe
7
7
  module Util
8
+ ##
9
+ # This module is used solely for RUM ID calculation
10
+ #
8
11
  module Base64URL
9
12
  module_function
10
13
 
@@ -23,6 +26,16 @@ module Oboe
23
26
  end
24
27
  end
25
28
 
29
+ ##
30
+ # This module houses all of the loading functionality for the oboe gem.
31
+ #
32
+ # Note that this does not necessarily _have_ to include initialization routines
33
+ # (although it can).
34
+ #
35
+ # Actual initialization is often separated out as it can be dependent on on the state
36
+ # of the stack boot process. e.g. code requiring that initializers, frameworks or
37
+ # instrumented libraries are already loaded...
38
+ #
26
39
  module Loading
27
40
  def self.setup_logger
28
41
  if defined?(::Rails) and ::Rails.logger
@@ -30,6 +43,10 @@ module Oboe
30
43
  end
31
44
  end
32
45
 
46
+ ##
47
+ # Load the TraceView access key (either from system configuration file
48
+ # or environment variable) and calculate internal RUM ID
49
+ #
33
50
  def self.load_access_key
34
51
  begin
35
52
  if ENV.has_key?('TRACEVIEW_CUUID')
@@ -57,6 +74,9 @@ module Oboe
57
74
  end
58
75
  end
59
76
 
77
+ ##
78
+ # Load the oboe tracing API
79
+ #
60
80
  def self.require_api
61
81
  require 'oboe/version'
62
82
 
@@ -75,6 +95,10 @@ module Oboe
75
95
  require 'oboe/config'
76
96
  end
77
97
 
98
+ ##
99
+ # Load instrumentation for the various frameworks located in
100
+ # lib/oboe/frameworks/*/*.rb
101
+ #
78
102
  def self.load_framework_instrumentation
79
103
  pattern = File.join(File.dirname(__FILE__), 'frameworks/*/', '*.rb')
80
104
  Dir.glob(pattern) do |f|
@@ -85,9 +109,46 @@ module Oboe
85
109
  end
86
110
  end
87
111
  end
112
+
113
+ ##
114
+ # Update liboboe with the configured tracing mode
115
+ #
116
+ def self.set_tracing_mode
117
+ # If we are in Heroku, let the oboe-heroku gem configure tracing mode
118
+ # itself as the requirements are slightly different.
119
+ return if defined?(OboeHeroku)
120
+
121
+ # OBOE_TRACE_NEVER 0
122
+ # OBOE_TRACE_ALWAYS 1
123
+ # OBOE_TRACE_THROUGH 2
124
+
125
+ if defined?(Oboe::Config)
126
+
127
+ case Oboe::Config[:tracing_mode].to_s.downcase.to_sym
128
+ when :never
129
+ # OBOE_TRACE_NEVER
130
+ Oboe.logger.debug "Setting liboboe TracingMode to OBOE_TRACE_NEVER"
131
+ Oboe::Context.setTracingMode(0)
132
+ when :always
133
+ # OBOE_TRACE_ALWAYS
134
+ Oboe.logger.debug "Setting liboboe TracingMode to OBOE_TRACE_ALWAYS"
135
+ Oboe::Context.setTracingMode(1)
136
+ else
137
+ # OBOE_TRACE_THROUGH
138
+ Oboe.logger.debug "Setting liboboe TracingMode to OBOE_TRACE_THROUGH"
139
+ Oboe::Context.setTracingMode(2)
140
+ end
141
+ else
142
+ # OBOE_TRACE_THROUGH
143
+ Oboe.logger.debug "Setting liboboe TracingMode to OBOE_TRACE_THROUGH (no Oboe::Config?)"
144
+ Oboe::Context.setTracingMode(2)
145
+ end
146
+ end
147
+
88
148
  end
89
149
  end
90
150
 
91
151
  Oboe::Loading.require_api
92
152
  Oboe::Loading.load_framework_instrumentation
153
+ Oboe::API.report_init('ruby')
93
154
 
@@ -1,8 +1,8 @@
1
1
  module Oboe
2
2
  module Ruby
3
3
  def self.initialize
4
- Oboe::API.report_init('ruby')
5
4
  Oboe::Loading.load_access_key
5
+ Oboe::Loading.set_tracing_mode
6
6
  Oboe::Inst.load_instrumentation
7
7
  end
8
8
  end
@@ -2,7 +2,7 @@ module Oboe
2
2
  module Version
3
3
  MAJOR = 2
4
4
  MINOR = 1
5
- PATCH = 3
5
+ PATCH = 4
6
6
  BUILD = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
@@ -53,10 +53,6 @@ module Oboe
53
53
  Oboe::Config[:tracing_mode].to_s == "always"
54
54
  end
55
55
 
56
- def continue?
57
- Oboe::Context.isValid and not Oboe.never?
58
- end
59
-
60
56
  def log(layer, label, options = {})
61
57
  Context.log(layer, label, options = options)
62
58
  end
@@ -65,22 +61,18 @@ module Oboe
65
61
  Oboe::Config[:tracing_mode].to_s == "never"
66
62
  end
67
63
 
68
- def now?
69
- Oboe::Context.isValid and not Oboe.never?
70
- end
71
-
72
64
  def passthrough?
73
65
  ["always", "through"].include?(Oboe::Config[:tracing_mode])
74
66
  end
75
67
 
76
- def sample?
77
- Oboe::Config[:sample_rate].to_i < rand(1e6)
68
+ def sample?(opts = {})
69
+ # Assure defaults since SWIG enforces Strings
70
+ opts[:layer] ||= ''
71
+ opts[:xtrace] ||= ''
72
+ opts['X-TV-Meta'] ||= ''
73
+ Oboe::Context.sampleRequest(opts[:layer], opts[:xtrace], opts['X-TV-Meta'])
78
74
  end
79
75
 
80
- def start?
81
- not Oboe::Context.isValid and Oboe.always?
82
- end
83
-
84
76
  def through?
85
77
  Oboe::Config[:tracing_mode] == "through"
86
78
  end
@@ -16,4 +16,14 @@ Gem::Specification.new do |s|
16
16
  s.test_files = Dir.glob("{spec}/**/*.rb")
17
17
  s.add_development_dependency 'rake'
18
18
  s.add_development_dependency 'rspec'
19
+
20
+ s.post_install_message = "
21
+
22
+ This oboe gem requires updated AppNeta liboboe (>= 1.1.1) and
23
+ tracelytics-java-agent packages (if using JRuby). Make sure to update all
24
+ of your hosts or this gem will just sit in the corner and weep quietly.
25
+
26
+ - Your Friendly AppNeta TraceView Team
27
+
28
+ "
19
29
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oboe
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 1
9
- - 3
10
- version: 2.1.3
9
+ - 4
10
+ version: 2.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tracelytics, Inc.
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-07-11 00:00:00 Z
18
+ date: 2013-08-01 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rake
@@ -55,6 +55,7 @@ extra_rdoc_files:
55
55
  - LICENSE
56
56
  files:
57
57
  - .gitignore
58
+ - CHANGELOG
58
59
  - Gemfile
59
60
  - Gemfile.lock
60
61
  - Guardfile
@@ -63,6 +64,9 @@ files:
63
64
  - Rakefile
64
65
  - ext/oboe_metal/extconf.rb
65
66
  - ext/oboe_metal/noop/noop.c
67
+ - ext/oboe_metal/src/bson/bson.h
68
+ - ext/oboe_metal/src/bson/platform_hacks.h
69
+ - ext/oboe_metal/src/oboe.h
66
70
  - ext/oboe_metal/src/oboe.hpp
67
71
  - ext/oboe_metal/src/oboe_wrap.cxx
68
72
  - ext/oboe_metal/tests/test.rb
@@ -121,7 +125,15 @@ files:
121
125
  homepage: http://tracelytics.com
122
126
  licenses: []
123
127
 
124
- post_install_message:
128
+ post_install_message: |+
129
+
130
+
131
+ This oboe gem requires updated AppNeta liboboe (>= 1.1.1) and
132
+ tracelytics-java-agent packages (if using JRuby). Make sure to update all
133
+ of your hosts or this gem will just sit in the corner and weep quietly.
134
+
135
+ - Your Friendly AppNeta TraceView Team
136
+
125
137
  rdoc_options: []
126
138
 
127
139
  require_paths: