honeycomb-rails 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ce38870b1d7d5dc68b425b3e4bf323ea3e26b4d59b2bad85270b17f4f444b2e
4
- data.tar.gz: 8f30aa96990892d0cb6515b119bff5aac96045e1b9fc1bb1137febd72b7ac91a
3
+ metadata.gz: f13e00c09b5b340fcb8f28d6b6f18499bb6ca7111e6156d5b5c8c12a2aeaecbf
4
+ data.tar.gz: c96bded26cbc16d04faeb0587bfc7f7009b018417faed39a94cb14dddffb52d9
5
5
  SHA512:
6
- metadata.gz: ca245585297cb2f654828cf2729b064a174c13187023dfdd9b113c793ad39dd0084edb065a6476e75fd35bd5d8c36e08527065d3b48a8887b8fdf8a4fa89d1a6
7
- data.tar.gz: ee159ce39880ac7438fb904d5d8600d824df005fce2d42002bc63d934f8e861f9bc84047a6c5046f3122ebb594bada4128e73c8912377f89038d76f97bb6f50d
6
+ metadata.gz: e86add2fcc2a429723abe7cd3cec1ce31d2014537b18aacf017756728100b0dfee76a84f9580fb3a20f4671578709b817e47dbafd934a11a03374e5c430d1e18
7
+ data.tar.gz: 36696d9e6f59b6098da73e94784f5a5fe8315ad34fde2ce326f6d68e02f8ff7096dc0d8b6f76f6c52c87b681c30e28867911fe72cc0d93c367cf7620082bd260
@@ -57,9 +57,10 @@ module HoneycombRails
57
57
  # * 1 or lower - disable sampling on this dataset; capture all events
58
58
  # * TODO: :rails - default Rails dynamic sampling?
59
59
  #
60
- # You can also pass a Proc, which will be called with the current controller
61
- # instance during each request, and which should return a sample rate for
62
- # the request in question.
60
+ # You can also pass a Proc, which will be called with the
61
+ # ActiveSupport::Notifications payload that was used to populate the
62
+ # Honeycomb event, and which should return a sample rate for the request
63
+ # in question.
63
64
  attr_accessor :sample_rate
64
65
 
65
66
  # If set to true, captures exception class name / message along with Rails
@@ -2,18 +2,6 @@ module HoneycombRails
2
2
  module Extensions
3
3
  module ActionController
4
4
  module InstanceMethods
5
- def self.included(controller_class)
6
- super
7
-
8
- controller_class.before_action do
9
- honeycomb_initialize
10
- end
11
- end
12
-
13
- def honeycomb_initialize
14
- @honeycomb_metadata = {}
15
- end
16
-
17
5
  # Hash of metadata to be added to the event we will send to Honeycomb
18
6
  # for the current request.
19
7
  #
@@ -23,7 +11,9 @@ module HoneycombRails
23
11
  # honeycomb_metadata[:num_posts] = @posts.size
24
12
  #
25
13
  # @return [Hash<String=>Any>]
26
- attr_reader :honeycomb_metadata
14
+ def honeycomb_metadata
15
+ @honeycomb_metadata ||= {}
16
+ end
27
17
  end
28
18
  end
29
19
  end
@@ -18,6 +18,10 @@ module HoneycombRails
18
18
  # the app's config/initializers has taken effect.
19
19
  config.after_initialize do
20
20
  writekey = HoneycombRails.config.writekey
21
+ if writekey.blank?
22
+ HoneycombRails.config.logger.warn("No write key defined! (Check your config's `writekey` value in config/initializers/honeycomb.rb) No events will be sent to Honeycomb.")
23
+ end
24
+
21
25
  @libhoney = Libhoney::Client.new(writekey: writekey)
22
26
 
23
27
  if HoneycombRails.config.capture_exceptions
@@ -41,7 +45,7 @@ module HoneycombRails
41
45
  end
42
46
 
43
47
  if subscribers.empty?
44
- HoneycombRails.config.logger.warn("No subscribers defined (are both HoneycombRails.config.dataset and HoneycombRails.config.db_dataset both blank?")
48
+ HoneycombRails.config.logger.warn("No subscribers defined (are both HoneycombRails.config.dataset and HoneycombRails.config.db_dataset both blank?)")
45
49
  end
46
50
 
47
51
  subscribers.each(&:subscribe!)
@@ -20,7 +20,12 @@ module HoneycombRails
20
20
  data = event.payload.slice(:name, :connection_id)
21
21
  data[:sql] = event.payload[:sql].strip
22
22
  event.payload[:binds].each do |b|
23
- data["bind_#{ b.name }".to_sym] = b.value
23
+ case b
24
+ when Array
25
+ data["bind_#{ b[0].name }".to_sym] = b[1]
26
+ else
27
+ data["bind_#{ b.name }".to_sym] = b.value
28
+ end
24
29
  end
25
30
  data[:duration] = event.duration
26
31
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honeycomb-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Stokes
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-12-06 00:00:00.000000000 Z
12
+ date: 2018-01-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: libhoney
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  version: '0'
153
153
  requirements: []
154
154
  rubyforge_project:
155
- rubygems_version: 2.7.3
155
+ rubygems_version: 2.7.4
156
156
  signing_key:
157
157
  specification_version: 4
158
158
  summary: Easily instrument your Rails apps with Honeycomb