oboe-heroku 0.8.0.27.beta2 → 0.9.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fa6cde0325de70e2f6e7218a1c9f4268f136834a
4
+ data.tar.gz: 38e42a03e506dc439db13cc4ef2535d1dacef956
5
+ SHA512:
6
+ metadata.gz: 35790a7bb3634e1750299e97451bea1f3be21853dac3d9cd94ed0cfe2dff50d448a6a4fc445e6d7a3cf222d22e783d5b215fe501ad0bb44d286a1a6b9fcceed6
7
+ data.tar.gz: 9365f4ac4a3c1942e9d512a28811c62b8200ad4567f69c83f866de7faf894b0ed21f1940aa7030f02f4479ec9f489da12dd00610caa6ab3e7160f069e734812c
data/lib/base.rb ADDED
@@ -0,0 +1,58 @@
1
+ # Copyright (c) 2013 AppNeta, Inc.
2
+ # All rights reserved.
3
+
4
+ module OboeBase
5
+ attr_accessor :reporter
6
+ attr_accessor :loaded
7
+
8
+ def self.included(cls)
9
+ self.loaded = true
10
+ end
11
+
12
+ def always?
13
+ Oboe::Config[:tracing_mode].to_s == "always"
14
+ end
15
+
16
+ def never?
17
+ Oboe::Config[:tracing_mode].to_s == "never"
18
+ end
19
+
20
+ def passthrough?
21
+ ["always", "through"].include?(Oboe::Config[:tracing_mode])
22
+ end
23
+
24
+ def through?
25
+ Oboe::Config[:tracing_mode] == "through"
26
+ end
27
+
28
+ def tracing?
29
+ return false unless Oboe.loaded
30
+
31
+ Oboe::Context.isValid and not Oboe.never?
32
+ end
33
+
34
+ def log(layer, label, options = {})
35
+ Context.log(layer, label, options = options)
36
+ end
37
+
38
+ ##
39
+ # These methods should be implemented by the descendants
40
+ # (Oboe_metal, Oboe_metal (JRuby), Heroku_metal)
41
+ #
42
+ def sample?(opts = {})
43
+ raise "sample? should be implemented by metal layer."
44
+ end
45
+
46
+ def log(layer, label, options = {})
47
+ raise "log should be implemented by metal layer."
48
+ end
49
+
50
+ def set_tracing_mode(mode)
51
+ raise "set_tracing_mode should be implemented by metal layer."
52
+ end
53
+
54
+ def set_sample_rate(rate)
55
+ raise "set_sample_rate should be implemented by metal layer."
56
+ end
57
+ end
58
+
data/lib/heroku_metal.rb CHANGED
@@ -1,20 +1,14 @@
1
1
  # Copyright (c) 2013 AppNeta
2
2
  # All rights reserved.
3
3
 
4
- module Oboe_metal
5
- class Event
6
- def self.metadataString(evt)
7
- evt.metadataString()
8
- end
9
- end
4
+ require 'base'
10
5
 
6
+ module Oboe_metal
11
7
  class Context
12
8
  class << self
13
9
  attr_accessor :layer_op
14
-
15
- def log(layer, label, options = {}, with_backtrace = true)
16
- Oboe.logger.debug "HerokuMetal log: layer: #{layer}, label: #{label}, options: #{options}, with_backtrace: #{with_backtrace.to_s}"
17
-
10
+
11
+ def log(layer, label, options = {}, with_backtrace = false)
18
12
  evt = Oboe::Context.createEvent()
19
13
  evt.addInfo("Layer", layer.to_s)
20
14
  evt.addInfo("Label", label.to_s)
@@ -24,9 +18,10 @@ module Oboe_metal
24
18
  end
25
19
 
26
20
  evt.addInfo("Backtrace", Oboe::API.backtrace) if with_backtrace
21
+
27
22
  Oboe.reporter.sendReport(evt)
28
23
  end
29
-
24
+
30
25
  def tracing_layer_op?(operation)
31
26
  if operation.is_a?(Array)
32
27
  return operation.include?(@layer_op)
@@ -37,6 +32,12 @@ module Oboe_metal
37
32
  end
38
33
  end
39
34
 
35
+ class Event
36
+ def self.metadataString(evt)
37
+ evt.metadataString()
38
+ end
39
+ end
40
+
40
41
  class Reporter
41
42
  ##
42
43
  # Initialize the Oboe Context, reporter and report the initialization
@@ -62,24 +63,12 @@ module Oboe_metal
62
63
  end
63
64
  end
64
65
 
65
- module Oboe
66
+ module Oboe
67
+ extend OboeBase
66
68
  include Oboe_metal
67
69
 
68
70
  class << self
69
- attr_accessor :reporter
70
-
71
- def always?
72
- Oboe::Config[:tracing_mode].to_s == "always"
73
- end
74
-
75
- def never?
76
- Oboe::Config[:tracing_mode].to_s == "never"
77
- end
78
71
 
79
- def passthrough?
80
- ["always", "through"].include?(Oboe::Config[:tracing_mode])
81
- end
82
-
83
72
  def sample?(opts = {})
84
73
  # Assure defaults since SWIG enforces Strings
85
74
  opts[:layer] ||= ''
@@ -87,25 +76,48 @@ module Oboe
87
76
  opts['TV-Meta'] ||= ''
88
77
  Oboe::Context.sampleRequest(opts[:layer], opts[:xtrace], opts['TV-Meta'])
89
78
  end
90
-
91
- def through?
92
- Oboe::Config[:tracing_mode] == "through"
79
+
80
+ def set_tracing_mode(mode)
81
+ return unless Oboe.loaded
82
+
83
+ value = mode.to_sym
84
+
85
+ case value
86
+ when :never
87
+ # OBOE_TRACE_NEVER
88
+ Oboe::Context.setTracingMode(0)
89
+ when :always
90
+ # OBOE_TRACE_ALWAYS
91
+ Oboe::Context.setTracingMode(1)
92
+ when :through
93
+ # OBOE_TRACE_THROUGH
94
+ Oboe::Context.setTracingMode(2)
95
+ else
96
+ Oboe.logger.fatal "[oboe/error] Invalid tracing mode set: #{mode}"
97
+ # OBOE_TRACE_ALWAYS
98
+ Oboe::Context.setTracingMode(1)
99
+ end
93
100
  end
94
-
95
- def tracing?
96
- Oboe::Context.isValid and not Oboe.never?
101
+
102
+ def set_sample_rate(rate)
103
+ if Oboe.loaded
104
+ # Update liboboe with the new SampleRate value
105
+ Oboe::Context.setDefaultSampleRate(rate.to_i)
106
+ end
97
107
  end
98
108
 
99
109
  # Disconnect/Reconnect wrappers used for forking webservers
100
110
  # such as Unicorn or Passenger
101
111
  #
102
112
  def disconnect!
103
- ::Oboe::Context.disconnect(::Oboe.reporter)
113
+ ::Oboe::Context.disconnect(::Oboe.reporter) if Oboe.loaded
104
114
  end
105
115
 
106
116
  def reconnect!
107
- ::Oboe::Context.reconnect(::Oboe.reporter)
117
+ ::Oboe::Context.reconnect(::Oboe.reporter) if Oboe.loaded
108
118
  end
109
119
  end
110
120
  end
111
121
 
122
+ Oboe.loaded = true
123
+
@@ -1,9 +1,9 @@
1
1
  module OboeHeroku
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 8
4
+ MINOR = 9
5
5
  PATCH = 0
6
- BUILD = "27.beta2"
6
+ BUILD = 1
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
9
9
  end
data/lib/oboe-heroku.rb CHANGED
@@ -3,8 +3,16 @@
3
3
 
4
4
  begin
5
5
  if ENV.has_key?('TRACEVIEW_URL')
6
- require 'oboe_metal.so'
7
- require 'heroku_metal'
6
+ begin
7
+ require 'heroku_metal'
8
+ require 'oboe_metal.so'
9
+ rescue LoadError => e
10
+ if ENV.has_key?('TRACEVIEW_DEBUG_LEVEL') and (ENV['TRACEVIEW_DEBUG_LEVEL'].to_i > 1)
11
+ $stderr.puts "[oboe-heroku/error] Could not load oboe-heroku dependencies: #{e.message}"
12
+ $stderr.puts e.backtrace.join("\n")
13
+ end
14
+ end
15
+
8
16
  require 'oboe-heroku/loading'
