honeycomb-rails 0.4.2 → 0.5.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: a6e8abdde1e706e01d1b26feba7dac25fca60d7c10aa6cadf8eb80b92d64d027
4
- data.tar.gz: 87def2f4c965e144ab0225800bdcabbf44dd352f85f5dfc4b2708b34c5efc6e5
3
+ metadata.gz: 5d63f54aff8e75b9dc23176de419708a641c7ffa9feb6acc2ceea77ff9750093
4
+ data.tar.gz: 028d64690d7bbdc8bc071b75ae999683c3b28c9fd41406cd30ddaa1a082dbb19
5
5
  SHA512:
6
- metadata.gz: 36e2f4d0938fd7588cd3d09fe79940479a044ff447476cd6c666c7cd00ce0829b5af1a30e69ab2152a0a590b8f7c003598afc4466c18451ae5e5be592eb5f1ea
7
- data.tar.gz: a627f08ef0c6c7869962bf409f8c38d0293be235c9e3abd41abd3ee468f23c91ceac5a1d591afe3418d5c1b88eaa00a91ee9b4c1873ac940c4da06bbeee2421b
6
+ metadata.gz: 553739e9285b2fd043288f91336d90d782015b465a7f1e2aa8f572ccc3ea425c766508e995c4f591dc9a74c81f327c8c9731c3a2df9bd429a8bb571333e6ec2b
7
+ data.tar.gz: 58663a163b9b813cee39dd0bcc64990a238827e87cc331d74216a702eb38e7a03653bdfb92e4e0fef8560c0fb6db096c2da05c90a568467fe3d7d3c442737de7
@@ -3,6 +3,7 @@ if !defined?(Rails)
3
3
  end
4
4
 
5
5
  require 'honeycomb-rails/config'
6
+ require 'honeycomb-rails/version'
6
7
 
7
8
  module HoneycombRails
8
9
  class << self
@@ -30,6 +30,7 @@ module HoneycombRails
30
30
  # Valid values:
31
31
  #
32
32
  # * :devise - if your app uses Devise for authentication
33
+ # * :devise_api - if your app uses Devise for authentication in an 'api' namespace
33
34
  # * :detect - autodetect how to determine the current user
34
35
  # * nil, false - disable recording current user
35
36
  #
@@ -33,6 +33,8 @@ module HoneycombRails
33
33
  honeycomb_user_metadata
34
34
  when :devise
35
35
  honeycomb_user_metadata_devise
36
+ when :devise_api
37
+ honeycomb_user_metadata_devise_api
36
38
  when Proc
37
39
  @honeycomb_user_proc = HoneycombRails.config.record_user
38
40
  honeycomb_user_metadata
@@ -55,10 +57,24 @@ module HoneycombRails
55
57
  end
56
58
  end
57
59
 
60
+ def honeycomb_user_metadata_devise_api
61
+ if respond_to?(:current_api_user) and current_api_user
62
+ {
63
+ current_user_id: current_api_user.id,
64
+ current_user_email: current_api_user.email,
65
+ current_user_admin: !!current_api_user.try(:admin?),
66
+ }
67
+ else
68
+ {}
69
+ end
70
+ end
71
+
58
72
  def honeycomb_detect_user_methods!
59
73
  if respond_to?(:current_user)
60
74
  # This could be more sophisticated, but it'll do for now
61
75
  HoneycombRails.config.record_user = :devise
76
+ elsif respond_to?(:current_api_user)
77
+ HoneycombRails.config.record_user = :devise_api
62
78
  else
63
79
  logger.error "HoneycombRails.config.record_user = :detect but couldn't detect user methods; disabling user recording."
64
80
  HoneycombRails.config.record_user = false
@@ -22,7 +22,10 @@ module HoneycombRails
22
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
23
  end
24
24
 
25
- @libhoney = Libhoney::Client.new(writekey: writekey)
25
+ @libhoney = Libhoney::Client.new(
26
+ writekey: writekey,
27
+ user_agent_addition: HoneycombRails::USER_AGENT_SUFFIX,
28
+ )
26
29
 
27
30
  if HoneycombRails.config.capture_exceptions
28
31
  ::ActionController::Base.include(Overrides::ActionControllerFilters)
@@ -0,0 +1,7 @@
1
+ module HoneycombRails
2
+ GEM_NAME = 'honeycomb-rails'
3
+
4
+ VERSION = '0.5.1'
5
+
6
+ USER_AGENT_SUFFIX = "#{GEM_NAME}/#{VERSION}".freeze
7
+ end
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.2
4
+ version: 0.5.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: 2018-02-05 00:00:00.000000000 Z
12
+ date: 2018-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: libhoney
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 1.3.2
20
+ version: 1.5.0
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: 1.3.2
27
+ version: 1.5.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rails
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -95,20 +95,6 @@ dependencies:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
- - !ruby/object:Gem::Dependency
99
- name: libhoney
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- version: 1.4.0
105
- type: :development
106
- prerelease: false
107
- version_requirements: !ruby/object:Gem::Requirement
108
- requirements:
109
- - - ">="
110
- - !ruby/object:Gem::Version
111
- version: 1.4.0
112
98
  description: |2
113
99
  Get fine-grained visibility into the behavior and performance of your
114
100
  Rails web app. This gem instruments your app to send events to Honeycomb
@@ -132,6 +118,7 @@ files:
132
118
  - lib/honeycomb-rails/subscribers.rb
133
119
  - lib/honeycomb-rails/subscribers/active_record.rb
134
120
  - lib/honeycomb-rails/subscribers/process_action.rb
121
+ - lib/honeycomb-rails/version.rb
135
122
  homepage: https://github.com/honeycombio/honeycomb-rails
136
123
  licenses:
137
124
  - MIT
@@ -152,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
139
  version: '0'
153
140
  requirements: []
154
141
  rubyforge_project:
155
- rubygems_version: 2.7.4
142
+ rubygems_version: 2.7.6
156
143
  signing_key:
157
144
  specification_version: 4
158
145
  summary: Easily instrument your Rails apps with Honeycomb