librato-rails 0.7.1 → 0.7.2

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.
@@ -1,5 +1,5 @@
1
1
  module Librato
2
2
  module Rails
3
- VERSION = "0.7.1"
3
+ VERSION = "0.7.2"
4
4
  end
5
5
  end
data/lib/librato/rails.rb CHANGED
@@ -54,13 +54,17 @@ module Librato
54
54
 
55
55
  # detect / update configuration
56
56
  def check_config
57
+ self.log_level = ENV['LIBRATO_METRICS_LOG_LEVEL'] if ENV['LIBRATO_METRICS_LOG_LEVEL']
57
58
  if self.config_file && File.exists?(self.config_file)
58
- log :debug, "configuration file present, ignoring ENV variables"
59
- env_specific = YAML.load(ERB.new(File.read(config_file)).result)[::Rails.env]
60
- settable = CONFIG_SETTABLE & env_specific.keys
61
- settable.each { |key| self.send("#{key}=", env_specific[key]) }
59
+ log :debug, "configuring with librato.yml; ignoring environment variables.."
60
+ if env_specific = YAML.load(ERB.new(File.read(config_file)).result)[::Rails.env]
61
+ settable = CONFIG_SETTABLE & env_specific.keys
62
+ settable.each { |key| self.send("#{key}=", env_specific[key]) }
63
+ else
64
+ log :debug, "current environment not in config file, halting"
65
+ end
62
66
  else
63
- log :debug, "no configuration file present, using ENV variables"
67
+ log :debug, "using environment variables for configuration.."
64
68
  %w{user token source log_level}.each do |settable|
65
69
  env_var = "LIBRATO_METRICS_#{settable.upcase}"
66
70
  send("#{settable}=", ENV[env_var]) if ENV[env_var]
@@ -92,7 +96,7 @@ module Librato
92
96
  def flush
93
97
  log :debug, "flushing pid #{@pid} (#{Time.now}).."
94
98
  start = Time.now