9
17
  require 'oboe-heroku/version'
10
18
 
@@ -13,11 +21,8 @@ begin
13
21
 
14
22
  ::OboeHeroku::Loading.initialize
15
23
  end
16
- rescue LoadError
17
- if ENV.has_key?('TRACEVIEW_DEBUG_LEVEL') and (ENV['TRACEVIEW_DEBUG_LEVEL'].to_i > 1)
18
- $stderr.puts "[oboe-heroku/error] Could not load oboe-heroku dependencies."
19
- end
20
24
  rescue Exception => e
21
- $stderr.puts "[oboe-heroku/error] Problem loading: #{e.inspect}"
25
+ $stderr.puts "[oboe-heroku/error] Problem loading: #{e.message}"
22
26
  $stderr.puts e.backtrace.join("\n")
23
27
  end
28
+
data/oboe-heroku.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.extensions = ['ext/oboe_metal/extconf.rb']
20
20
 
21
- s.add_dependency(%q<oboe>, [">= 2.3.2"])
21
+ s.add_dependency(%q<oboe>, [">= 2.3.3.7"])
22
22
 
23
23
  s.add_development_dependency 'rake'
24
24
  s.add_development_dependency 'rspec'
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oboe-heroku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0.27.beta2
5
- prerelease: 9
4
+ version: 0.9.0.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Peter Giacomo Lombardo
@@ -10,54 +9,48 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-10-28 00:00:00.000000000 Z
12
+ date: 2013-11-19 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: oboe
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ! '>='
18
+ - - '>='
21
19
  - !ruby/object:Gem::Version
22
- version: 2.3.2
20
+ version: 2.3.3.7
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
- - - ! '>='
25
+ - - '>='
29
26
  - !ruby/object:Gem::Version
30
- version: 2.3.2
27
+ version: 2.3.3.7
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: rake
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
- - - ! '>='
32
+ - - '>='
37
33
  - !ruby/object:Gem::Version
38
34
  version: '0'
39
35
  type: :development
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
- - - ! '>='
39
+ - - '>='
45
40
  - !ruby/object:Gem::Version
46
41
  version: '0'
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: rspec
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
- - - ! '>='
46
+ - - '>='
53
47
  - !ruby/object:Gem::Version
54
48
  version: '0'
55
49
  type: :development
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
- - - ! '>='
53
+ - - '>='
61
54
  - !ruby/object:Gem::Version
62
55
  version: '0'
63
56
  description: The oboe-heroku gem provides TraceView instrumentation for Ruby and Ruby
@@ -98,6 +91,7 @@ files:
98
91
  - ext/oboe_metal/src/oboe/oboe.h
99
92
  - ext/oboe_metal/src/oboe/oboe_debug.h
100
93
  - ext/oboe_metal/src/oboe_wrap.cxx
94
+ - lib/base.rb
101
95
  - lib/heroku_metal.rb
102
96
  - lib/oboe-heroku.rb
103
97
  - lib/oboe-heroku/loading.rb
@@ -106,26 +100,25 @@ files:
106
100
  - tasks/.keep
107
101
  homepage: http://www.appneta.com/application-performance-management
108
102
  licenses: []
103
+ metadata: {}
109
104
  post_install_message:
110
105
  rdoc_options: []
111
106
  require_paths:
112
107
  - lib
113
108
  required_ruby_version: !ruby/object:Gem::Requirement
114
- none: false
115
109
  requirements:
116
- - - ! '>='
110
+ - - '>='
117
111
  - !ruby/object:Gem::Version
118
112
  version: '0'
119
113
  required_rubygems_version: !ruby/object:Gem::Requirement
120
- none: false
121
114
  requirements:
122
- - - ! '>'
115
+ - - '>='
123
116
  - !ruby/object:Gem::Version
124
- version: 1.3.1
117
+ version: '0'
125
118
  requirements: []
126
119
  rubyforge_project:
127
- rubygems_version: 1.8.24
120
+ rubygems_version: 2.0.3
128
121
  signing_key:
129
- specification_version: 3
122
+ specification_version: 4
130
123
  summary: AppNeta TraceView performance instrumentation gem for the Heroku platform
131
124
  test_files: []