oboe 2.1.1 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -1,4 +1,199 @@
1
- Copyright (c) 2012 Tracelytics, Inc. All Rights Reserved. The
2
- software made available to you by Tracelytics, Inc. and/or through
3
- your use of tracelytics.com is licensed pursuant to the Terms of
4
- Service: http://www.tracelytics.com/terms-of-service/
1
+ AppNeta Open License, Version 1.0
2
+
3
+ AppNeta Open License
4
+ Version 1.0, April, 2013
5
+
6
+ http://www.appneta.com/appneta-license
7
+
8
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
9
+
10
+ 1. Definitions.
11
+
12
+ "License" shall mean the terms and conditions for use, reproduction, and
13
+ distribution as defined by Sections 1 through 11 of this document.
14
+
15
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
16
+ owner that is granting the License. Licensor can include AppNeta as an
17
+ original contributor to the Work as defined below.
18
+
19
+ "Legal Entity" shall mean the union of the acting entity and all other entities
20
+ that control, are controlled by, or are under common control with that entity.
21
+ For the purposes of this definition, "control" means (i) the power, direct or
22
+ indirect, to cause the direction or management of such entity, whether by
23
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
24
+ outstanding shares, or (iii) beneficial ownership of such entity.
25
+
26
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
27
+ permissions granted by this License.
28
+
29
+ "Source" form shall mean the preferred form for making modifications, including
30
+ but not limited to software source code, documentation source, and
31
+ configuration files.
32
+
33
+ "Object" form shall mean any form resulting from mechanical transformation or
34
+ translation of a Source form, including but not limited to compiled object
35
+ code, generated documentation, and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or Object form,
38
+ made available under the License, as indicated by a copyright notice that is
39
+ included in or attached to the work (an example is provided in the Appendix
40
+ below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
43
+ is based on (or derived from) the Work and for which the editorial revisions,
44
+ annotations, elaborations, or other modifications represent, as a whole, an
45
+ original work of authorship. For the purposes of this License, Derivative Works
46
+ shall not include works that remain separable from, or merely link (or bind by
47
+ name) to the interfaces of, the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including the original
50
+ version of the Work and any modifications or additions to that Work or
51
+ Derivative Works thereof, that is intentionally submitted to Licensor for
52
+ inclusion in the Work by the copyright owner or by an individual or Legal
53
+ Entity authorized to submit on behalf of the copyright owner. For the purposes
54
+ of this definition, "submitted" means any form of electronic, verbal, or
55
+ written communication sent to the Licensor or its representatives, including
56
+ but not limited to communication on electronic mailing lists, source code
57
+ control systems, and issue tracking systems that are managed by, or on behalf
58
+ of, the Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise designated in
60
+ writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
63
+ of whom a Contribution has been received by Licensor and subsequently
64
+ incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License.
67
+
68
+ Subject to the terms and conditions of this License, each Contributor hereby
69
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
70
+ irrevocable copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the Work and
72
+ such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License.
75
+
76
+ Subject to the terms and conditions of this License, each Contributor hereby
77
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
78
+ irrevocable (except as stated in this section) patent license to make, have
79
+ made, use, offer to sell, sell, import, and otherwise transfer the Work, where
80
+ such license applies only to those patent claims licensable by such Contributor
81
+ that are necessarily infringed by their Contribution(s) alone or by combination
82
+ of their Contribution(s) with the Work to which such Contribution(s) was
83
+ submitted. If You institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work or a
85
+ Contribution incorporated within the Work constitutes direct or contributory
86
+ patent infringement, then any patent licenses granted to You under this License
87
+ for that Work shall terminate as of the date such litigation is filed.
88
+
89
+ Each time You convey a covered Work, the recipient automatically receives a
90
+ license from the original Licensor(s), to run, modify and propagate that work,
91
+ subject to this License. You are not responsible for enforcing compliance by
92
+ third parties with this License.
93
+
94
+ You may not impose any further restrictions on the exercise of the rights
95
+ granted or affirmed under this License. For example, you may not impose a
96
+ license fee, royalty, or other charge for exercise of rights granted under this
97
+ License, and you may not initiate litigation (including a cross-claim or
98
+ counterclaim in a lawsuit) alleging that any patent claim is infringed by
99
+ making, using, selling, offering for sale, or importing the Work or any portion
100
+ of it.
101
+
102
+ 4. Redistribution.
103
+
104
+ You may reproduce and distribute copies of the Work or Derivative Works thereof
105
+ in any medium, with or without modifications, and in Source or Object form,
106
+ provided that You meet the following conditions:
107
+
108
+ 1. You must give any other recipients of the Work or Derivative Works a copy
109
+ of this License; and
110
+ 2. You must cause any modified files to carry prominent notices stating that
111
+ You changed the files; and
112
+ 3. You must retain, in the Source form of any Derivative Works that You
113
+ distribute, all copyright, patent, trademark, and attribution notices from the
114
+ Source form of the Work, excluding those notices that do not pertain to any
115
+ part of the Derivative Works; and
116
+ 4. If the Work includes a "NOTICE" text file as part of its distribution,
117
+ then any Derivative Works that You distribute must include a readable copy of
118
+ the attribution notices contained within such NOTICE file, excluding those
119
+ notices that do not pertain to any part of the Derivative Works, in at least
120
+ one of the following places: within a NOTICE text file distributed as part of
121
+ the Derivative Works; within the Source form or documentation, if provided
122
+ along with the Derivative Works; or, within a display generated by the
123
+ Derivative Works, if and wherever such third-party notices normally appear. The
124
+ contents of the NOTICE file are for informational purposes only and do not
125
+ modify the License. You may add Your own attribution notices within Derivative
126
+ Works that You distribute, alongside or as an addendum to the NOTICE text from
127
+ the Work, provided that such additional attribution notices cannot be construed
128
+ as modifying the License.
129
+
130
+ You may add Your own copyright statement to Your modifications and may provide
131
+ additional or different license terms and conditions for use, reproduction, or
132
+ distribution of Your modifications, or for any such Derivative Works as a
133
+ whole, provided Your use, reproduction, and distribution of the Work otherwise
134
+ complies with the conditions stated in this License.
135
+
136
+ 5. Submission of Contributions.
137
+
138
+ Unless You explicitly state otherwise, any Contribution intentionally submitted
139
+ for inclusion in the Work by You to the Licensor shall be under the terms and
140
+ conditions of this License, without any additional terms or conditions.
141
+ Notwithstanding the above, nothing herein shall supersede or modify the terms
142
+ of any separate license agreement you may have executed with Licensor regarding
143
+ such Contributions.
144
+
145
+ 6. Trademarks.
146
+
147
+ This License does not grant permission to use the trade names, trademarks,
148
+ service marks, or product names of the Licensor, except as required for
149
+ reasonable and customary use in describing the origin of the Work and
150
+ reproducing the content of the NOTICE file.
151
+
152
+ 7. Disclaimer of Warranty.
153
+
154
+ Unless required by applicable law or agreed to in writing, Licensor provides
155
+ the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
156
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
157
+ including, without limitation, any warranties or conditions of TITLE,
158
+ NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
159
+ solely responsible for determining the appropriateness of using or
160
+ redistributing the Work and assume any risks associated with Your exercise of
161
+ permissions under this License.
162
+
163
+ 8. Limitation of Liability.
164
+
165
+ In no event and under no legal theory, whether in tort (including negligence),
166
+ contract, or otherwise, unless required by applicable law (such as deliberate
167
+ and grossly negligent acts) or agreed to in writing, shall any Contributor be
168
+ liable to You for damages, including any direct, indirect, special, incidental,
169
+ or consequential damages of any character arising as a result of this License
170
+ or out of the use or inability to use the Work (including but not limited to
171
+ damages for loss of goodwill, work stoppage, computer failure or malfunction,
172
+ or any and all other commercial damages or losses), even if such Contributor
173
+ has been advised of the possibility of such damages.
174
+
175
+ 9. Accepting Warranty or Additional Liability.
176
+
177
+ While redistributing the Work or Derivative Works thereof, You may choose to
178
+ offer, and charge a fee for, acceptance of support, warranty, indemnity, or
179
+ other liability obligations and/or rights consistent with this License.
180
+ However, in accepting such obligations, You may act only on Your own behalf and
181
+ on Your sole responsibility, not on behalf of any other Contributor, and only
182
+ if You agree to indemnify, defend, and hold each Contributor harmless for any
183
+ liability incurred by, or claims asserted against, such Contributor by reason
184
+ of your accepting any such warranty or additional liability.
185
+
186
+ 10. Noncompetition
187
+
188
+ You may install and execute the Work only in conjunction with the direct use of
189
+ AppNeta software. This Work, any file or any derivative thereof shall not be
190
+ used in conjunction with any product that competes with any AppNeta software.
191
+
192
+ 11. Termination
193
+
194
+ The License stated above is automatically terminated and revoked if you exceed
195
+ its scope or violate any of the terms of this License or any related License or
196
+ notice.
197
+
198
+ END OF TERMS AND CONDITIONS
199
+
@@ -27,6 +27,11 @@ module Oboe
27
27
  trim_backtrace(Kernel.caller).join("\r\n")
28
28
  end
29
29
 
30
+ # Internal: Trim a backtrace to a manageable size
31
+ #
32
+ # backtrace - the backtrace (an array of stack frames/from Kernel.caller)
33
+ #
34
+ # Returns a trimmed backtrace
30
35
  def trim_backtrace(backtrace)
31
36
  return backtrace unless backtrace.is_a?(Array)
32
37
 
@@ -39,6 +44,28 @@ module Oboe
39
44
  end
40
45
  trimmed
41
46
  end
47
+
48
+ # Internal: Check if a host is blacklisted from tracing
49
+ #
50
+ # addr_port - the addr_port from Net::HTTP although this method
51
+ # can be used from any component in reality
52
+ #
53
+ # Returns a boolean on blacklisted state
54
+ def blacklisted?(addr_port)
55
+ return false unless Oboe::Config.blacklist
56
+
57
+ # Ensure that the blacklist is an array
58
+ unless Oboe::Config.blacklist.is_a?(Array)
59
+ val = Oboe::Config[:blacklist]
60
+ Oboe::Config[:blacklist] = [ val.to_s ]
61
+ end
62
+
63
+ Oboe::Config.blacklist.each do |h|
64
+ return true if addr_port.to_s.match(h.to_s)
65
+ end
66
+
67
+ false
68
+ end
42
69
  end
43
70
  end
44
71
  end
@@ -30,6 +30,9 @@ module Oboe
30
30
  # (Default: false)
31
31
  @@config[:resque][:link_workers] = false
32
32
 
33
+ # Setup an empty host blacklist (see: Oboe::API::Util.blacklisted?)
34
+ @@config[:blacklist] = []
35
+
33
36
  update!(data)
34
37
  end
35
38
 
@@ -5,32 +5,38 @@ require 'net/http'
5
5
 
6
6
  Net::HTTP.class_eval do
7
7
  def request_with_oboe(*args, &block)
8
- unless started?
9
- return request_without_oboe(*args, &block)
8
+ unless started?
9
+ return request_without_oboe(*args, &block)
10
10
  end
11
11
 
12
- Oboe::API.trace('net-http') do
13
- opts = {}
14
- if args.length and args[0]
15
- req = args[0]
16
-
17
- opts['IsService'] = 1
18
- opts['RemoteProtocol'] = use_ssl? ? 'HTTPS' : 'HTTP'
19
- opts['RemoteHost'] = addr_port
20
- opts['ServiceArg'] = req.path
21
- opts['Method'] = req.method
22
-
23
- Oboe::API.log('net-http', 'info', opts)
24
- req['X-Trace'] = Oboe::Context.toString()
25
- end
26
-
27
- resp = request_without_oboe(*args, &block)
12
+ # Avoid cross host tracing for blacklisted domains
13
+ blacklisted = Oboe::API.blacklisted?(addr_port)
28
14
 
15
+ Oboe::API.trace('net-http') do
16
+ opts = {}
17
+ if args.length and args[0]
18
+ req = args[0]
19
+
20
+ opts['IsService'] = 1
21
+ opts['RemoteProtocol'] = use_ssl? ? 'HTTPS' : 'HTTP'
22
+ opts['RemoteHost'] = addr_port
23
+ opts['ServiceArg'] = req.path
24
+ opts['Method'] = req.method
25
+ opts['Blacklisted'] = true if blacklisted
26
+
27
+ Oboe::API.log('net-http', 'info', opts)
28
+ req['X-Trace'] = Oboe::Context.toString() unless blacklisted
29
+ end
30
+
31
+ resp = request_without_oboe(*args, &block)
32
+
33
+ unless blacklisted
29
34
  xtrace = resp.get_fields('X-Trace')
30
- if xtrace and xtrace.size and Oboe.tracing?
35
+ if xtrace and xtrace.size and Oboe.tracing?
31
36
  Oboe::Context.fromString(xtrace[0])
32
37
  end
33
- next resp
38
+ end
39
+ next resp
34
40
  end
35
41
  end
36
42
 
@@ -31,22 +31,29 @@ module Oboe
31
31
  end
32
32
 
33
33
  def self.load_access_key
34
- unless Oboe::Config.access_key
35
- config_file = '/etc/tracelytics.conf'
36
- return unless File.exists?(config_file)
37
-
38
- begin
39
- File.open(config_file).each do |line|
40
- if line =~ /^tracelyzer.access_key=/ or line =~ /^access_key/
41
- bits = line.split(/=/)
42
- Oboe::Config[:access_key] = bits[1].strip
43
- Oboe::Config[:rum_id] = Oboe::Util::Base64URL.encode(Digest::SHA1.digest("RUM" + Oboe::Config[:access_key]))
44
- break
34
+ begin
35
+ if ENV.has_key?('TRACEVIEW_CUUID')
36
+ # Preferably get access key from environment (e.g. Heroku)
37
+ Oboe::Config[:access_key] = ENV['TRACEVIEW_CUUID']
38
+ Oboe::Config[:rum_id] = Oboe::Util::Base64URL.encode(Digest::SHA1.digest("RUM" + Oboe::Config[:access_key]))
39
+ else
40
+ # ..else read from system-wide configuration file
41
+ unless Oboe::Config.access_key
42
+ config_file = '/etc/tracelytics.conf'
43
+ return unless File.exists?(config_file)
44
+
45
+ File.open(config_file).each do |line|
46
+ if line =~ /^tracelyzer.access_key=/ or line =~ /^access_key/
47
+ bits = line.split(/=/)
48
+ Oboe::Config[:access_key] = bits[1].strip
49
+ Oboe::Config[:rum_id] = Oboe::Util::Base64URL.encode(Digest::SHA1.digest("RUM" + Oboe::Config[:access_key]))
50
+ break
51
+ end
45
52
  end
46
53
  end
47
- rescue
48
- Oboe.logger.error "Having trouble parsing #{config_file}..."
49
54
  end
55
+ rescue Exception => e
56
+ Oboe.logger.error "Trouble obtaining access_key and rum_id: #{e.inspect}"
50
57
  end
51
58
  end
52
59
 
@@ -2,7 +2,7 @@ module Oboe
2
2
  module Version
3
3
  MAJOR = 2
4
4
  MINOR = 1
5
- PATCH = 1
5
+ PATCH = 3
6
6
  BUILD = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
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: 9
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 1
9
- - 1
10
- version: 2.1.1
9
+ - 3
10
+ version: 2.1.3
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-06-27 00:00:00 Z
18
+ date: 2013-07-11 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rake