95
- queue = client.new_queue(:source => qualified_source,
99
+ queue = client.new_queue(:source => qualified_source,
96
100
  :prefix => self.prefix, :skip_measurement_times => true)
97
101
  # thread safety is handled internally for both stores
98
102
  counters.flush_to(queue)
@@ -197,13 +201,6 @@ module Librato
197
201
  FORKING_SERVERS.include?(app_server)
198
202
  end
199
203
 
200
- # there isn't anything in the environment before the
201
- # first request to know if we're running on heroku, but
202
- # they set all hostnames to UUIDs.
203
- def implicit_source_on_heroku?
204
- !explicit_source && on_heroku
205
- end
206
-
207
204
  def logger
208
205
  @logger ||= if on_heroku
209
206
  logger = Logger.new(STDOUT)
@@ -239,8 +236,15 @@ module Librato
239
236
  end
240
237
 
241
238
  def should_start?
242
- return false if implicit_source_on_heroku?
243
- self.user && self.token # are credentials present?
239
+ if !self.user || !self.token
240
+ log :debug, 'credentials not present, halting..'
241
+ false
242
+ elsif !explicit_source && on_heroku
243
+ log :debug, 'source must be set, halting..'
244
+ false
245
+ else
246
+ true
247
+ end
244
248
  end
245
249
 
246
250
  def source_is_uuid?(source)
@@ -4299,3 +4299,251 @@ Completed 200 OK in 302ms (Views: 0.6ms | ActiveRecord: 0.0ms)
4299
4299
  SQL (0.1ms) DELETE FROM "users" WHERE "users"."id" = ? [["id", 1]]
4300
4300
   (0.0ms) RELEASE SAVEPOINT active_record_1
4301
4301
   (0.6ms) rollback transaction
4302
+ Connecting to database specified by database.yml
4303
+  (0.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
4304
+ Migrating to CreateUsers (20120719231810)
4305
+  (0.1ms) begin transaction
4306
+
4307
+
4308
+ Started GET "/custom" for 127.0.0.1 at 2012-11-06 09:33:21 -0600
4309
+ Processing by HomeController#custom as HTML
4310
+ Rendered text template (0.0ms)
4311
+ Completed 200 OK in 38ms (Views: 10.9ms | ActiveRecord: 0.3ms)
4312
+  (0.1ms) rollback transaction
4313
+  (0.0ms) begin transaction
4314
+
4315
+
4316
+ Started GET "/custom" for 127.0.0.1 at 2012-11-06 09:33:21 -0600
4317
+ Processing by HomeController#custom as HTML
4318
+ Rendered text template (0.0ms)
4319
+ Completed 200 OK in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
4320
+  (0.1ms) rollback transaction
4321
+  (0.0ms) begin transaction
4322
+
4323
+
4324
+ Started GET "/custom" for 127.0.0.1 at 2012-11-06 09:33:21 -0600
4325
+ Processing by HomeController#custom as HTML
4326
+ Rendered text template (0.0ms)
4327
+ Completed 200 OK in 0ms (Views: 0.2ms | ActiveRecord: 0.0ms)
4328
+  (0.0ms) rollback transaction
4329
+  (0.1ms) begin transaction
4330
+  (0.1ms) rollback transaction
4331
+  (0.0ms) begin transaction
4332
+  (0.1ms) rollback transaction
4333
+  (0.0ms) begin transaction
4334
+  (0.1ms) rollback transaction
4335
+  (0.0ms) begin transaction
4336
+  (0.1ms) rollback transaction
4337
+  (0.0ms) begin transaction
4338
+  (0.1ms) rollback transaction
4339
+  (0.0ms) begin transaction
4340
+  (0.1ms) rollback transaction
4341
+  (0.0ms) begin transaction
4342
+  (0.0ms) rollback transaction
4343
+  (0.0ms) begin transaction
4344
+  (0.0ms) rollback transaction
4345
+  (0.0ms) begin transaction
4346
+  (0.0ms) rollback transaction
4347
+  (0.0ms) begin transaction
4348
+  (0.0ms) rollback transaction
4349
+  (0.0ms) begin transaction
4350
+  (0.0ms) rollback transaction
4351
+  (0.0ms) begin transaction
4352
+  (0.0ms) rollback transaction
4353
+  (0.0ms) begin transaction
4354
+  (0.0ms) rollback transaction
4355
+  (0.0ms) begin transaction
4356
+  (0.0ms) rollback transaction
4357
+  (0.1ms) begin transaction
4358
+  (0.1ms) SAVEPOINT active_record_1
4359
+ SQL (8.8ms) INSERT INTO "users" ("created_at", "email", "password", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Tue, 06 Nov 2012 15:33:22 UTC +00:00], ["email", "foo@foo.com"], ["password", "wow"], ["updated_at", Tue, 06 Nov 2012 15:33:22 UTC +00:00]]
4360
+  (0.1ms) RELEASE SAVEPOINT active_record_1
4361
+ Rendered user_mailer/welcome_email.text.erb (2.5ms)
4362
+
4363
+ Sent mail to foo@foo.com (52ms)
4364
+ Date: Tue, 06 Nov 2012 09:33:23 -0600
4365
+ From: from@librato-rails.com
4366
+ To: foo@foo.com
4367
+ Message-ID: <50992dc36690_194b3fd788c34cdc773e@Arcas.local.mail>
4368
+ Subject: Why Howdy!
4369
+ Mime-Version: 1.0
4370
+ Content-Type: text/plain;
4371
+ charset=UTF-8
4372
+ Content-Transfer-Encoding: 7bit
4373
+
4374
+ This is a sample email, yay!
4375
+  (0.4ms) rollback transaction
4376
+  (0.1ms) begin transaction
4377
+
4378
+
4379
+ Started GET "/" for 127.0.0.1 at 2012-11-06 09:33:23 -0600
4380
+ Processing by HomeController#index as HTML
4381
+ Rendered home/index.html.erb within layouts/application (0.5ms)
4382
+ Completed 200 OK in 5ms (Views: 4.8ms | ActiveRecord: 0.0ms)
4383
+
4384
+
4385
+ Started GET "/status/204" for 127.0.0.1 at 2012-11-06 09:33:23 -0600
4386
+ Processing by StatusController#index as HTML
4387
+ Parameters: {"code"=>"204"}
4388
+ Rendered text template (0.0ms)
4389
+ Completed 204 No Content in 2ms (Views: 1.3ms | ActiveRecord: 0.0ms)
4390
+  (0.1ms) rollback transaction
4391
+  (0.1ms) begin transaction
4392
+
4393
+
4394
+ Started GET "/" for 127.0.0.1 at 2012-11-06 09:33:23 -0600
4395
+ Processing by HomeController#index as HTML
4396
+ Rendered home/index.html.erb within layouts/application (0.1ms)
4397
+ Completed 200 OK in 2ms (Views: 2.1ms | ActiveRecord: 0.0ms)
4398
+  (0.1ms) rollback transaction
4399
+  (0.1ms) begin transaction
4400
+
4401
+
4402
+ Started GET "/exception" for 127.0.0.1 at 2012-11-06 09:33:23 -0600
4403
+ Processing by HomeController#boom as HTML
4404
+ Completed 500 Internal Server Error in 1ms
4405
+  (0.1ms) rollback transaction
4406
+  (0.1ms) begin transaction
4407
+
4408
+
4409
+ Started GET "/slow" for 127.0.0.1 at 2012-11-06 09:33:23 -0600
4410
+ Processing by HomeController#slow as HTML
4411
+ Rendered text template (0.0ms)
4412
+ Completed 200 OK in 302ms (Views: 0.6ms | ActiveRecord: 0.0ms)
4413
+  (0.1ms) rollback transaction
4414
+  (0.1ms) begin transaction
4415
+  (0.1ms) SAVEPOINT active_record_1
4416
+ SQL (0.6ms) INSERT INTO "users" ("created_at", "email", "password", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Tue, 06 Nov 2012 15:33:23 UTC +00:00], ["email", "foo@foo.com"], ["password", "wow"], ["updated_at", Tue, 06 Nov 2012 15:33:23 UTC +00:00]]
4417
+  (0.1ms) RELEASE SAVEPOINT active_record_1
4418
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'foo@foo.com' LIMIT 1
4419
+  (0.0ms) SAVEPOINT active_record_1
4420
+  (0.4ms) UPDATE "users" SET "password" = 'new password', "updated_at" = '2012-11-06 15:33:23.405283' WHERE "users"."id" = 1
4421
+  (0.0ms) RELEASE SAVEPOINT active_record_1
4422
+  (0.0ms) SAVEPOINT active_record_1
4423
+ SQL (0.1ms) DELETE FROM "users" WHERE "users"."id" = ? [["id", 1]]
4424
+  (0.0ms) RELEASE SAVEPOINT active_record_1
4425
+  (0.5ms) rollback transaction
4426
+ Connecting to database specified by database.yml
4427
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
4428
+ Migrating to CreateUsers (20120719231810)
4429
+  (0.1ms) begin transaction
4430
+
4431
+
4432
+ Started GET "/custom" for 127.0.0.1 at 2012-11-06 10:06:37 -0600
4433
+ Processing by HomeController#custom as HTML
4434
+ Rendered text template (0.0ms)
4435
+ Completed 200 OK in 36ms (Views: 11.4ms | ActiveRecord: 0.3ms)
4436
+  (0.1ms) rollback transaction
4437
+  (0.1ms) begin transaction
4438
+
4439
+
4440
+ Started GET "/custom" for 127.0.0.1 at 2012-11-06 10:06:38 -0600
4441
+ Processing by HomeController#custom as HTML
4442
+ Rendered text template (0.0ms)
4443
+ Completed 200 OK in 1ms (Views: 0.6ms | ActiveRecord: 0.0ms)
4444
+  (0.1ms) rollback transaction
4445
+  (0.1ms) begin transaction
4446
+
4447
+
4448
+ Started GET "/custom" for 127.0.0.1 at 2012-11-06 10:06:38 -0600
4449
+ Processing by HomeController#custom as HTML
4450
+ Rendered text template (0.0ms)
4451
+ Completed 200 OK in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
4452
+  (0.1ms) rollback transaction
4453
+  (0.1ms) begin transaction
4454
+  (0.1ms) rollback transaction
4455
+  (0.1ms) begin transaction
4456
+  (0.1ms) rollback transaction
4457
+  (0.0ms) begin transaction
4458
+  (0.1ms) rollback transaction
4459
+  (0.1ms) begin transaction
4460
+  (0.1ms) rollback transaction
4461
+  (0.0ms) begin transaction
4462
+  (0.1ms) rollback transaction
4463
+  (0.1ms) begin transaction
4464
+  (0.1ms) rollback transaction
4465
+  (0.1ms) begin transaction
4466
+  (0.1ms) rollback transaction
4467
+  (0.0ms) begin transaction
4468
+  (0.0ms) rollback transaction
4469
+  (0.0ms) begin transaction
4470
+  (0.0ms) rollback transaction
4471
+  (0.0ms) begin transaction
4472
+  (0.0ms) rollback transaction
4473
+  (0.0ms) begin transaction
4474
+  (0.0ms) rollback transaction
4475
+  (0.0ms) begin transaction
4476
+  (0.0ms) rollback transaction
4477
+  (0.0ms) begin transaction
4478
+  (0.0ms) rollback transaction
4479
+  (0.0ms) begin transaction
4480
+  (0.0ms) rollback transaction
4481
+  (0.1ms) begin transaction
4482
+  (0.0ms) SAVEPOINT active_record_1
4483
+ SQL (6.4ms) INSERT INTO "users" ("created_at", "email", "password", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Tue, 06 Nov 2012 16:06:39 UTC +00:00], ["email", "foo@foo.com"], ["password", "wow"], ["updated_at", Tue, 06 Nov 2012 16:06:39 UTC +00:00]]
4484
+  (0.1ms) RELEASE SAVEPOINT active_record_1
4485
+ Rendered user_mailer/welcome_email.text.erb (3.5ms)
4486
+
4487
+ Sent mail to foo@foo.com (50ms)
4488
+ Date: Tue, 06 Nov 2012 10:06:39 -0600
4489
+ From: from@librato-rails.com
4490
+ To: foo@foo.com
4491
+ Message-ID: <5099358fcf239_24063ff04d434cd4135@Arcas.local.mail>
4492
+ Subject: Why Howdy!
4493
+ Mime-Version: 1.0
4494
+ Content-Type: text/plain;
4495
+ charset=UTF-8
4496
+ Content-Transfer-Encoding: 7bit
4497
+
4498
+ This is a sample email, yay!
4499
+  (0.4ms) rollback transaction
4500
+  (0.1ms) begin transaction
4501
+
4502
+
4503
+ Started GET "/" for 127.0.0.1 at 2012-11-06 10:06:39 -0600
4504
+ Processing by HomeController#index as HTML
4505
+ Rendered home/index.html.erb within layouts/application (0.3ms)
4506
+ Completed 200 OK in 3ms (Views: 2.7ms | ActiveRecord: 0.0ms)
4507
+
4508
+
4509
+ Started GET "/status/204" for 127.0.0.1 at 2012-11-06 10:06:39 -0600
4510
+ Processing by StatusController#index as HTML
4511
+ Parameters: {"code"=>"204"}
4512
+ Rendered text template (0.0ms)
4513
+ Completed 204 No Content in 2ms (Views: 1.3ms | ActiveRecord: 0.0ms)
4514
+  (0.1ms) rollback transaction
4515
+  (0.0ms) begin transaction
4516
+
4517
+
4518
+ Started GET "/" for 127.0.0.1 at 2012-11-06 10:06:39 -0600
4519
+ Processing by HomeController#index as HTML
4520
+ Rendered home/index.html.erb within layouts/application (0.1ms)
4521
+ Completed 200 OK in 2ms (Views: 1.9ms | ActiveRecord: 0.0ms)
4522
+  (0.1ms) rollback transaction
4523
+  (0.0ms) begin transaction
4524
+
4525
+
4526
+ Started GET "/exception" for 127.0.0.1 at 2012-11-06 10:06:39 -0600
4527
+ Processing by HomeController#boom as HTML
4528
+ Completed 500 Internal Server Error in 1ms
4529
+  (0.1ms) rollback transaction
4530
+  (0.1ms) begin transaction
4531
+
4532
+
4533
+ Started GET "/slow" for 127.0.0.1 at 2012-11-06 10:06:39 -0600
4534
+ Processing by HomeController#slow as HTML
4535
+ Rendered text template (0.0ms)
4536
+ Completed 200 OK in 302ms (Views: 0.6ms | ActiveRecord: 0.0ms)
4537
+  (0.1ms) rollback transaction
4538
+  (0.1ms) begin transaction
4539
+  (0.1ms) SAVEPOINT active_record_1
4540
+ SQL (0.7ms) INSERT INTO "users" ("created_at", "email", "password", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Tue, 06 Nov 2012 16:06:40 UTC +00:00], ["email", "foo@foo.com"], ["password", "wow"], ["updated_at", Tue, 06 Nov 2012 16:06:40 UTC +00:00]]
4541
+  (0.1ms) RELEASE SAVEPOINT active_record_1
4542
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'foo@foo.com' LIMIT 1
4543
+  (0.1ms) SAVEPOINT active_record_1
4544
+  (0.4ms) UPDATE "users" SET "password" = 'new password', "updated_at" = '2012-11-06 16:06:40.219985' WHERE "users"."id" = 1
4545
+  (0.0ms) RELEASE SAVEPOINT active_record_1
4546
+  (0.0ms) SAVEPOINT active_record_1
4547
+ SQL (0.2ms) DELETE FROM "users" WHERE "users"."id" = ? [["id", 1]]
4548
+  (0.0ms) RELEASE SAVEPOINT active_record_1
4549
+  (0.4ms) rollback transaction
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librato-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-05 00:00:00.000000000 Z
12
+ date: 2012-11-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: 0.7.3
37
+ version: 0.7.4
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: 0.7.3
45
+ version: 0.7.4
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: sqlite3
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -197,7 +197,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
197
197
  version: '0'
198
198
  segments:
199
199
  - 0
200
- hash: -3761291658502898318
200
+ hash: 3855473348708511701
201
201
  required_rubygems_version: !ruby/object:Gem::Requirement
202
202
  none: false
203
203
  requirements:
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  version: '0'
207
207
  segments:
208
208
  - 0
209
- hash: -3761291658502898318
209
+ hash: 3855473348708511701
210
210
  requirements: []
211
211
  rubyforge_project:
212
212
  rubygems_version: 1.8.24