influxdb-rails 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +65 -0
- data/Gemfile.lock +57 -52
- data/README.md +2 -1
- data/gemfiles/Gemfile.rails-3.0.x +2 -0
- data/gemfiles/Gemfile.rails-3.1.x +2 -0
- data/gemfiles/Gemfile.rails-3.2.x +2 -0
- data/gemfiles/Gemfile.rails-5.0.x +7 -0
- data/gemfiles/Gemfile.rails-5.1.x +7 -0
- data/lib/influxdb-rails.rb +11 -1
- data/lib/influxdb/rails/configuration.rb +39 -31
- data/lib/influxdb/rails/exception_presenter.rb +0 -8
- data/lib/influxdb/rails/middleware/hijack_render_exception.rb +11 -1
- data/lib/influxdb/rails/railtie.rb +8 -2
- data/lib/influxdb/rails/version.rb +1 -1
- data/pkg/influxdb-rails-0.1.11.gem +0 -0
- data/spec/controllers/widgets_controller_spec.rb +1 -1
- data/spec/integration/exceptions_spec.rb +6 -2
- data/spec/integration/metrics_spec.rb +1 -1
- data/spec/spec_helper.rb +7 -1
- data/spec/support/rails4/log/test.log +5721 -0
- data/spec/support/rails5/app.rb +25 -0
- data/spec/support/rails5/log/test.log +1400 -0
- data/spec/unit/backtrace_spec.rb +1 -1
- data/spec/unit/configuration_spec.rb +17 -1
- data/spec/unit/exception_presenter_spec.rb +1 -47
- data/spec/unit/influxdb_rails_spec.rb +1 -1
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fbc8ed2ad3fcc3e00a8913460854beb566531cd
|
4
|
+
data.tar.gz: a9a795b4e24031b8c4be889f291a978556536882
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f5fe545ea23eba285578df5e329ed0a93c47b15759bab28417aeb3c96f95d45e5ccd37afe863ff7d54695114cce44de3b85698bd9e150fb48ac5cd1e2366173
|
7
|
+
data.tar.gz: '0717389a1e94d52d4f07a142408a3b457dd153dca41d4a309d9544387937e854bc4b27c6467162ec9373bc19c8ae5388d4e7f6b69a61291352d6d43d7113e51f'
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
For the full commit log, [see here](https://github.com/influxdata/influxdb-rails/commits/master).
|
4
|
+
|
5
|
+
|
6
|
+
## Unreleased changes
|
7
|
+
|
8
|
+
## v0.1.12, released 2017-06-06
|
9
|
+
|
10
|
+
- Added Rails 5.1 compatibility (#31, @djgould).
|
11
|
+
- Added `retry` config option (#17, @scambra and #18, @bcantin).
|
12
|
+
|
13
|
+
## v0.1.11, released 2016-11-24
|
14
|
+
|
15
|
+
- Bumped `influxdb` Rubygem dependency (#28, #32, @agx).
|
16
|
+
|
17
|
+
**Note:** The real changelog starts here. Previous entries are reconstructed
|
18
|
+
from the commit history by correlating release version with Git tags, which
|
19
|
+
may or may not reflect what was really released.
|
20
|
+
|
21
|
+
## v0.1.10, released 2014-10-08
|
22
|
+
|
23
|
+
- Lazy loading of `InfluxDB::Client` (#15, @chingo13).
|
24
|
+
- Various test fixes.
|
25
|
+
|
26
|
+
## v0.1.9, released 2014-06-18
|
27
|
+
|
28
|
+
- v0.1.8 was yanked
|
29
|
+
- Initializer now allows multiple hosts.
|
30
|
+
|
31
|
+
## v0.1.7, released 2014-04-09
|
32
|
+
|
33
|
+
- Added logger.
|
34
|
+
|
35
|
+
## v0.1.6, released 2014-04-08
|
36
|
+
|
37
|
+
- No changes (?)
|
38
|
+
|
39
|
+
## v0.1.5, released 2014-04-02
|
40
|
+
|
41
|
+
- No changes (?)
|
42
|
+
|
43
|
+
## v0.1.4, released 2014-03-26
|
44
|
+
|
45
|
+
- Added docs
|
46
|
+
- Made `async` option default to `true`.
|
47
|
+
|
48
|
+
## v0.1.3, released 2014-02-11
|
49
|
+
|
50
|
+
- Set series name defaults.
|
51
|
+
- Fixed a configuration bug.
|
52
|
+
|
53
|
+
## v0.1.2, released 2014-02-11
|
54
|
+
|
55
|
+
- Graceful handling of authentication errors.
|
56
|
+
- Fixes in documentation.
|
57
|
+
|
58
|
+
## v0.1.1, released 2014-02-06
|
59
|
+
|
60
|
+
- Refactoring of `ActiveSupport::Notification` handling.
|
61
|
+
- Added more initializer options.
|
62
|
+
|
63
|
+
## v0.1.0, released 2014-02-06
|
64
|
+
|
65
|
+
- Larger refactoring.
|
data/Gemfile.lock
CHANGED
@@ -1,89 +1,93 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/influxdata/influxdb-ruby.git
|
3
|
+
revision: ea982962b89f3c994406cecdd211bd5bc8475c2f
|
4
|
+
branch: timestamps
|
5
|
+
specs:
|
6
|
+
influxdb (0.3.14)
|
7
|
+
json
|
8
|
+
|
1
9
|
PATH
|
2
10
|
remote: .
|
3
11
|
specs:
|
4
12
|
influxdb-rails (0.1.11)
|
5
|
-
influxdb
|
13
|
+
influxdb
|
6
14
|
railties
|
7
15
|
|
8
16
|
GEM
|
9
17
|
remote: https://rubygems.org/
|
10
18
|
specs:
|
11
|
-
actionpack (5.
|
12
|
-
actionview (= 5.
|
13
|
-
activesupport (= 5.
|
19
|
+
actionpack (5.1.1)
|
20
|
+
actionview (= 5.1.1)
|
21
|
+
activesupport (= 5.1.1)
|
14
22
|
rack (~> 2.0)
|
15
23
|
rack-test (~> 0.6.3)
|
16
24
|
rails-dom-testing (~> 2.0)
|
17
25
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
18
|
-
actionview (5.
|
19
|
-
activesupport (= 5.
|
26
|
+
actionview (5.1.1)
|
27
|
+
activesupport (= 5.1.1)
|
20
28
|
builder (~> 3.1)
|
21
|
-
|
29
|
+
erubi (~> 1.4)
|
22
30
|
rails-dom-testing (~> 2.0)
|
23
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
24
|
-
activesupport (5.
|
31
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
32
|
+
activesupport (5.1.1)
|
25
33
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
26
34
|
i18n (~> 0.7)
|
27
35
|
minitest (~> 5.1)
|
28
36
|
tzinfo (~> 1.1)
|
29
|
-
builder (3.2.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
erubis (2.7.0)
|
37
|
+
builder (3.2.3)
|
38
|
+
concurrent-ruby (1.0.5)
|
39
|
+
diff-lcs (1.3)
|
40
|
+
erubi (1.6.0)
|
34
41
|
fakeweb (1.3.0)
|
35
|
-
i18n (0.
|
36
|
-
|
37
|
-
cause
|
38
|
-
json
|
39
|
-
json (2.0.2)
|
42
|
+
i18n (0.8.4)
|
43
|
+
json (2.1.0)
|
40
44
|
loofah (2.0.3)
|
41
45
|
nokogiri (>= 1.5.9)
|
42
46
|
method_source (0.8.2)
|
43
|
-
mini_portile2 (2.
|
44
|
-
minitest (5.
|
45
|
-
nokogiri (1.
|
46
|
-
mini_portile2 (~> 2.
|
47
|
-
rack (2.0.
|
47
|
+
mini_portile2 (2.2.0)
|
48
|
+
minitest (5.10.2)
|
49
|
+
nokogiri (1.8.0)
|
50
|
+
mini_portile2 (~> 2.2.0)
|
51
|
+
rack (2.0.3)
|
48
52
|
rack-test (0.6.3)
|
49
53
|
rack (>= 1.0)
|
50
|
-
rails-dom-testing (2.0.
|
51
|
-
activesupport (>= 4.2.0
|
52
|
-
nokogiri (
|
54
|
+
rails-dom-testing (2.0.3)
|
55
|
+
activesupport (>= 4.2.0)
|
56
|
+
nokogiri (>= 1.6)
|
53
57
|
rails-html-sanitizer (1.0.3)
|
54
58
|
loofah (~> 2.0)
|
55
|
-
railties (5.
|
56
|
-
actionpack (= 5.
|
57
|
-
activesupport (= 5.
|
59
|
+
railties (5.1.1)
|
60
|
+
actionpack (= 5.1.1)
|
61
|
+
activesupport (= 5.1.1)
|
58
62
|
method_source
|
59
63
|
rake (>= 0.8.7)
|
60
64
|
thor (>= 0.18.1, < 2.0)
|
61
|
-
rake (
|
62
|
-
rdoc (5.
|
63
|
-
rspec (3.
|
64
|
-
rspec-core (~> 3.
|
65
|
-
rspec-expectations (~> 3.
|
66
|
-
rspec-mocks (~> 3.
|
67
|
-
rspec-core (3.
|
68
|
-
rspec-support (~> 3.
|
69
|
-
rspec-expectations (3.
|
65
|
+
rake (12.0.0)
|
66
|
+
rdoc (5.1.0)
|
67
|
+
rspec (3.6.0)
|
68
|
+
rspec-core (~> 3.6.0)
|
69
|
+
rspec-expectations (~> 3.6.0)
|
70
|
+
rspec-mocks (~> 3.6.0)
|
71
|
+
rspec-core (3.6.0)
|
72
|
+
rspec-support (~> 3.6.0)
|
73
|
+
rspec-expectations (3.6.0)
|
70
74
|
diff-lcs (>= 1.2.0, < 2.0)
|
71
|
-
rspec-support (~> 3.
|
72
|
-
rspec-mocks (3.
|
75
|
+
rspec-support (~> 3.6.0)
|
76
|
+
rspec-mocks (3.6.0)
|
73
77
|
diff-lcs (>= 1.2.0, < 2.0)
|
74
|
-
rspec-support (~> 3.
|
75
|
-
rspec-rails (3.
|
78
|
+
rspec-support (~> 3.6.0)
|
79
|
+
rspec-rails (3.6.0)
|
76
80
|
actionpack (>= 3.0)
|
77
81
|
activesupport (>= 3.0)
|
78
82
|
railties (>= 3.0)
|
79
|
-
rspec-core (~> 3.
|
80
|
-
rspec-expectations (~> 3.
|
81
|
-
rspec-mocks (~> 3.
|
82
|
-
rspec-support (~> 3.
|
83
|
-
rspec-support (3.
|
84
|
-
thor (0.19.
|
85
|
-
thread_safe (0.3.
|
86
|
-
tzinfo (1.2.
|
83
|
+
rspec-core (~> 3.6.0)
|
84
|
+
rspec-expectations (~> 3.6.0)
|
85
|
+
rspec-mocks (~> 3.6.0)
|
86
|
+
rspec-support (~> 3.6.0)
|
87
|
+
rspec-support (3.6.0)
|
88
|
+
thor (0.19.4)
|
89
|
+
thread_safe (0.3.6)
|
90
|
+
tzinfo (1.2.3)
|
87
91
|
thread_safe (~> 0.1)
|
88
92
|
|
89
93
|
PLATFORMS
|
@@ -92,6 +96,7 @@ PLATFORMS
|
|
92
96
|
DEPENDENCIES
|
93
97
|
bundler (>= 1.0.0)
|
94
98
|
fakeweb
|
99
|
+
influxdb!
|
95
100
|
influxdb-rails!
|
96
101
|
rake
|
97
102
|
rdoc
|
@@ -100,4 +105,4 @@ DEPENDENCIES
|
|
100
105
|
tzinfo
|
101
106
|
|
102
107
|
BUNDLED WITH
|
103
|
-
1.
|
108
|
+
1.14.6
|
data/README.md
CHANGED
@@ -14,7 +14,8 @@ Maintained by [@toddboom][] and [@dmke][].
|
|
14
14
|
|
15
15
|
---
|
16
16
|
|
17
|
-
[![
|
17
|
+
[![Gem Version](https://badge.fury.io/rb/influxdb-rails.svg)](https://badge.fury.io/rb/influxdb-rails)
|
18
|
+
[![Build Status](https://travis-ci.org/influxdata/influxdb-rails.svg?branch=master)](https://travis-ci.org/influxdata/influxdb-rails)
|
18
19
|
|
19
20
|
Automatically instrument your Ruby on Rails applications and write the
|
20
21
|
metrics directly into [InfluxDB](http://influxdb.org/).
|
data/lib/influxdb-rails.rb
CHANGED
@@ -37,7 +37,8 @@ module InfluxDB
|
|
37
37
|
:hosts => configuration.influxdb_hosts,
|
38
38
|
:port => configuration.influxdb_port,
|
39
39
|
:async => configuration.async,
|
40
|
-
:use_ssl => configuration.use_ssl
|
40
|
+
:use_ssl => configuration.use_ssl,
|
41
|
+
:retry => configuration.retry
|
41
42
|
end
|
42
43
|
|
43
44
|
def configuration
|
@@ -140,6 +141,15 @@ module InfluxDB
|
|
140
141
|
transmit_unless_ignorable(e)
|
141
142
|
raise(e)
|
142
143
|
end
|
144
|
+
|
145
|
+
def safely_prepend(module_name, opts = {})
|
146
|
+
return if opts[:to].nil? || opts[:from].nil?
|
147
|
+
if opts[:to].respond_to?(:prepend, true)
|
148
|
+
opts[:to].send(:prepend, opts[:from].const_get(module_name))
|
149
|
+
else
|
150
|
+
opts[:to].send(:include, opts[:from].const_get("Old" + module_name))
|
151
|
+
end
|
152
|
+
end
|
143
153
|
end
|
144
154
|
end
|
145
155
|
end
|
@@ -8,12 +8,15 @@ module InfluxDB
|
|
8
8
|
attr_accessor :influxdb_database
|
9
9
|
attr_accessor :async
|
10
10
|
attr_accessor :use_ssl
|
11
|
+
attr_accessor :retry
|
11
12
|
|
12
13
|
attr_accessor :series_name_for_controller_runtimes
|
13
14
|
attr_accessor :series_name_for_view_runtimes
|
14
15
|
attr_accessor :series_name_for_db_runtimes
|
15
16
|
|
16
17
|
attr_accessor :application_id
|
18
|
+
deprecate :application_id => "This method serve no purpose and will be removed in the release after 0.1.12"
|
19
|
+
|
17
20
|
attr_accessor :application_name
|
18
21
|
attr_accessor :application_root
|
19
22
|
|
@@ -37,18 +40,20 @@ module InfluxDB
|
|
37
40
|
attr_accessor :debug
|
38
41
|
attr_accessor :reraise_global_exceptions
|
39
42
|
|
43
|
+
|
40
44
|
DEFAULTS = {
|
41
|
-
:influxdb_hosts
|
42
|
-
:influxdb_port
|
43
|
-
:influxdb_username
|
44
|
-
:influxdb_password
|
45
|
-
:influxdb_database
|
46
|
-
:async
|
47
|
-
:use_ssl
|
48
|
-
|
49
|
-
|
50
|
-
:
|
51
|
-
:
|
45
|
+
:influxdb_hosts => ["localhost"],
|
46
|
+
:influxdb_port => 8086,
|
47
|
+
:influxdb_username => "root",
|
48
|
+
:influxdb_password => "root",
|
49
|
+
:influxdb_database => nil,
|
50
|
+
:async => true,
|
51
|
+
:use_ssl => false,
|
52
|
+
:retry => nil,
|
53
|
+
|
54
|
+
:series_name_for_controller_runtimes => "rails.controller",
|
55
|
+
:series_name_for_view_runtimes => "rails.view",
|
56
|
+
:series_name_for_db_runtimes => "rails.db",
|
52
57
|
|
53
58
|
:ignored_exceptions => %w{ActiveRecord::RecordNotFound
|
54
59
|
ActionController::RoutingError},
|
@@ -80,29 +85,31 @@ module InfluxDB
|
|
80
85
|
}
|
81
86
|
|
82
87
|
def initialize
|
83
|
-
@influxdb_hosts
|
84
|
-
@influxdb_port
|
85
|
-
@influxdb_username
|
86
|
-
@influxdb_password
|
87
|
-
@influxdb_database
|
88
|
-
@async
|
89
|
-
@use_ssl
|
90
|
-
|
91
|
-
|
92
|
-
@
|
93
|
-
@
|
94
|
-
|
95
|
-
|
96
|
-
@
|
97
|
-
@
|
98
|
-
@
|
99
|
-
@
|
100
|
-
@
|
88
|
+
@influxdb_hosts = DEFAULTS[:influxdb_hosts]
|
89
|
+
@influxdb_port = DEFAULTS[:influxdb_port]
|
90
|
+
@influxdb_username = DEFAULTS[:influxdb_username]
|
91
|
+
@influxdb_password = DEFAULTS[:influxdb_password]
|
92
|
+
@influxdb_database = DEFAULTS[:influxdb_database]
|
93
|
+
@async = DEFAULTS[:async]
|
94
|
+
@use_ssl = DEFAULTS[:use_ssl]
|
95
|
+
@retry = DEFAULTS[:retry]
|
96
|
+
|
97
|
+
@series_name_for_controller_runtimes = DEFAULTS[:series_name_for_controller_runtimes]
|
98
|
+
@series_name_for_view_runtimes = DEFAULTS[:series_name_for_view_runtimes]
|
99
|
+
@series_name_for_db_runtimes = DEFAULTS[:series_name_for_db_runtimes]
|
100
|
+
|
101
|
+
@ignored_exceptions = DEFAULTS[:ignored_exceptions].dup
|
102
|
+
@ignored_exception_messages = DEFAULTS[:ignored_exception_messages].dup
|
103
|
+
@ignored_reports = DEFAULTS[:ignored_reports].dup
|
104
|
+
@ignored_environments = DEFAULTS[:ignored_environments].dup
|
105
|
+
@ignored_user_agents = DEFAULTS[:ignored_user_agents].dup
|
106
|
+
@backtrace_filters = DEFAULTS[:backtrace_filters].dup
|
101
107
|
@environment_variable_filters = DEFAULTS[:environment_variable_filters]
|
102
108
|
@aggregated_exception_classes = []
|
103
|
-
|
109
|
+
|
110
|
+
@debug = false
|
104
111
|
@rescue_global_exceptions = false
|
105
|
-
@instrumentation_enabled
|
112
|
+
@instrumentation_enabled = true
|
106
113
|
end
|
107
114
|
|
108
115
|
def debug?
|
@@ -137,6 +144,7 @@ module InfluxDB
|
|
137
144
|
def database_name
|
138
145
|
@application_id.to_s + @environment.to_s
|
139
146
|
end
|
147
|
+
deprecate :database_name => "This method will be removed in the release after 0.1.12, you ought to use #influxdb_database"
|
140
148
|
|
141
149
|
private
|
142
150
|
def initialize_http_connection
|
@@ -5,8 +5,6 @@ require "json"
|
|
5
5
|
module InfluxDB
|
6
6
|
module Rails
|
7
7
|
class ExceptionPresenter
|
8
|
-
attr_accessor :hash
|
9
|
-
|
10
8
|
attr_reader :exception
|
11
9
|
attr_reader :backtrace
|
12
10
|
attr_reader :params
|
@@ -54,13 +52,7 @@ module InfluxDB
|
|
54
52
|
:custom_data => @custom_data
|
55
53
|
}
|
56
54
|
|
57
|
-
# c[:environment_variables] = JSON.generate(@environment_variables.reject do |k,v|
|
58
|
-
# InfluxDB::Rails.configuration.environment_variable_filters.any? { |filter| k =~ filter }
|
59
|
-
# end)
|
60
|
-
|
61
55
|
InfluxDB::Rails.configuration.add_custom_exception_data(self)
|
62
|
-
|
63
|
-
# c[:request_data] = JSON.generate(request_data) if @controller || @action || !@params.blank?
|
64
56
|
c
|
65
57
|
end
|
66
58
|
|