influxdb-rails 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +36 -3
- data/lib/influxdb/rails/railtie.rb +16 -12
- data/lib/influxdb/rails/version.rb +1 -1
- data/lib/rails/generators/influxdb/influxdb_generator.rb +3 -41
- data/lib/rails/generators/influxdb/templates/initializer.rb +6 -3
- data/spec/support/rails3/log/test.log +197 -0
- metadata +1 -3
- data/generators/influxdb/influxdb_generator.rb +0 -48
- data/generators/influxdb/templates/initializer.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4d2e2102adf47a57743dbce9895173b3a555214
|
4
|
+
data.tar.gz: 3fd1eb99c1afeb5d86fa01dc4c3c0e68342fa610
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a52155bbcf68d69b875417e740315777c016a073dde670579fcd61a4c0078c0c370c8a6d2223562f70ef8e79753348667ddcef590d0a4c9fc68597e353ec578
|
7
|
+
data.tar.gz: d339042277e17cfb5c78fa6fcd3d4a84f0bcd4e8f8db379b634d65edd28277fc25cd129ab4e87185f63f177f061388868948ea39508bf2686970e68da2240eac
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,36 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
influxdb-ruby
|
2
|
+
=============
|
3
|
+
|
4
|
+
[](https://travis-ci.org/influxdb/influxdb-rails)
|
5
|
+
|
6
|
+
Auotmatically instrument your Ruby on Rails applications and write the metrics directly into [InfluxDB](http://influxdb.org/).
|
7
|
+
|
8
|
+
Install
|
9
|
+
-------
|
10
|
+
|
11
|
+
```
|
12
|
+
$ [sudo] gem install influxdb-rails
|
13
|
+
```
|
14
|
+
|
15
|
+
Or add it to your `Gemfile`, etc.
|
16
|
+
|
17
|
+
Usage
|
18
|
+
-----
|
19
|
+
|
20
|
+
Create a barebones initializer:
|
21
|
+
|
22
|
+
```
|
23
|
+
$ rails g influxdb
|
24
|
+
```
|
25
|
+
|
26
|
+
Then, you can edit the file at `config/initializers/influxdb-rails.rb`. The default config should look like this:
|
27
|
+
|
28
|
+
``` ruby
|
29
|
+
InfluxDB::Rails.configure do |config|
|
30
|
+
config.influxdb_database = "rails"
|
31
|
+
config.influxdb_username = "root"
|
32
|
+
config.influxdb_password = "root"
|
33
|
+
config.influxdb_host = "localhost"
|
34
|
+
config.influxdb_port = 8086
|
35
|
+
end
|
36
|
+
```
|
@@ -44,20 +44,24 @@ module InfluxDB
|
|
44
44
|
action_name = payload[:action]
|
45
45
|
hostname = Socket.gethostname
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
begin
|
48
|
+
InfluxDB::Rails.client.write_point "rails.controllers",
|
49
|
+
:value => controller_runtime,
|
50
|
+
:method => "#{controller_name}##{action_name}",
|
51
|
+
:server => hostname
|
51
52
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
53
|
+
InfluxDB::Rails.client.write_point "rails.views",
|
54
|
+
:value => view_runtime,
|
55
|
+
:method => "#{controller_name}##{action_name}",
|
56
|
+
:server => hostname
|
56
57
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
InfluxDB::Rails.client.write_point "rails.db",
|
59
|
+
:value => db_runtime,
|
60
|
+
:method => "#{controller_name}##{action_name}",
|
61
|
+
:server => hostname
|
62
|
+
rescue => e
|
63
|
+
::Rails.logger.error "[InfluxDB::Rails] Failed writing points to InfluxDB: #{e.message}"
|
64
|
+
end
|
61
65
|
end
|
62
66
|
end
|
63
67
|
end
|
@@ -1,50 +1,12 @@
|
|
1
1
|
require 'rails/generators'
|
2
2
|
|
3
|
-
class
|
4
|
-
desc "Description:\n This creates a Rails initializer for InfluxDB."
|
5
|
-
|
6
|
-
begin
|
7
|
-
if ARGV.count == 1
|
8
|
-
puts "No Application ID provided, contacting InfluxDB API."
|
9
|
-
application_name = Rails.application.class.parent_name || "NewApplication"
|
10
|
-
api_key = ARGV.first
|
11
|
-
|
12
|
-
connection = Net::HTTP.new("influxdb.com", 443)
|
13
|
-
connection.use_ssl = true
|
14
|
-
connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
15
|
-
url = "/api/v1/applications?api_key=#{api_key}&name=#{application_name}"
|
16
|
-
response = connection.post(url, nil)
|
17
|
-
|
18
|
-
unless response.is_a?(Net::HTTPSuccess)
|
19
|
-
raise "The InfluxDB API returned an error: #{response.inspect}"
|
20
|
-
end
|
21
|
-
|
22
|
-
@application = JSON.parse(response.body)
|
23
|
-
@application_id = @application["key"]
|
24
|
-
else
|
25
|
-
@application_id = ARGV[1]
|
26
|
-
end
|
27
|
-
puts "Received Application ID: #{@application_id}"
|
28
|
-
|
29
|
-
rescue => e
|
30
|
-
puts "We ran into a problem creating your application via the API!"
|
31
|
-
puts "If this issue persists, contact us at support@influxdb.com with the following details:"
|
32
|
-
puts "#{e.class}: #{e.message}"
|
33
|
-
end
|
3
|
+
class InfluxdbGenerator < Rails::Generators::Base
|
4
|
+
desc "Description:\n This creates a Rails initializer for InfluxDB::Rails."
|
34
5
|
|
35
6
|
source_root File.expand_path('../templates', __FILE__)
|
36
|
-
argument :api_key,
|
37
|
-
:required => true,
|
38
|
-
:type => :string,
|
39
|
-
:description => "API key for your InfluxDB organization"
|
40
|
-
argument :application_id,
|
41
|
-
:required => false,
|
42
|
-
:default => @application_id,
|
43
|
-
:type => :string,
|
44
|
-
:description => "Identifier for this application (Leave blank and a new one will be generated for you)"
|
45
7
|
|
46
8
|
def copy_initializer_file
|
47
|
-
template "initializer.rb", "config/initializers/influxdb.rb"
|
9
|
+
template "initializer.rb", "config/initializers/influxdb-rails.rb"
|
48
10
|
end
|
49
11
|
|
50
12
|
def install
|
@@ -1,4 +1,7 @@
|
|
1
|
-
InfluxDB.configure do |config|
|
2
|
-
config.
|
3
|
-
config.
|
1
|
+
InfluxDB::Rails.configure do |config|
|
2
|
+
config.influxdb_database = "rails"
|
3
|
+
config.influxdb_username = "root"
|
4
|
+
config.influxdb_password = "root"
|
5
|
+
config.influxdb_host = "localhost"
|
6
|
+
config.influxdb_port = 8086
|
4
7
|
end
|
@@ -1315,3 +1315,200 @@ ZeroDivisionError (divided by 0):
|
|
1315
1315
|
rspec-core (2.14.7) lib/rspec/core/runner.rb:17:in `block in autorun'
|
1316
1316
|
|
1317
1317
|
|
1318
|
+
Processing by WidgetsController#new as HTML
|
1319
|
+
Completed 500 Internal Server Error in 0.2ms
|
1320
|
+
Processing by WidgetsController#index as HTML
|
1321
|
+
Completed 200 OK in 3.3ms (Views: 3.1ms)
|
1322
|
+
Started GET "/widgets/new" for 127.0.0.1 at 2014-02-06 10:35:06 -0500
|
1323
|
+
Processing by WidgetsController#new as HTML
|
1324
|
+
Completed 500 Internal Server Error in 0.2ms
|
1325
|
+
|
1326
|
+
ZeroDivisionError (divided by 0):
|
1327
|
+
app.rb:21:in `/'
|
1328
|
+
app.rb:21:in `new'
|
1329
|
+
actionpack (3.2.16) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
|
1330
|
+
actionpack (3.2.16) lib/abstract_controller/base.rb:167:in `process_action'
|
1331
|
+
actionpack (3.2.16) lib/action_controller/metal/rendering.rb:10:in `process_action'
|
1332
|
+
actionpack (3.2.16) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
|
1333
|
+
activesupport (3.2.16) lib/active_support/callbacks.rb:403:in `_run__682091271386062884__process_action__4572857168915241472__callbacks'
|
1334
|
+
activesupport (3.2.16) lib/active_support/callbacks.rb:405:in `__run_callback'
|
1335
|
+
activesupport (3.2.16) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
|
1336
|
+
activesupport (3.2.16) lib/active_support/callbacks.rb:81:in `run_callbacks'
|
1337
|
+
actionpack (3.2.16) lib/abstract_controller/callbacks.rb:17:in `process_action'
|
1338
|
+
actionpack (3.2.16) lib/action_controller/metal/rescue.rb:29:in `process_action'
|
1339
|
+
actionpack (3.2.16) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
|
1340
|
+
activesupport (3.2.16) lib/active_support/notifications.rb:123:in `block in instrument'
|
1341
|
+
activesupport (3.2.16) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
|
1342
|
+
activesupport (3.2.16) lib/active_support/notifications.rb:123:in `instrument'
|
1343
|
+
actionpack (3.2.16) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
|
1344
|
+
actionpack (3.2.16) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
|
1345
|
+
actionpack (3.2.16) lib/abstract_controller/base.rb:121:in `process'
|
1346
|
+
actionpack (3.2.16) lib/abstract_controller/rendering.rb:45:in `process'
|
1347
|
+
actionpack (3.2.16) lib/action_controller/metal.rb:203:in `dispatch'
|
1348
|
+
actionpack (3.2.16) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
|
1349
|
+
actionpack (3.2.16) lib/action_controller/metal.rb:246:in `block in action'
|
1350
|
+
actionpack (3.2.16) lib/action_dispatch/routing/route_set.rb:73:in `call'
|
1351
|
+
actionpack (3.2.16) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
|
1352
|
+
actionpack (3.2.16) lib/action_dispatch/routing/route_set.rb:36:in `call'
|
1353
|
+
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
|
1354
|
+
journey (1.0.4) lib/journey/router.rb:56:in `each'
|
1355
|
+
journey (1.0.4) lib/journey/router.rb:56:in `call'
|
1356
|
+
actionpack (3.2.16) lib/action_dispatch/routing/route_set.rb:608:in `call'
|
1357
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
|
1358
|
+
rack (1.4.5) lib/rack/etag.rb:23:in `call'
|
1359
|
+
rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
|
1360
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/head.rb:14:in `call'
|
1361
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
|
1362
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/flash.rb:242:in `call'
|
1363
|
+
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
|
1364
|
+
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
|
1365
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/cookies.rb:341:in `call'
|
1366
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
|
1367
|
+
activesupport (3.2.16) lib/active_support/callbacks.rb:405:in `_run__1036366607905738123__call__1303541158859513__callbacks'
|
1368
|
+
activesupport (3.2.16) lib/active_support/callbacks.rb:405:in `__run_callback'
|
1369
|
+
activesupport (3.2.16) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
|
1370
|
+
activesupport (3.2.16) lib/active_support/callbacks.rb:81:in `run_callbacks'
|
1371
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
|
1372
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/reloader.rb:65:in `call'
|
1373
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
|
1374
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
|
1375
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
|
1376
|
+
railties (3.2.16) lib/rails/rack/logger.rb:32:in `call_app'
|
1377
|
+
railties (3.2.16) lib/rails/rack/logger.rb:16:in `block in call'
|
1378
|
+
activesupport (3.2.16) lib/active_support/tagged_logging.rb:22:in `tagged'
|
1379
|
+
railties (3.2.16) lib/rails/rack/logger.rb:16:in `call'
|
1380
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/request_id.rb:22:in `call'
|
1381
|
+
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
|
1382
|
+
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
|
1383
|
+
activesupport (3.2.16) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
|
1384
|
+
rack (1.4.5) lib/rack/lock.rb:15:in `call'
|
1385
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/static.rb:63:in `call'
|
1386
|
+
/Users/todd/Projects/influxdb/influxdb-rails/lib/influxdb/rails/rack.rb:14:in `_call'
|
1387
|
+
/Users/todd/Projects/influxdb/influxdb-rails/lib/influxdb/rails/rack.rb:9:in `call'
|
1388
|
+
railties (3.2.16) lib/rails/engine.rb:484:in `call'
|
1389
|
+
railties (3.2.16) lib/rails/application.rb:231:in `call'
|
1390
|
+
rack-test (0.6.2) lib/rack/mock_session.rb:30:in `request'
|
1391
|
+
rack-test (0.6.2) lib/rack/test.rb:230:in `process_request'
|
1392
|
+
rack-test (0.6.2) lib/rack/test.rb:123:in `request'
|
1393
|
+
actionpack (3.2.16) lib/action_dispatch/testing/integration.rb:299:in `process'
|
1394
|
+
actionpack (3.2.16) lib/action_dispatch/testing/integration.rb:33:in `get'
|
1395
|
+
actionpack (3.2.16) lib/action_dispatch/testing/integration.rb:333:in `block (2 levels) in <module:Runner>'
|
1396
|
+
/Users/todd/Projects/influxdb/influxdb-rails/spec/integration/exceptions_spec.rb:14:in `block (3 levels) in <top (required)>'
|
1397
|
+
rspec-core (2.14.7) lib/rspec/core/example.rb:114:in `instance_eval'
|
1398
|
+
rspec-core (2.14.7) lib/rspec/core/example.rb:114:in `block in run'
|
1399
|
+
rspec-core (2.14.7) lib/rspec/core/example.rb:254:in `with_around_each_hooks'
|
1400
|
+
rspec-core (2.14.7) lib/rspec/core/example.rb:111:in `run'
|
1401
|
+
rspec-core (2.14.7) lib/rspec/core/example_group.rb:390:in `block in run_examples'
|
1402
|
+
rspec-core (2.14.7) lib/rspec/core/example_group.rb:386:in `map'
|
1403
|
+
rspec-core (2.14.7) lib/rspec/core/example_group.rb:386:in `run_examples'
|
1404
|
+
rspec-core (2.14.7) lib/rspec/core/example_group.rb:371:in `run'
|
1405
|
+
rspec-core (2.14.7) lib/rspec/core/example_group.rb:372:in `block in run'
|
1406
|
+
rspec-core (2.14.7) lib/rspec/core/example_group.rb:372:in `map'
|
1407
|
+
rspec-core (2.14.7) lib/rspec/core/example_group.rb:372:in `run'
|
1408
|
+
rspec-core (2.14.7) lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
|
1409
|
+
rspec-core (2.14.7) lib/rspec/core/command_line.rb:28:in `map'
|
1410
|
+
rspec-core (2.14.7) lib/rspec/core/command_line.rb:28:in `block in run'
|
1411
|
+
rspec-core (2.14.7) lib/rspec/core/reporter.rb:58:in `report'
|
1412
|
+
rspec-core (2.14.7) lib/rspec/core/command_line.rb:25:in `run'
|
1413
|
+
rspec-core (2.14.7) lib/rspec/core/runner.rb:80:in `run'
|
1414
|
+
rspec-core (2.14.7) lib/rspec/core/runner.rb:17:in `block in autorun'
|
1415
|
+
|
1416
|
+
|
1417
|
+
Started GET "/widgets" for 127.0.0.1 at 2014-02-06 10:35:06 -0500
|
1418
|
+
Processing by WidgetsController#index as HTML
|
1419
|
+
Completed 200 OK in 0.3ms (Views: 0.2ms)
|
1420
|
+
Started GET "/widgets/new" for 127.0.0.1 at 2014-02-06 10:35:06 -0500
|
1421
|
+
Processing by WidgetsController#new as HTML
|
1422
|
+
Completed 500 Internal Server Error in 0.2ms
|
1423
|
+
|
1424
|
+
ZeroDivisionError (divided by 0):
|
1425
|
+
app.rb:21:in `/'
|
1426
|
+
app.rb:21:in `new'
|
1427
|
+
actionpack (3.2.16) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
|
1428
|
+
actionpack (3.2.16) lib/abstract_controller/base.rb:167:in `process_action'
|
1429
|
+
actionpack (3.2.16) lib/action_controller/metal/rendering.rb:10:in `process_action'
|
1430
|
+
actionpack (3.2.16) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
|
1431
|
+
activesupport (3.2.16) lib/active_support/callbacks.rb:403:in `_run__682091271386062884__process_action__4572857168915241472__callbacks'
|
1432
|
+
activesupport (3.2.16) lib/active_support/callbacks.rb:405:in `__run_callback'
|
1433
|
+
activesupport (3.2.16) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
|
1434
|
+
activesupport (3.2.16) lib/active_support/callbacks.rb:81:in `run_callbacks'
|
1435
|
+
actionpack (3.2.16) lib/abstract_controller/callbacks.rb:17:in `process_action'
|
1436
|
+
actionpack (3.2.16) lib/action_controller/metal/rescue.rb:29:in `process_action'
|
1437
|
+
actionpack (3.2.16) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
|
1438
|
+
activesupport (3.2.16) lib/active_support/notifications.rb:123:in `block in instrument'
|
1439
|
+
activesupport (3.2.16) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
|
1440
|
+
activesupport (3.2.16) lib/active_support/notifications.rb:123:in `instrument'
|
1441
|
+
actionpack (3.2.16) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
|
1442
|
+
actionpack (3.2.16) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
|
1443
|
+
actionpack (3.2.16) lib/abstract_controller/base.rb:121:in `process'
|
1444
|
+
actionpack (3.2.16) lib/abstract_controller/rendering.rb:45:in `process'
|
1445
|
+
actionpack (3.2.16) lib/action_controller/metal.rb:203:in `dispatch'
|
1446
|
+
actionpack (3.2.16) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
|
1447
|
+
actionpack (3.2.16) lib/action_controller/metal.rb:246:in `block in action'
|
1448
|
+
actionpack (3.2.16) lib/action_dispatch/routing/route_set.rb:73:in `call'
|
1449
|
+
actionpack (3.2.16) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
|
1450
|
+
actionpack (3.2.16) lib/action_dispatch/routing/route_set.rb:36:in `call'
|
1451
|
+
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
|
1452
|
+
journey (1.0.4) lib/journey/router.rb:56:in `each'
|
1453
|
+
journey (1.0.4) lib/journey/router.rb:56:in `call'
|
1454
|
+
actionpack (3.2.16) lib/action_dispatch/routing/route_set.rb:608:in `call'
|
1455
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
|
1456
|
+
rack (1.4.5) lib/rack/etag.rb:23:in `call'
|
1457
|
+
rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
|
1458
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/head.rb:14:in `call'
|
1459
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
|
1460
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/flash.rb:242:in `call'
|
1461
|
+
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
|
1462
|
+
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
|
1463
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/cookies.rb:341:in `call'
|
1464
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
|
1465
|
+
activesupport (3.2.16) lib/active_support/callbacks.rb:405:in `_run__1036366607905738123__call__1303541158859513__callbacks'
|
1466
|
+
activesupport (3.2.16) lib/active_support/callbacks.rb:405:in `__run_callback'
|
1467
|
+
activesupport (3.2.16) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
|
1468
|
+
activesupport (3.2.16) lib/active_support/callbacks.rb:81:in `run_callbacks'
|
1469
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
|
1470
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/reloader.rb:65:in `call'
|
1471
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
|
1472
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
|
1473
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
|
1474
|
+
railties (3.2.16) lib/rails/rack/logger.rb:32:in `call_app'
|
1475
|
+
railties (3.2.16) lib/rails/rack/logger.rb:16:in `block in call'
|
1476
|
+
activesupport (3.2.16) lib/active_support/tagged_logging.rb:22:in `tagged'
|
1477
|
+
railties (3.2.16) lib/rails/rack/logger.rb:16:in `call'
|
1478
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/request_id.rb:22:in `call'
|
1479
|
+
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
|
1480
|
+
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
|
1481
|
+
activesupport (3.2.16) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
|
1482
|
+
rack (1.4.5) lib/rack/lock.rb:15:in `call'
|
1483
|
+
actionpack (3.2.16) lib/action_dispatch/middleware/static.rb:63:in `call'
|
1484
|
+
/Users/todd/Projects/influxdb/influxdb-rails/lib/influxdb/rails/rack.rb:14:in `_call'
|
1485
|
+
/Users/todd/Projects/influxdb/influxdb-rails/lib/influxdb/rails/rack.rb:9:in `call'
|
1486
|
+
railties (3.2.16) lib/rails/engine.rb:484:in `call'
|
1487
|
+
railties (3.2.16) lib/rails/application.rb:231:in `call'
|
1488
|
+
rack-test (0.6.2) lib/rack/mock_session.rb:30:in `request'
|
1489
|
+
rack-test (0.6.2) lib/rack/test.rb:230:in `process_request'
|
1490
|
+
rack-test (0.6.2) lib/rack/test.rb:123:in `request'
|
1491
|
+
actionpack (3.2.16) lib/action_dispatch/testing/integration.rb:299:in `process'
|
1492
|
+
actionpack (3.2.16) lib/action_dispatch/testing/integration.rb:33:in `get'
|
1493
|
+
actionpack (3.2.16) lib/action_dispatch/testing/integration.rb:333:in `block (2 levels) in <module:Runner>'
|
1494
|
+
/Users/todd/Projects/influxdb/influxdb-rails/spec/integration/exceptions_spec.rb:33:in `block (3 levels) in <top (required)>'
|
1495
|
+
rspec-core (2.14.7) lib/rspec/core/example.rb:114:in `instance_eval'
|
1496
|
+
rspec-core (2.14.7) lib/rspec/core/example.rb:114:in `block in run'
|
1497
|
+
rspec-core (2.14.7) lib/rspec/core/example.rb:254:in `with_around_each_hooks'
|
1498
|
+
rspec-core (2.14.7) lib/rspec/core/example.rb:111:in `run'
|
1499
|
+
rspec-core (2.14.7) lib/rspec/core/example_group.rb:390:in `block in run_examples'
|
1500
|
+
rspec-core (2.14.7) lib/rspec/core/example_group.rb:386:in `map'
|
1501
|
+
rspec-core (2.14.7) lib/rspec/core/example_group.rb:386:in `run_examples'
|
1502
|
+
rspec-core (2.14.7) lib/rspec/core/example_group.rb:371:in `run'
|
1503
|
+
rspec-core (2.14.7) lib/rspec/core/example_group.rb:372:in `block in run'
|
1504
|
+
rspec-core (2.14.7) lib/rspec/core/example_group.rb:372:in `map'
|
1505
|
+
rspec-core (2.14.7) lib/rspec/core/example_group.rb:372:in `run'
|
1506
|
+
rspec-core (2.14.7) lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
|
1507
|
+
rspec-core (2.14.7) lib/rspec/core/command_line.rb:28:in `map'
|
1508
|
+
rspec-core (2.14.7) lib/rspec/core/command_line.rb:28:in `block in run'
|
1509
|
+
rspec-core (2.14.7) lib/rspec/core/reporter.rb:58:in `report'
|
1510
|
+
rspec-core (2.14.7) lib/rspec/core/command_line.rb:25:in `run'
|
1511
|
+
rspec-core (2.14.7) lib/rspec/core/runner.rb:80:in `run'
|
1512
|
+
rspec-core (2.14.7) lib/rspec/core/runner.rb:17:in `block in autorun'
|
1513
|
+
|
1514
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: influxdb-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Persen
|
@@ -157,8 +157,6 @@ files:
|
|
157
157
|
- gemfiles/Gemfile.rails-3.2.x.lock
|
158
158
|
- gemfiles/Gemfile.rails-4.0.x
|
159
159
|
- gemfiles/Gemfile.rails-4.0.x.lock
|
160
|
-
- generators/influxdb/influxdb_generator.rb
|
161
|
-
- generators/influxdb/templates/initializer.rb
|
162
160
|
- influxdb-rails.gemspec
|
163
161
|
- lib/influxdb-rails.rb
|
164
162
|
- lib/influxdb/rails/air_traffic_controller.rb
|
@@ -1,48 +0,0 @@
|
|
1
|
-
class InfluxDBGenerator < Rails::Generator::Base
|
2
|
-
def add_options!(option)
|
3
|
-
option.on("-k", "--api-key=API_KEY", String, "API key for your InfluxDB organization") {|v| options[:api_key] = v}
|
4
|
-
option.on("-a", "--application-id=APP_ID", String, "Your InfluxDB application id (optional)") {|v| options[:application_id] = v}
|
5
|
-
end
|
6
|
-
|
7
|
-
def manifest
|
8
|
-
if options[:api_key].blank?
|
9
|
-
puts "You must provide an API key using -k or --api-key."
|
10
|
-
exit
|
11
|
-
end
|
12
|
-
|
13
|
-
begin
|
14
|
-
puts "Contacting InfluxDB API"
|
15
|
-
application_name = "ApplicationName"
|
16
|
-
api_key = options[:api_key]
|
17
|
-
|
18
|
-
connection = Net::HTTP.new("influxdb.com", 443)
|
19
|
-
connection.use_ssl = true
|
20
|
-
connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
21
|
-
url = "/api/v1/applications?api_key=#{api_key}&name=#{application_name}"
|
22
|
-
response = connection.post(url, nil)
|
23
|
-
|
24
|
-
@application = JSON.parse(response.body)
|
25
|
-
|
26
|
-
unless response.is_a?(Net::HTTPSuccess)
|
27
|
-
raise "The InfluxDB API returned an error: #{response.inspect}"
|
28
|
-
end
|
29
|
-
rescue => e
|
30
|
-
puts "We ran into a problem creating your application via the API!"
|
31
|
-
puts "If this issue persists, contact us at support@influxdb.com with the following details:"
|
32
|
-
puts "API Key: #{e.class}: #{options[:api_key]}"
|
33
|
-
puts "#{e.class}: #{e.message}"
|
34
|
-
end
|
35
|
-
|
36
|
-
record do |m|
|
37
|
-
m.template "initializer.rb", "config/initializers/influxdb.rb",
|
38
|
-
:assigns => {
|
39
|
-
:application_id => options[:application_id] || @application["key"] || secure_random.hex(4),
|
40
|
-
:api_key => options[:api_key]
|
41
|
-
}
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def secure_random
|
46
|
-
defined?(SecureRandom) ? SecureRandom : ActiveSupport::SecureRandom
|
47
|
-
end
|
48
|
-
end
|