influxdb-rails 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +2 -2
- data/README.md +1 -0
- data/lib/influxdb-rails.rb +26 -3
- data/lib/influxdb/rails/configuration.rb +3 -0
- data/lib/influxdb/rails/exception_presenter.rb +1 -1
- data/lib/influxdb/rails/version.rb +1 -1
- data/pkg/influxdb-rails-0.4.2.gem +0 -0
- data/spec/support/rails5/log/test.log +255 -0
- data/spec/unit/configuration_spec.rb +15 -0
- data/spec/unit/influxdb_rails_spec.rb +49 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9f289eb3c697b6d163fd04b05fa11be0a3faed5
|
4
|
+
data.tar.gz: 9165b28e2876c859d470db53388d118f84543bc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0858571c10ded74e3f41af240ddbf66bdb656b44e37644dd8e4296cab44b2642abd7ae86ddd427b10643fba1e1da45e7aa0022b5dbaa7d864fdb35c0e596023e'
|
7
|
+
data.tar.gz: 32a186b18f0e31653b61d202a5a7696afdab50c28df4471e426dedaf7c2078b10017092a95e282e18ccce588dc35ba513009a30cf018e44c091467fd8f0eeb11
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,10 @@ For the full commit log, [see here](https://github.com/influxdata/influxdb-rails
|
|
7
7
|
|
8
8
|
- None.
|
9
9
|
|
10
|
+
## v0.4.3, released 2017-12-12
|
11
|
+
|
12
|
+
- Added `time_precision` config option (#42, @kkentzo)
|
13
|
+
|
10
14
|
## v0.4.2, released 2017-11-28
|
11
15
|
|
12
16
|
- Added `open_timeout`, `read_timeout`, and `max_delay` config options
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -53,6 +53,7 @@ InfluxDB::Rails.configure do |config|
|
|
53
53
|
# config.open_timeout = 5
|
54
54
|
# config.read_timeout = 30
|
55
55
|
# config.max_delay = 300
|
56
|
+
# config.time_precision = 'ms'
|
56
57
|
|
57
58
|
# config.series_name_for_controller_runtimes = "rails.controller"
|
58
59
|
# config.series_name_for_view_runtimes = "rails.view"
|
data/lib/influxdb-rails.rb
CHANGED
@@ -41,7 +41,8 @@ module InfluxDB
|
|
41
41
|
:retry => configuration.retry,
|
42
42
|
:open_timeout => configuration.open_timeout,
|
43
43
|
:read_timeout => configuration.read_timeout,
|
44
|
-
:max_delay => configuration.max_delay
|
44
|
+
:max_delay => configuration.max_delay,
|
45
|
+
:time_precision => configuration.time_precision
|
45
46
|
end
|
46
47
|
|
47
48
|
def configuration
|
@@ -76,7 +77,7 @@ module InfluxDB
|
|
76
77
|
alias_method :transmit, :report_exception
|
77
78
|
|
78
79
|
def handle_action_controller_metrics(name, start, finish, id, payload)
|
79
|
-
timestamp = finish.utc
|
80
|
+
timestamp = convert_timestamp(finish.utc)
|
80
81
|
controller_runtime = ((finish - start)*1000).ceil
|
81
82
|
view_runtime = (payload[:view_runtime] || 0).ceil
|
82
83
|
db_runtime = (payload[:db_runtime] || 0).ceil
|
@@ -92,6 +93,7 @@ module InfluxDB
|
|
92
93
|
method: method,
|
93
94
|
server: hostname,
|
94
95
|
},
|
96
|
+
timestamp: timestamp,
|
95
97
|
}
|
96
98
|
|
97
99
|
client.write_point configuration.series_name_for_view_runtimes, {
|
@@ -102,6 +104,7 @@ module InfluxDB
|
|
102
104
|
method: method,
|
103
105
|
server: hostname,
|
104
106
|
},
|
107
|
+
timestamp: timestamp,
|
105
108
|
}
|
106
109
|
|
107
110
|
client.write_point configuration.series_name_for_db_runtimes, {
|
@@ -112,14 +115,34 @@ module InfluxDB
|
|
112
115
|
method: method,
|
113
116
|
server: hostname,
|
114
117
|
},
|
118
|
+
timestamp: timestamp,
|
115
119
|
}
|
116
120
|
rescue => e
|
117
121
|
log :error, "[InfluxDB::Rails] Unable to write points: #{e.message}"
|
118
122
|
end
|
119
123
|
end
|
120
124
|
|
125
|
+
def convert_timestamp(ts)
|
126
|
+
case configuration.time_precision
|
127
|
+
when 'ns', nil
|
128
|
+
(ts.to_r * 1e9).to_i
|
129
|
+
when 'u'
|
130
|
+
(ts.to_r * 1e6).to_i
|
131
|
+
when 'ms'
|
132
|
+
(ts.to_r * 1e3).to_i
|
133
|
+
when 's'
|
134
|
+
ts.to_i
|
135
|
+
when 'm'
|
136
|
+
ts.to_i / 60
|
137
|
+
when 'h'
|
138
|
+
ts.to_i / 60 / 60
|
139
|
+
else
|
140
|
+
raise "Invalid time precision: #{configuration.time_precision}"
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
121
144
|
def current_timestamp
|
122
|
-
Time.now.utc
|
145
|
+
convert_timestamp(Time.now.utc)
|
123
146
|
end
|
124
147
|
|
125
148
|
def ignorable_exception?(e)
|
@@ -12,6 +12,7 @@ module InfluxDB
|
|
12
12
|
attr_accessor :open_timeout
|
13
13
|
attr_accessor :read_timeout
|
14
14
|
attr_accessor :max_delay
|
15
|
+
attr_accessor :time_precision
|
15
16
|
|
16
17
|
attr_accessor :series_name_for_controller_runtimes
|
17
18
|
attr_accessor :series_name_for_view_runtimes
|
@@ -58,6 +59,7 @@ module InfluxDB
|
|
58
59
|
:open_timeout => 5,
|
59
60
|
:read_timeout => 300,
|
60
61
|
:max_delay => 30,
|
62
|
+
:time_precision => "s",
|
61
63
|
|
62
64
|
:series_name_for_controller_runtimes => "rails.controller",
|
63
65
|
:series_name_for_view_runtimes => "rails.view",
|
@@ -104,6 +106,7 @@ module InfluxDB
|
|
104
106
|
@open_timeout = DEFAULTS[:open_timeout]
|
105
107
|
@read_timeout = DEFAULTS[:read_timeout]
|
106
108
|
@max_delay = DEFAULTS[:max_delay]
|
109
|
+
@time_precision = DEFAULTS[:time_precision]
|
107
110
|
|
108
111
|
@series_name_for_controller_runtimes = DEFAULTS[:series_name_for_controller_runtimes]
|
109
112
|
@series_name_for_view_runtimes = DEFAULTS[:series_name_for_view_runtimes]
|
@@ -40,7 +40,7 @@ module InfluxDB
|
|
40
40
|
|
41
41
|
def context
|
42
42
|
c = {
|
43
|
-
:time =>
|
43
|
+
:time => InfluxDB::Rails.current_timestamp,
|
44
44
|
:application_name => InfluxDB::Rails.configuration.application_name,
|
45
45
|
:application_root => InfluxDB::Rails.configuration.application_root,
|
46
46
|
:framework => InfluxDB::Rails.configuration.framework,
|
Binary file
|
@@ -2419,3 +2419,258 @@ Completed 200 OK in 0ms
|
|
2419
2419
|
Started GET "/widgets" for 127.0.0.1 at 2017-08-19 16:26:42 +0200
|
2420
2420
|
Processing by WidgetsController#index as HTML
|
2421
2421
|
Completed 200 OK in 0ms
|
2422
|
+
DEPRECATION WARNING: You didn't set `secret_key_base`. Read the upgrade documentation to learn more about this new config option. (called from env_config at /home/dm/.rbenv/versions/2.4/gemsets/influxdb/gems/railties-5.1.3/lib/rails/application.rb:247)
|
2423
|
+
Processing by WidgetsController#new as HTML
|
2424
|
+
Completed 500 Internal Server Error in 0ms
|
2425
|
+
Processing by WidgetsController#index as HTML
|
2426
|
+
Completed 200 OK in 0ms
|
2427
|
+
Started GET "/widgets/new" for 127.0.0.1 at 2017-12-12 21:01:58 +0100
|
2428
|
+
Processing by WidgetsController#new as HTML
|
2429
|
+
Completed 500 Internal Server Error in 0ms
|
2430
|
+
|
2431
|
+
ZeroDivisionError (divided by 0):
|
2432
|
+
|
2433
|
+
app.rb:22:in `/'
|
2434
|
+
app.rb:22:in `new'
|
2435
|
+
actionpack (5.1.3) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
|
2436
|
+
actionpack (5.1.3) lib/abstract_controller/base.rb:186:in `process_action'
|
2437
|
+
actionpack (5.1.3) lib/action_controller/metal/rendering.rb:30:in `process_action'
|
2438
|
+
actionpack (5.1.3) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
|
2439
|
+
activesupport (5.1.3) lib/active_support/callbacks.rb:97:in `run_callbacks'
|
2440
|
+
actionpack (5.1.3) lib/abstract_controller/callbacks.rb:19:in `process_action'
|
2441
|
+
actionpack (5.1.3) lib/action_controller/metal/rescue.rb:20:in `process_action'
|
2442
|
+
actionpack (5.1.3) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
|
2443
|
+
activesupport (5.1.3) lib/active_support/notifications.rb:166:in `block in instrument'
|
2444
|
+
activesupport (5.1.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
|
2445
|
+
activesupport (5.1.3) lib/active_support/notifications.rb:166:in `instrument'
|
2446
|
+
actionpack (5.1.3) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
|
2447
|
+
actionpack (5.1.3) lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
|
2448
|
+
actionpack (5.1.3) lib/abstract_controller/base.rb:124:in `process'
|
2449
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/actionview-5.1.3/lib/action_view/rendering.rb:30:in `process'
|
2450
|
+
actionpack (5.1.3) lib/action_controller/metal.rb:189:in `dispatch'
|
2451
|
+
actionpack (5.1.3) lib/action_controller/metal.rb:253:in `dispatch'
|
2452
|
+
actionpack (5.1.3) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
|
2453
|
+
actionpack (5.1.3) lib/action_dispatch/routing/route_set.rb:31:in `serve'
|
2454
|
+
actionpack (5.1.3) lib/action_dispatch/journey/router.rb:46:in `block in serve'
|
2455
|
+
actionpack (5.1.3) lib/action_dispatch/journey/router.rb:33:in `each'
|
2456
|
+
actionpack (5.1.3) lib/action_dispatch/journey/router.rb:33:in `serve'
|
2457
|
+
actionpack (5.1.3) lib/action_dispatch/routing/route_set.rb:834:in `call'
|
2458
|
+
rack (2.0.3) lib/rack/etag.rb:25:in `call'
|
2459
|
+
rack (2.0.3) lib/rack/conditional_get.rb:25:in `call'
|
2460
|
+
rack (2.0.3) lib/rack/head.rb:12:in `call'
|
2461
|
+
rack (2.0.3) lib/rack/session/abstract/id.rb:232:in `context'
|
2462
|
+
rack (2.0.3) lib/rack/session/abstract/id.rb:226:in `call'
|
2463
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/cookies.rb:613:in `call'
|
2464
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
|
2465
|
+
activesupport (5.1.3) lib/active_support/callbacks.rb:97:in `run_callbacks'
|
2466
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
|
2467
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/executor.rb:12:in `call'
|
2468
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
|
2469
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
|
2470
|
+
railties (5.1.3) lib/rails/rack/logger.rb:36:in `call_app'
|
2471
|
+
railties (5.1.3) lib/rails/rack/logger.rb:24:in `block in call'
|
2472
|
+
activesupport (5.1.3) lib/active_support/tagged_logging.rb:69:in `block in tagged'
|
2473
|
+
activesupport (5.1.3) lib/active_support/tagged_logging.rb:26:in `tagged'
|
2474
|
+
activesupport (5.1.3) lib/active_support/tagged_logging.rb:69:in `tagged'
|
2475
|
+
railties (5.1.3) lib/rails/rack/logger.rb:24:in `call'
|
2476
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
|
2477
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/request_id.rb:25:in `call'
|
2478
|
+
rack (2.0.3) lib/rack/method_override.rb:22:in `call'
|
2479
|
+
rack (2.0.3) lib/rack/runtime.rb:22:in `call'
|
2480
|
+
activesupport (5.1.3) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
|
2481
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/executor.rb:12:in `call'
|
2482
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/static.rb:125:in `call'
|
2483
|
+
rack (2.0.3) lib/rack/sendfile.rb:111:in `call'
|
2484
|
+
/home/dm/code/influxdb-rails/lib/influxdb/rails/rack.rb:14:in `_call'
|
2485
|
+
/home/dm/code/influxdb-rails/lib/influxdb/rails/rack.rb:9:in `call'
|
2486
|
+
railties (5.1.3) lib/rails/engine.rb:522:in `call'
|
2487
|
+
rack-test (0.6.3) lib/rack/mock_session.rb:30:in `request'
|
2488
|
+
rack-test (0.6.3) lib/rack/test.rb:244:in `process_request'
|
2489
|
+
rack-test (0.6.3) lib/rack/test.rb:124:in `request'
|
2490
|
+
actionpack (5.1.3) lib/action_dispatch/testing/integration.rb:261:in `process'
|
2491
|
+
actionpack (5.1.3) lib/action_dispatch/testing/integration.rb:16:in `get'
|
2492
|
+
actionpack (5.1.3) lib/action_dispatch/testing/integration.rb:348:in `block (2 levels) in <module:Runner>'
|
2493
|
+
/home/dm/code/influxdb-rails/spec/integration/exceptions_spec.rb:14:in `block (3 levels) in <top (required)>'
|
2494
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:254:in `instance_exec'
|
2495
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:254:in `block in run'
|
2496
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:500:in `block in with_around_and_singleton_context_hooks'
|
2497
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:457:in `block in with_around_example_hooks'
|
2498
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:464:in `block in run'
|
2499
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:604:in `block in run_around_example_hooks_for'
|
2500
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:342:in `call'
|
2501
|
+
rspec-rails (3.6.1) lib/rspec/rails/adapters.rb:127:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
|
2502
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:447:in `instance_exec'
|
2503
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:447:in `instance_exec'
|
2504
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:375:in `execute_with'
|
2505
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:606:in `block (2 levels) in run_around_example_hooks_for'
|
2506
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:342:in `call'
|
2507
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:607:in `run_around_example_hooks_for'
|
2508
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:464:in `run'
|
2509
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:457:in `with_around_example_hooks'
|
2510
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:500:in `with_around_and_singleton_context_hooks'
|
2511
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:251:in `run'
|
2512
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:627:in `block in run_examples'
|
2513
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:623:in `map'
|
2514
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:623:in `run_examples'
|
2515
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:589:in `run'
|
2516
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:590:in `block in run'
|
2517
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:590:in `map'
|
2518
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:590:in `run'
|
2519
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:118:in `block (3 levels) in run_specs'
|
2520
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:118:in `map'
|
2521
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:118:in `block (2 levels) in run_specs'
|
2522
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/configuration.rb:1894:in `with_suite_hooks'
|
2523
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:113:in `block in run_specs'
|
2524
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/reporter.rb:79:in `report'
|
2525
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:112:in `run_specs'
|
2526
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:87:in `run'
|
2527
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:71:in `run'
|
2528
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:45:in `invoke'
|
2529
|
+
rspec-core (3.6.0) exe/rspec:4:in `<top (required)>'
|
2530
|
+
/home/dm/.rbenv/versions/2.4/gemsets/influxdb/bin/rspec:23:in `load'
|
2531
|
+
/home/dm/.rbenv/versions/2.4/gemsets/influxdb/bin/rspec:23:in `<top (required)>'
|
2532
|
+
bundler (1.16.0) lib/bundler/cli/exec.rb:75:in `load'
|
2533
|
+
bundler (1.16.0) lib/bundler/cli/exec.rb:75:in `kernel_load'
|
2534
|
+
bundler (1.16.0) lib/bundler/cli/exec.rb:28:in `run'
|
2535
|
+
bundler (1.16.0) lib/bundler/cli.rb:424:in `exec'
|
2536
|
+
bundler (1.16.0) lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
|
2537
|
+
bundler (1.16.0) lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
|
2538
|
+
bundler (1.16.0) lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
|
2539
|
+
bundler (1.16.0) lib/bundler/cli.rb:27:in `dispatch'
|
2540
|
+
bundler (1.16.0) lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
|
2541
|
+
bundler (1.16.0) lib/bundler/cli.rb:18:in `start'
|
2542
|
+
bundler (1.16.0) exe/bundle:30:in `block in <top (required)>'
|
2543
|
+
bundler (1.16.0) lib/bundler/friendly_errors.rb:122:in `with_friendly_errors'
|
2544
|
+
bundler (1.16.0) exe/bundle:22:in `<top (required)>'
|
2545
|
+
/home/dm/.rbenv/versions/2.4/gemsets/influxdb/bin/bundle:23:in `load'
|
2546
|
+
/home/dm/.rbenv/versions/2.4/gemsets/influxdb/bin/bundle:23:in `<main>'
|
2547
|
+
Started GET "/widgets" for 127.0.0.1 at 2017-12-12 21:01:58 +0100
|
2548
|
+
Processing by WidgetsController#index as HTML
|
2549
|
+
Completed 200 OK in 0ms
|
2550
|
+
Started GET "/widgets/new" for 127.0.0.1 at 2017-12-12 21:01:58 +0100
|
2551
|
+
Processing by WidgetsController#new as HTML
|
2552
|
+
Completed 500 Internal Server Error in 0ms
|
2553
|
+
|
2554
|
+
Cannot write data: #<FakeWeb::NetConnectNotAllowedError: Real HTTP connections are disabled. Unregistered request: POST http://localhost:8086/write?db=&precision=s&u=root&p=root>
|
2555
|
+
ZeroDivisionError (divided by 0):
|
2556
|
+
|
2557
|
+
app.rb:22:in `/'
|
2558
|
+
app.rb:22:in `new'
|
2559
|
+
actionpack (5.1.3) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
|
2560
|
+
actionpack (5.1.3) lib/abstract_controller/base.rb:186:in `process_action'
|
2561
|
+
actionpack (5.1.3) lib/action_controller/metal/rendering.rb:30:in `process_action'
|
2562
|
+
actionpack (5.1.3) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
|
2563
|
+
activesupport (5.1.3) lib/active_support/callbacks.rb:97:in `run_callbacks'
|
2564
|
+
actionpack (5.1.3) lib/abstract_controller/callbacks.rb:19:in `process_action'
|
2565
|
+
actionpack (5.1.3) lib/action_controller/metal/rescue.rb:20:in `process_action'
|
2566
|
+
actionpack (5.1.3) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
|
2567
|
+
activesupport (5.1.3) lib/active_support/notifications.rb:166:in `block in instrument'
|
2568
|
+
activesupport (5.1.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
|
2569
|
+
activesupport (5.1.3) lib/active_support/notifications.rb:166:in `instrument'
|
2570
|
+
actionpack (5.1.3) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
|
2571
|
+
actionpack (5.1.3) lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
|
2572
|
+
actionpack (5.1.3) lib/abstract_controller/base.rb:124:in `process'
|
2573
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/actionview-5.1.3/lib/action_view/rendering.rb:30:in `process'
|
2574
|
+
actionpack (5.1.3) lib/action_controller/metal.rb:189:in `dispatch'
|
2575
|
+
actionpack (5.1.3) lib/action_controller/metal.rb:253:in `dispatch'
|
2576
|
+
actionpack (5.1.3) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
|
2577
|
+
actionpack (5.1.3) lib/action_dispatch/routing/route_set.rb:31:in `serve'
|
2578
|
+
actionpack (5.1.3) lib/action_dispatch/journey/router.rb:46:in `block in serve'
|
2579
|
+
actionpack (5.1.3) lib/action_dispatch/journey/router.rb:33:in `each'
|
2580
|
+
actionpack (5.1.3) lib/action_dispatch/journey/router.rb:33:in `serve'
|
2581
|
+
actionpack (5.1.3) lib/action_dispatch/routing/route_set.rb:834:in `call'
|
2582
|
+
rack (2.0.3) lib/rack/etag.rb:25:in `call'
|
2583
|
+
rack (2.0.3) lib/rack/conditional_get.rb:25:in `call'
|
2584
|
+
rack (2.0.3) lib/rack/head.rb:12:in `call'
|
2585
|
+
rack (2.0.3) lib/rack/session/abstract/id.rb:232:in `context'
|
2586
|
+
rack (2.0.3) lib/rack/session/abstract/id.rb:226:in `call'
|
2587
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/cookies.rb:613:in `call'
|
2588
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
|
2589
|
+
activesupport (5.1.3) lib/active_support/callbacks.rb:97:in `run_callbacks'
|
2590
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
|
2591
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/executor.rb:12:in `call'
|
2592
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
|
2593
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
|
2594
|
+
railties (5.1.3) lib/rails/rack/logger.rb:36:in `call_app'
|
2595
|
+
railties (5.1.3) lib/rails/rack/logger.rb:24:in `block in call'
|
2596
|
+
activesupport (5.1.3) lib/active_support/tagged_logging.rb:69:in `block in tagged'
|
2597
|
+
activesupport (5.1.3) lib/active_support/tagged_logging.rb:26:in `tagged'
|
2598
|
+
activesupport (5.1.3) lib/active_support/tagged_logging.rb:69:in `tagged'
|
2599
|
+
railties (5.1.3) lib/rails/rack/logger.rb:24:in `call'
|
2600
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
|
2601
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/request_id.rb:25:in `call'
|
2602
|
+
rack (2.0.3) lib/rack/method_override.rb:22:in `call'
|
2603
|
+
rack (2.0.3) lib/rack/runtime.rb:22:in `call'
|
2604
|
+
activesupport (5.1.3) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
|
2605
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/executor.rb:12:in `call'
|
2606
|
+
actionpack (5.1.3) lib/action_dispatch/middleware/static.rb:125:in `call'
|
2607
|
+
rack (2.0.3) lib/rack/sendfile.rb:111:in `call'
|
2608
|
+
/home/dm/code/influxdb-rails/lib/influxdb/rails/rack.rb:14:in `_call'
|
2609
|
+
/home/dm/code/influxdb-rails/lib/influxdb/rails/rack.rb:9:in `call'
|
2610
|
+
railties (5.1.3) lib/rails/engine.rb:522:in `call'
|
2611
|
+
rack-test (0.6.3) lib/rack/mock_session.rb:30:in `request'
|
2612
|
+
rack-test (0.6.3) lib/rack/test.rb:244:in `process_request'
|
2613
|
+
rack-test (0.6.3) lib/rack/test.rb:124:in `request'
|
2614
|
+
actionpack (5.1.3) lib/action_dispatch/testing/integration.rb:261:in `process'
|
2615
|
+
actionpack (5.1.3) lib/action_dispatch/testing/integration.rb:16:in `get'
|
2616
|
+
actionpack (5.1.3) lib/action_dispatch/testing/integration.rb:348:in `block (2 levels) in <module:Runner>'
|
2617
|
+
/home/dm/code/influxdb-rails/spec/integration/exceptions_spec.rb:34:in `block (3 levels) in <top (required)>'
|
2618
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:254:in `instance_exec'
|
2619
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:254:in `block in run'
|
2620
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:500:in `block in with_around_and_singleton_context_hooks'
|
2621
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:457:in `block in with_around_example_hooks'
|
2622
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:464:in `block in run'
|
2623
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:604:in `block in run_around_example_hooks_for'
|
2624
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:342:in `call'
|
2625
|
+
rspec-rails (3.6.1) lib/rspec/rails/adapters.rb:127:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
|
2626
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:447:in `instance_exec'
|
2627
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:447:in `instance_exec'
|
2628
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:375:in `execute_with'
|
2629
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:606:in `block (2 levels) in run_around_example_hooks_for'
|
2630
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:342:in `call'
|
2631
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:607:in `run_around_example_hooks_for'
|
2632
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:464:in `run'
|
2633
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:457:in `with_around_example_hooks'
|
2634
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:500:in `with_around_and_singleton_context_hooks'
|
2635
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:251:in `run'
|
2636
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:627:in `block in run_examples'
|
2637
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:623:in `map'
|
2638
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:623:in `run_examples'
|
2639
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:589:in `run'
|
2640
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:590:in `block in run'
|
2641
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:590:in `map'
|
2642
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:590:in `run'
|
2643
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:118:in `block (3 levels) in run_specs'
|
2644
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:118:in `map'
|
2645
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:118:in `block (2 levels) in run_specs'
|
2646
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/configuration.rb:1894:in `with_suite_hooks'
|
2647
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:113:in `block in run_specs'
|
2648
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/reporter.rb:79:in `report'
|
2649
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:112:in `run_specs'
|
2650
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:87:in `run'
|
2651
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:71:in `run'
|
2652
|
+
/home/dm/.rbenv/versions/2.4.2/gemsets/influxdb/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:45:in `invoke'
|
2653
|
+
rspec-core (3.6.0) exe/rspec:4:in `<top (required)>'
|
2654
|
+
/home/dm/.rbenv/versions/2.4/gemsets/influxdb/bin/rspec:23:in `load'
|
2655
|
+
/home/dm/.rbenv/versions/2.4/gemsets/influxdb/bin/rspec:23:in `<top (required)>'
|
2656
|
+
bundler (1.16.0) lib/bundler/cli/exec.rb:75:in `load'
|
2657
|
+
bundler (1.16.0) lib/bundler/cli/exec.rb:75:in `kernel_load'
|
2658
|
+
bundler (1.16.0) lib/bundler/cli/exec.rb:28:in `run'
|
2659
|
+
bundler (1.16.0) lib/bundler/cli.rb:424:in `exec'
|
2660
|
+
bundler (1.16.0) lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
|
2661
|
+
bundler (1.16.0) lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
|
2662
|
+
bundler (1.16.0) lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
|
2663
|
+
bundler (1.16.0) lib/bundler/cli.rb:27:in `dispatch'
|
2664
|
+
bundler (1.16.0) lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
|
2665
|
+
bundler (1.16.0) lib/bundler/cli.rb:18:in `start'
|
2666
|
+
bundler (1.16.0) exe/bundle:30:in `block in <top (required)>'
|
2667
|
+
bundler (1.16.0) lib/bundler/friendly_errors.rb:122:in `with_friendly_errors'
|
2668
|
+
bundler (1.16.0) exe/bundle:22:in `<top (required)>'
|
2669
|
+
/home/dm/.rbenv/versions/2.4/gemsets/influxdb/bin/bundle:23:in `load'
|
2670
|
+
/home/dm/.rbenv/versions/2.4/gemsets/influxdb/bin/bundle:23:in `<main>'
|
2671
|
+
Started GET "/widgets" for 127.0.0.1 at 2017-12-12 21:01:58 +0100
|
2672
|
+
Processing by WidgetsController#index as HTML
|
2673
|
+
Completed 200 OK in 0ms
|
2674
|
+
Started GET "/widgets" for 127.0.0.1 at 2017-12-12 21:01:58 +0100
|
2675
|
+
Processing by WidgetsController#index as HTML
|
2676
|
+
Completed 200 OK in 0ms
|
@@ -86,4 +86,19 @@ RSpec.describe InfluxDB::Rails::Configuration do
|
|
86
86
|
expect(InfluxDB::Rails.configuration.max_delay).to eql(5)
|
87
87
|
end
|
88
88
|
end
|
89
|
+
|
90
|
+
describe "#time_precision" do
|
91
|
+
it "defaults to seconds" do
|
92
|
+
InfluxDB::Rails.configure do |config|
|
93
|
+
end
|
94
|
+
expect(InfluxDB::Rails.configuration.time_precision).to eql('s')
|
95
|
+
end
|
96
|
+
|
97
|
+
it "can be updated" do
|
98
|
+
InfluxDB::Rails.configure do |config|
|
99
|
+
config.time_precision = 'ms'
|
100
|
+
end
|
101
|
+
expect(InfluxDB::Rails.configuration.time_precision).to eql('ms')
|
102
|
+
end
|
103
|
+
end
|
89
104
|
end
|
@@ -5,6 +5,55 @@ RSpec.describe InfluxDB::Rails do
|
|
5
5
|
InfluxDB::Rails.configure { |config| config.ignored_environments = [] }
|
6
6
|
end
|
7
7
|
|
8
|
+
describe '.convert_timestamp' do
|
9
|
+
let(:sometime) { Time.parse('2017-12-11 16:20:29.111222333 UTC') }
|
10
|
+
let(:configuration) { double("Configuration") }
|
11
|
+
before { allow(InfluxDB::Rails).to receive(:configuration).and_return configuration }
|
12
|
+
|
13
|
+
it "should return the timestamp in nanoseconds when precision is 'ns'" do
|
14
|
+
allow(configuration).to receive(:time_precision).and_return('ns')
|
15
|
+
expect(InfluxDB::Rails.convert_timestamp(sometime)).to eq(1513009229111222272)
|
16
|
+
end
|
17
|
+
it "should return the timestamp in nanoseconds when precision is nil" do
|
18
|
+
allow(configuration).to receive(:time_precision)
|
19
|
+
expect(InfluxDB::Rails.convert_timestamp(sometime)).to eq(1513009229111222272)
|
20
|
+
end
|
21
|
+
it "should return the timestamp in microseconds when precision is u" do
|
22
|
+
allow(configuration).to receive(:time_precision).and_return('u')
|
23
|
+
expect(InfluxDB::Rails.convert_timestamp(sometime)).to eq(1513009229111222)
|
24
|
+
end
|
25
|
+
it "should return the timestamp in milliseconds when precision is ms" do
|
26
|
+
allow(configuration).to receive(:time_precision).and_return('ms')
|
27
|
+
expect(InfluxDB::Rails.convert_timestamp(sometime)).to eq(1513009229111)
|
28
|
+
end
|
29
|
+
it "should return the timestamp in seconds when precision is s" do
|
30
|
+
allow(configuration).to receive(:time_precision).and_return('s')
|
31
|
+
expect(InfluxDB::Rails.convert_timestamp(sometime)).to eq(1513009229)
|
32
|
+
end
|
33
|
+
it "should return the timestamp in minutes when precision is m" do
|
34
|
+
allow(configuration).to receive(:time_precision).and_return('m')
|
35
|
+
expect(InfluxDB::Rails.convert_timestamp(sometime)).to eq(25216820)
|
36
|
+
end
|
37
|
+
it "should return the timestamp in hours when precision is h" do
|
38
|
+
allow(configuration).to receive(:time_precision).and_return('h')
|
39
|
+
expect(InfluxDB::Rails.convert_timestamp(sometime)).to eq(420280)
|
40
|
+
end
|
41
|
+
it "should raise an excpetion when precision is unrecognized" do
|
42
|
+
allow(configuration).to receive(:time_precision).and_return('whatever')
|
43
|
+
expect{InfluxDB::Rails.convert_timestamp(sometime)}.
|
44
|
+
to raise_exception /invalid time precision.*whatever/i
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '.current_timestamp' do
|
49
|
+
it "should return the current timestamp in the configured precision" do
|
50
|
+
now = Time.parse('2017-12-11 16:20:29.111222333 UTC')
|
51
|
+
allow(Time).to receive(:now).and_return(now)
|
52
|
+
InfluxDB::Rails.configure {|config| config.time_precision = 'ms'}
|
53
|
+
expect(InfluxDB::Rails.current_timestamp).to eq(1513009229111)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
8
57
|
describe ".ignorable_exception?" do
|
9
58
|
it "should be true for exception types specified in the configuration" do
|
10
59
|
class DummyException < Exception; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: influxdb-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Persen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: influxdb
|
@@ -173,6 +173,7 @@ files:
|
|
173
173
|
- pkg/influxdb-rails-0.1.11.gem
|
174
174
|
- pkg/influxdb-rails-0.1.12.gem
|
175
175
|
- pkg/influxdb-rails-0.4.0.gem
|
176
|
+
- pkg/influxdb-rails-0.4.2.gem
|
176
177
|
- spec/controllers/widgets_controller_spec.rb
|
177
178
|
- spec/integration/exceptions_spec.rb
|
178
179
|
- spec/integration/integration_helper.rb
|