oboe-heroku 0.9.16.1 → 0.9.17.3

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: bc6c39cb8e4cc43a47e7efbe89d3a8094f32640e
4
- data.tar.gz: d1d5f2fe48c8143d07055e9616c030553b7dae3c
3
+ metadata.gz: 44fb09878a1844337597bbd10291f887293e3558
4
+ data.tar.gz: 8a251a5e9e3c1c52396726c9671ab2c5ad3fc1fd
5
5
  SHA512:
6
- metadata.gz: df68a3e633f1464ff52e27815857dd6200282c4a805a4704bab14231218ea949c051d77f952d88e13eace53e0fe03cf5f3c3d078b173abaf89f80b49ab4afa36
7
- data.tar.gz: 42322e7bf47284592a572761f7a8ffef1af8bd3147e07e93c0b1ec97571b7930c418569821f0460cf48d2869647630976a2708db1abd7d5c6df3cfcf77531c91
6
+ metadata.gz: 1f4752f07ae1be38a7283fd77e37c573d89745422b561cc18aead3dad60f1d4d0dd46529bf5ee96ee48995265e8e292ca1184ad1f2516e34b5c1600024361d94
7
+ data.tar.gz: 5d38de87fdcf816d9f1bff92fb63beb29c05d7e69ed9ba4c5b6a87e11326aa7ebf459ad0e8689987e4f960dbc1c7bc0498fbc21c85ed1521cb7d04908ba0ffb0
data/HEROKU_README.md ADDED
@@ -0,0 +1,262 @@
1
+ <!---
2
+ The origin for this document is: https://github.com/tracelytics/oboe-ruby-heroku/blob/master/HEROKU_README.md
3
+ -->
4
+ ![Ruby TraceView](https://s3.amazonaws.com/pglombardo/oboe-ruby-header.png)
5
+
6
+ [TraceView](http://addons.heroku.com/traceview) is an
7
+ [add-on](http://addons.heroku.com) for full-stack application
8
+ performance insight.
9
+
10
+ Adding TraceView to an application provides deep performance monitoring.
11
+
12
+ * Understand application architecture, and issues’ root cause, in a
13
+ single glance.
14
+ * Isolate interesting calls and drill down to line of code and dyno it
15
+ ran on.
16
+ * Drill down on spikes in latency, even if the cause is only a single
17
+ outlying request.
18
+
19
+ TraceView is integrated tightly with Heroku for easy access via your
20
+ Heroku account and supports Ruby-based applications on Heroku.
21
+ (Elsewhere, we also support Java, PHP, and Python.)
22
+
23
+ __Note: Our addon currently has an issue on the Heroku `cedar-14` stack where no performance metrics are generated. Users on the Heroku `cedar` stack are unaffected. We're working on this issue and plan to have a fix out soon. If you have any questions, please open a support ticket or contact us directly at traceviewsupport@appneta.com.__
24
+
25
+ ## Provisioning the add-on
26
+
27
+ TraceView can be added to your application via the [add-on marketplace](https://addons.heroku.com/traceview), or via the CLI.
28
+
29
+ ### CLI
30
+ TraceView can be added to a Heroku application via the CLI:
31
+
32
+ A list of all plans available can be found
33
+ [here](http://addons.heroku.com/traceview).
34
+
35
+ $ heroku addons:add traceview:beaker
36
+ -----> Adding traceview to sharp-mountain-4005... done, v18 (free)
37
+
38
+ After adding TraceView add-on to the application, it should be
39
+ configured to fully integrate with the add-on.
40
+
41
+ ## Using with Rails 2.3 - 4.x
42
+
43
+ Ruby on Rails applications will need to add the following entry into
44
+ their `Gemfile` specifying the TraceView instrumentation gem.
45
+
46
+ gem 'oboe-heroku'
47
+
48
+ Update application dependencies with bundler.
49
+
50
+ $ bundle install
51
+ $ git commit -am "Update Gemfile for Appneta's TraceView addon."
52
+ $ git push heroku master
53
+
54
+ And that's it!
55
+
56
+ _Note: If you're running a forking webserver such as Unicorn, remember
57
+ that there is an [extra step](#forking-webservers)!_
58
+
59
+ ## Using with Sinatra
60
+
61
+ You can instrument your Sinatra application by adding the
62
+ following code to your `config.ru` Rackup file:
63
+
64
+ ```ruby
65
+ # If you're not using Bundler.require. Make sure this
66
+ # is done after the Sinatra require directive.
67
+ require 'oboe-heroku'
68
+
69
+ # You may want to replace the Oboe.logger with whichever
70
+ # logger you are using
71
+ # Oboe.logger = Sinatra.logger
72
+ ```
73
+
74
+ Make sure that the oboe gem is loaded _after_ Sinatra either by listing
75
+ `gem 'oboe-heroku'` after Sinatra in your Gemfile or calling the
76
+ `require 'oboe-heroku'` directive after Sinatra is loaded.
77
+
78
+ With this, the oboe-heroku gem will automatically detect Sinatra on boot
79
+ and instrument key components.
80
+
81
+ _Note: If you're running a forking webserver such as Unicorn, remember
82
+ that there is an [extra step](#forking-webservers)!_
83
+
84
+ ## Using with Padrino
85
+
86
+ As long as the oboe-heroku gem is in your `Gemfile` (inserted after the
87
+ `gem 'padrino'` directive) and you are calling `Bundler.require`, the
88
+ oboe-heroku gem will automatically instrument Padrino applications.
89
+
90
+ If you need to set `Oboe::Config` values on stack boot, you can do so by
91
+ adding the following to your `config/boot.rb` file:
92
+
93
+ ```ruby
94
+ Padrino.before_load do
95
+ # The oboe Ruby client has the ability to sanitize
96
+ # query literals from SQL statements. By default
97
+ # this is disabled. Enable to avoid collecting and
98
+ # reporting query literals to TraceView.
99
+ # Oboe::Config[:sanitize_sql] = true
100
+
101
+ # Verbose output
102
+ Oboe::Config[:verbose] = true
103
+ end
104
+ ```
105
+ _Note: If you're running a forking webserver such as Unicorn, remember
106
+ that there is an [extra step](#forking-webservers)!_
107
+
108
+ ## Need to profile a custom bit of code?
109
+
110
+ The TraceView Ruby instrumentation offers the ability to profile any
111
+ arbitrary block of code using the following code pattern:
112
+
113
+ ```ruby
114
+ # A layer name that will identify this performance
115
+ # data in the TraceView dashboard
116
+ layer = "code_block_1"
117
+
118
+ # You can report any related data by populating
119
+ # a hash with key-value pairs
120
+ report_kvs = { :id => @id }
121
+
122
+ Oboe::API.trace(layer, nil, report_kvs) do
123
+ x = "This is a string"
124
+ y = x.reverse
125
+ z = y.reverse
126
+ puts z
127
+ end
128
+ ```
129
+
130
+ More details can be found
131
+ [here](https://github.com/appneta/oboe-ruby#custom-tracing).
132
+
133
+ ## Accessing the TraceView Dashboard
134
+
135
+ TraceView collects performance information about your application, then
136
+ makes it available in real-time. To see the data, you can head to your
137
+ [Heroku app manager](http://heroku.com/myapps), or use the CLI.
138
+
139
+ ### Heroku app manager
140
+
141
+ Simply visit the [Heroku apps web interface](http://heroku.com/myapps)
142
+ and selecting the application in question. Select TraceView from the
143
+ Add-ons menu.
144
+
145
+ ### CLI
146
+
147
+ To open TraceView from your Heroku CLI tools:
148
+
149
+ $ heroku addons:open traceview
150
+ Opening traceview for sharp-mountain-4005...
151
+
152
+ ## Forking Webservers
153
+
154
+ ### Unicorn
155
+
156
+ If you are using the TraceView add-on with Unicorn, you should add the
157
+ `preload_app true` directive in your Unicorn configuration file or
158
+ TraceView may not be able to fully initialize and instrument your
159
+ application.
160
+
161
+ You should also add in before and after hooks so that TraceView can
162
+ instrument properly after a fork operation. This involves simply
163
+ calling `::Oboe.disconnect!` and `::Oboe.reconnect!` in the
164
+ `before_fork` and `after_fork` hooks respectively.
165
+
166
+ An example Unicorn configuration file can be found in this Github
167
+ [gist](https://gist.github.com/pglombardo/5884933).
168
+
169
+ ## Deploy Hooks
170
+
171
+ To help understand the correlation between system events and performance
172
+ trends, TraceView provides the ability to log arbitrary events to your
173
+ TraceView dashboard. You can use Heroku’s [Deploy Hooks add-on](https://addons.heroku.com/deployhooks) to automatically log
174
+ deployment annotations in TraceView every time you push new code to
175
+ Heroku.
176
+
177
+ See [this post](http://www.appneta.com/blog/heroku-deployment-hook/) for
178
+ details on how to quickly add this functionality to your
179
+ Heroku/TraceView application.
180
+
181
+ ## Troubleshooting
182
+
183
+ Having trouble getting set up with TraceView? Not seeing something you
184
+ expected, or seeing something you didn't? Here's three ways to get
185
+ help:
186
+
187
+ * The TraceView [Knowledge Base](http://support.tv.appneta.com) has
188
+ documentation covering the [Ruby instrumentation and common
189
+ questions](https://support.tv.appneta.com/support/solutions/articles/86393-installing-ruby-instrumentation-for-ruby-rails-sinatra-or).
190
+ * You can reach our support engineers via email or IRC:
191
+ [traceviewsupport@appneta.com](mailto:traceviewsupport@appneta.com) or
192
+ on Freenode at #appneta .
193
+ * TraceView Ruby instrumentation is open-source! Contact us on
194
+ [Github](https://github.com/appneta/oboe-ruby), browse the code, view
195
+ commit history and/or file an issue in our [oboe-ruby repository](https://github.com/appneta/oboe-ruby/issues).
196
+
197
+ To double-check that the add-on is installed, you can run the `heroku
198
+ addons` CLI command for your application:
199
+
200
+ ```sh
201
+ $ heroku addons
202
+ === pwpush Configured Add-ons
203
+ traceview:einstein
204
+ ```
205
+
206
+ ## Selecting the right TraceView plan
207
+
208
+ ![Solvay Conference
209
+ 1927](https://s3.amazonaws.com/pglombardo/salvay-conference-1927.png)
210
+
211
+ TraceView plans are based on the number of dynos being monitored. The
212
+ plans start with the free Beaker plan (up to 3 dynos), which is
213
+ full-featured except for limited data retention (1 hour) and no
214
+ alerting. The other plans, named for scientists more famous (or at
215
+ least more professional) than
216
+ [Beaker](http://en.wikipedia.org/wiki/Beaker_\(Muppet\)) are
217
+ full-featured with 45 days of data retention and alerting.
218
+
219
+ The plans are priced based on the number of dynos your application uses.
220
+ We provide a number of tiers of service, each covering up to a certain
221
+ number of dynos. You can match up the number of dynos your application
222
+ uses to find the appropriate plan tier.
223
+
224
+ **If you're autoscaling, or wish to monitor a large number of dynos,
225
+ please [contact us](mailto:traceview@appneta.com) - we have plans for
226
+ that.**
227
+
228
+ Full plan descriptions are available on the [add-on page](http://addons.heroku.com/traceview).
229
+
230
+ Section [image source](https://en.wikipedia.org/wiki/File:Solvay_conference_1927.jpg).
231
+
232
+ ### Migrating plans
233
+
234
+ As you adjust the number of dynos your application uses, you may wish to
235
+ upgrade or downgrade your TraceView plan.
236
+
237
+ Use the `heroku addons:upgrade` command to migrate to a new plan.
238
+
239
+ $ heroku addons:upgrade traceview:feynman
240
+ -----> Upgrading traceview:feynman to sharp-mountain-4005... done, v18 ($49/mo)
241
+ Your plan has been updated to: traceview:enterprise
242
+
243
+ ## Removing the add-on
244
+
245
+ TraceView can be removed via the CLI.
246
+
247
+ $ heroku addons:remove traceview
248
+ -----> Removing traceview from sharp-mountain-4005... done, v20 (free)
249
+
250
+ **Your TraceView data will only be available for a short time after
251
+ add-on removal. Re-adding the add-on will re-enable access.**
252
+
253
+ Before removing TraceView you can export collected performance data
254
+ using the [Data API](http://dev.appneta.com/docs/api-v2/).
255
+
256
+ ## Support
257
+
258
+ Any support issues or product feedback? Reach out via email or IRC:
259
+ [traceviewsupport@appneta.com](mailto:traceviewsupport@appneta.com) or
260
+ on Freenode at #appneta . Documentation is available at [TraceView Support](http://support.tv.appneta.com/)
261
+ and in the [Github repository](https://github.com/appneta/oboe-ruby).
262
+
data/lib/oboe-heroku.rb CHANGED
@@ -1,13 +1,16 @@
1
1
  # Copyright (c) 2013 by Tracelytics, Inc.
2
2
  # All rights reserved.
3
3
 
4
+ module OboeHeroku; end
5
+
4
6
  begin
7
+ require "oboe-heroku/thread_local"
8
+ require 'oboe-heroku/base'
9
+
5
10
  # TRACEVIEW_URL env var is standard with the Heroku addon. We
6
11
  # use it to determine if we are actually running in Heroku or not.
7
- if ENV.has_key?('TRACEVIEW_URL') and ENV['RAILS_GROUP'] != 'assets'
12
+ if ENV.key?('TRACEVIEW_URL')
8
13
 
9
- require "oboe-heroku/thread_local"
10
- require 'oboe-heroku/base'
11
14
  require 'oboe_metal.so'
12
15
  require 'heroku_metal'
13
16
 
@@ -20,15 +23,15 @@ begin
20
23
  ::OboeHeroku::Loading.configure if Oboe.loaded
21
24
  end
22
25
  rescue LoadError => e
23
- Oboe.loaded = false
24
26
  $stderr.puts "[oboe-heroku/error] Failed to load support libs: #{e.message}"
27
+ Oboe.loaded = false
25
28
 
26
29
  if ENV.has_key?('TRACEVIEW_DEBUG_LEVEL') and (ENV['TRACEVIEW_DEBUG_LEVEL'].to_i > 1)
27
30
  $stderr.puts e.backtrace.join("\n")
28
31
  end
29
32
  rescue Exception => e
30
- Oboe.loaded = false
31
33
  $stderr.puts "[oboe-heroku/error] #{e.message}"
34
+ Oboe.loaded = false
32
35
 
33
36
  if ENV.has_key?('TRACEVIEW_DEBUG_LEVEL') and (ENV['TRACEVIEW_DEBUG_LEVEL'].to_i > 1)
34
37
  $stderr.puts e.backtrace.join("\n")
@@ -30,16 +30,84 @@ module OboeBase
30
30
  extend ::Oboe::ThreadLocal
31
31
 
32
32
  attr_accessor :reporter
33
- attr_accessor :collector
34
33
  attr_accessor :loaded
35
- thread_local :sample_source
36
- thread_local :sample_rate
37
- thread_local :layer_op
34
+ attr_accessor :sample_source
35
+ attr_accessor :sample_rate
36
+ thread_local :layer_op
38
37
 
39
- def self.included(_)
40
- self.loaded = true
38
+ # The following accessors indicate the incoming tracing state received
39
+ # by the rack layer. These are primarily used to identify state
40
+ # between the Ruby and JOboe instrumentation under JRuby.
41
+ #
42
+ # This is because that even though there may be an incoming
43
+ # X-Trace request header, tracing may have already been started
44
+ # by Joboe. Such a scenario occurs when the application is being
45
+ # hosted by a Java container (such as Tomcat or Glassfish) and
46
+ # JOboe has already initiated tracing. In this case, we shouldn't
47
+ # pickup the X-Trace context in the X-Trace header and we shouldn't
48
+ # set the outgoing response X-Trace header or clear context.
49
+ # Yeah I know. Yuck.
50
+
51
+ # Occurs only on Jruby. Indicates that Joboe (the java instrumentation)
52
+ # has already started tracing before it hit the JRuby instrumentation.
53
+ thread_local :has_incoming_context
54
+
55
+ # Indicates the existence of a valid X-Trace request header
56
+ thread_local :has_xtrace_header
57
+
58
+ # This indicates that this trace was continued from
59
+ # an incoming X-Trace request header or in the case
60
+ # of JRuby, a trace already started by JOboe.
61
+ thread_local :is_continued_trace
62
+
63
+ ##
64
+ # extended
65
+ #
66
+ # Invoked when this module is extended.
67
+ # e.g. extend OboeBase
68
+ #
69
+ def self.extended(cls)
70
+ cls.loaded = true
71
+
72
+ # This gives us pretty accessors with questions marks at the end
73
+ # e.g. is_continued_trace --> is_continued_trace?
74
+ Oboe.methods.select{ |m| m =~ /^is_|^has_/ }.each do |c|
75
+ unless c =~ /\?$|=$/
76
+ # Oboe.logger.debug "aliasing #{c}? to #{c}"
77
+ alias_method "#{c}?", c
78
+ end
79
+ end
41
80
  end
42
81
 
82
+ ##
83
+ # pickup_context
84
+ #
85
+ # Determines whether we should pickup context
86
+ # from an incoming X-Trace request header. The answer
87
+ # is generally yes but there are cases in JRuby under
88
+ # Tomcat (or Glassfish etc.) where tracing may have
89
+ # been already started by the Java instrumentation (Joboe)
90
+ # in which case we don't want to do this.
91
+ #
92
+ def pickup_context?(xtrace)
93
+ return false unless Oboe::XTrace.valid?(xtrace)
94
+
95
+ if defined?(JRUBY_VERSION) && Oboe.tracing?
96
+ return false
97
+ else
98
+ return true
99
+ end
100
+ end
101
+
102
+ ##
103
+ # tracing_layer_op?
104
+ #
105
+ # Queries the thread local variable about the current
106
+ # operation being traced. This is used in cases of recursive
107
+ # operation tracing or one instrumented operation calling another.
108
+ #
109
+ # In such cases, we only want to trace the outermost operation.
110
+ #
43
111
  def tracing_layer_op?(operation)
44
112
  if operation.is_a?(Array)
45
113
  return operation.include?(Oboe.layer_op)
@@ -96,7 +164,7 @@ module OboeBase
96
164
  end
97
165
 
98
166
  def heroku?
99
- ENV['TRACEVIEW_URL']
167
+ ENV.key?('TRACEVIEW_URL')
100
168
  end
101
169
 
102
170
  ##
@@ -138,3 +206,4 @@ end
138
206
  module Oboe
139
207
  extend OboeBase
140
208
  end
209
+
@@ -5,9 +5,9 @@ module OboeHeroku
5
5
  # OBOE_TRACE_NEVER 0
6
6
  # OBOE_TRACE_ALWAYS 1
7
7
  # OBOE_TRACE_THROUGH 2
8
-
8
+
9
9
  if defined?(Oboe::Config)
10
-
10
+
11
11
  case Oboe::Config[:tracing_mode].to_s.downcase.to_sym
12
12
  when :never
13
13
  # OBOE_TRACE_NEVER
@@ -2,8 +2,8 @@ module OboeHeroku
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 9
5
- PATCH = 16
6
- BUILD = 1
5
+ PATCH = 17
6
+ BUILD = 3
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
9
9
  end
data/oboe-heroku.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.extensions = ['ext/oboe_metal/extconf.rb']
22
22
 
23
- s.add_dependency(%q<oboe>, [">= 2.7.2.2"])
23
+ s.add_dependency(%q<oboe>, [">= 2.7.6.2"])
24
24
 
25
25
  s.add_development_dependency 'rake', '>= 0'
26
26
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oboe-heroku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.16.1
4
+ version: 0.9.17.3
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-09-26 00:00:00.000000000 Z
12
+ date: 2014-12-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oboe
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 2.7.2.2
20
+ version: 2.7.6.2
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 2.7.2.2
27
+ version: 2.7.6.2
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -51,6 +51,7 @@ files:
51
51
  - ".gitignore"
52
52
  - Gemfile
53
53
  - Gemfile.lock
54
+ - HEROKU_README.md
54
55
  - LICENSE
55
56
  - README.md
56
57
  - Rakefile
@@ -110,4 +111,3 @@ signing_key:
110
111
  specification_version: 4
111
112
  summary: AppNeta TraceView performance instrumentation gem for the Heroku platform
112
113
  test_files: []
113
- has_rdoc: