airbrake 8.3.1 → 8.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -5235,3 +5235,70 @@ F, [2019-03-04T11:51:38.615804 #68997] FATAL -- :
5235
5235
  F, [2019-03-04T11:51:38.615841 #68997] FATAL -- : lib/airbrake/rails/active_record.rb:25:in `run_callbacks'
5236
5236
  lib/airbrake/rack/middleware.rb:33:in `call!'
5237
5237
  lib/airbrake/rack/middleware.rb:21:in `call'
5238
+ D, [2019-03-12T19:42:38.960392 #88782] DEBUG -- :  (1.2ms) SELECT sqlite_version(*)
5239
+ D, [2019-03-12T19:42:38.961228 #88782] DEBUG -- :  (0.3ms) CREATE TABLE "books" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar)
5240
+ D, [2019-03-12T19:42:38.964471 #88782] DEBUG -- :  (0.1ms) DROP TABLE IF EXISTS "delayed_jobs"
5241
+ D, [2019-03-12T19:42:38.965019 #88782] DEBUG -- :  (0.1ms) CREATE TABLE "delayed_jobs" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "priority" integer DEFAULT 0 NOT NULL, "attempts" integer DEFAULT 0 NOT NULL, "handler" text NOT NULL, "last_error" text, "run_at" datetime, "locked_at" datetime, "failed_at" datetime, "locked_by" varchar, "queue" varchar, "created_at" datetime, "updated_at" datetime)
5242
+ D, [2019-03-12T19:42:38.965503 #88782] DEBUG -- :  (0.1ms) CREATE INDEX "delayed_jobs_priority" ON "delayed_jobs" ("priority", "run_at")
5243
+ D, [2019-03-12T19:42:38.967065 #88782] DEBUG -- :  (0.1ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
5244
+ D, [2019-03-12T19:42:38.978927 #88782] DEBUG -- : ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
5245
+ D, [2019-03-12T19:42:38.982180 #88782] DEBUG -- :  (0.0ms) begin transaction
5246
+ D, [2019-03-12T19:42:38.983081 #88782] DEBUG -- : ActiveRecord::InternalMetadata Create (0.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2019-03-12 17:42:38.982510"], ["updated_at", "2019-03-12 17:42:38.982510"]]
5247
+ D, [2019-03-12T19:42:38.983263 #88782] DEBUG -- :  (0.0ms) commit transaction
5248
+ I, [2019-03-12T19:42:39.024681 #88782] INFO -- : Started GET "/breakdown" for 127.0.0.1 at 2019-03-12 19:42:39 +0200
5249
+ I, [2019-03-12T19:42:39.026626 #88782] INFO -- : Processing by DummyController#breakdown as HTML
5250
+ D, [2019-03-12T19:42:39.033707 #88782] DEBUG -- :  (0.1ms) begin transaction
5251
+ D, [2019-03-12T19:42:39.035674 #88782] DEBUG -- : Book Create (0.2ms) INSERT INTO "books" ("title") VALUES (?) [["title", "breakdown"]]
5252
+ D, [2019-03-12T19:42:39.037407 #88782] DEBUG -- :  (0.1ms) commit transaction
5253
+ I, [2019-03-12T19:42:39.039134 #88782] INFO -- : Completed 500 Internal Server Error in 12ms (ActiveRecord: 0.7ms)
5254
+ F, [2019-03-12T19:42:42.169356 #88782] FATAL -- :
5255
+ F, [2019-03-12T19:42:42.169479 #88782] FATAL -- : RSpec::Mocks::MockExpectationError (Airbrake received :notify_performance_breakdown with unexpected arguments
5256
+ expected: (hash_including(:route=>"/breakdown(.:format)", :method=>"GET", :response_type=>:html, :groups=>{:db=>...chers::BuiltIn::BeAnInstanceOf:0x00007fb3b5f1d158 @expected=Float, @matcher_name=:an_instance_of>>}))
5257
+ got: ({:groups=>{:db=>0.6869998760521412}, :method=>"GET", :response_type=>:html, :route=>"/breakdown(.:format)", :start_time=>2019-03-12 19:42:39.026763000 +0200})
5258
+ Diff:
5259
+ @@ -1,2 +1,6 @@
5260
+ -["hash_including(:route=>\"/breakdown(.:format)\", :method=>\"GET\", :response_type=>:html, :groups=>{:db=>#<RSpec::Matchers::AliasedMatcher:0x00007fb3b5f1d1d0 @description_block=#<Proc:0x00007fb3b7a2ea00@/Users/kyrylo/.gem/ruby/2.4.2/gems/rspec-expectations-3.8.2/lib/rspec/matchers/dsl.rb:31 (lambda)>, @base_matcher=#<RSpec::Matchers::BuiltIn::BeAnInstanceOf:0x00007fb3b5f1d1f8 @expected=Float, @matcher_name=:an_instance_of>>, :view=>#<RSpec::Matchers::AliasedMatcher:0x00007fb3b5f1d130 @description_block=#<Proc:0x00007fb3b7a2ea00@/Users/kyrylo/.gem/ruby/2.4.2/gems/rspec-expectations-3.8.2/lib/rspec/matchers/dsl.rb:31 (lambda)>, @base_matcher=#<RSpec::Matchers::BuiltIn::BeAnInstanceOf:0x00007fb3b5f1d158 @expected=Float, @matcher_name=:an_instance_of>>})"]
5261
+ +[{:groups=>{:db=>0.6869998760521412},
5262
+ + :method=>"GET",
5263
+ + :response_type=>:html,
5264
+ + :route=>"/breakdown(.:format)",
5265
+ + :start_time=>2019-03-12 19:42:39.026763000 +0200}]
5266
+ ):
5267
+ F, [2019-03-12T19:42:42.169506 #88782] FATAL -- :
5268
+ F, [2019-03-12T19:42:42.169532 #88782] FATAL -- : lib/airbrake/rails/action_controller_performance_breakdown_subscriber.rb:15:in `block in call'
5269
+ lib/airbrake/rails/action_controller_performance_breakdown_subscriber.rb:12:in `each'
5270
+ lib/airbrake/rails/action_controller_performance_breakdown_subscriber.rb:12:in `call'
5271
+ lib/airbrake/rack/middleware.rb:33:in `call!'
5272
+ lib/airbrake/rack/middleware.rb:21:in `call'
5273
+ D, [2019-03-12T19:42:59.909131 #88797] DEBUG -- :  (0.8ms) SELECT sqlite_version(*)
5274
+ D, [2019-03-12T19:42:59.909524 #88797] DEBUG -- :  (0.3ms) CREATE TABLE "books" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar)
5275
+ D, [2019-03-12T19:42:59.912071 #88797] DEBUG -- :  (0.0ms) DROP TABLE IF EXISTS "delayed_jobs"
5276
+ D, [2019-03-12T19:42:59.912581 #88797] DEBUG -- :  (0.1ms) CREATE TABLE "delayed_jobs" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "priority" integer DEFAULT 0 NOT NULL, "attempts" integer DEFAULT 0 NOT NULL, "handler" text NOT NULL, "last_error" text, "run_at" datetime, "locked_at" datetime, "failed_at" datetime, "locked_by" varchar, "queue" varchar, "created_at" datetime, "updated_at" datetime)
5277
+ D, [2019-03-12T19:42:59.913133 #88797] DEBUG -- :  (0.1ms) CREATE INDEX "delayed_jobs_priority" ON "delayed_jobs" ("priority", "run_at")
5278
+ D, [2019-03-12T19:42:59.914464 #88797] DEBUG -- :  (0.1ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
5279
+ D, [2019-03-12T19:42:59.923832 #88797] DEBUG -- : ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
5280
+ D, [2019-03-12T19:42:59.926882 #88797] DEBUG -- :  (0.0ms) begin transaction
5281
+ D, [2019-03-12T19:42:59.927728 #88797] DEBUG -- : ActiveRecord::InternalMetadata Create (0.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2019-03-12 17:42:59.927165"], ["updated_at", "2019-03-12 17:42:59.927165"]]
5282
+ D, [2019-03-12T19:42:59.927934 #88797] DEBUG -- :  (0.0ms) commit transaction
5283
+ D, [2019-03-12T19:43:20.290859 #88811] DEBUG -- :  (0.9ms) SELECT sqlite_version(*)
5284
+ D, [2019-03-12T19:43:20.291315 #88811] DEBUG -- :  (0.3ms) CREATE TABLE "books" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar)
5285
+ D, [2019-03-12T19:43:20.293885 #88811] DEBUG -- :  (0.1ms) DROP TABLE IF EXISTS "delayed_jobs"
5286
+ D, [2019-03-12T19:43:20.294437 #88811] DEBUG -- :  (0.1ms) CREATE TABLE "delayed_jobs" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "priority" integer DEFAULT 0 NOT NULL, "attempts" integer DEFAULT 0 NOT NULL, "handler" text NOT NULL, "last_error" text, "run_at" datetime, "locked_at" datetime, "failed_at" datetime, "locked_by" varchar, "queue" varchar, "created_at" datetime, "updated_at" datetime)
5287
+ D, [2019-03-12T19:43:20.294918 #88811] DEBUG -- :  (0.1ms) CREATE INDEX "delayed_jobs_priority" ON "delayed_jobs" ("priority", "run_at")
5288
+ D, [2019-03-12T19:43:20.296287 #88811] DEBUG -- :  (0.1ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
5289
+ D, [2019-03-12T19:43:20.306138 #88811] DEBUG -- : ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
5290
+ D, [2019-03-12T19:43:20.309355 #88811] DEBUG -- :  (0.0ms) begin transaction
5291
+ D, [2019-03-12T19:43:20.310168 #88811] DEBUG -- : ActiveRecord::InternalMetadata Create (0.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2019-03-12 17:43:20.309653"], ["updated_at", "2019-03-12 17:43:20.309653"]]
5292
+ D, [2019-03-12T19:43:20.310345 #88811] DEBUG -- :  (0.0ms) commit transaction
5293
+ I, [2019-03-12T19:43:20.349159 #88811] INFO -- : Started GET "/breakdown" for 127.0.0.1 at 2019-03-12 19:43:20 +0200
5294
+ I, [2019-03-12T19:43:20.351473 #88811] INFO -- : Processing by DummyController#breakdown as HTML
5295
+ D, [2019-03-12T19:43:20.359979 #88811] DEBUG -- :  (0.1ms) begin transaction
5296
+ D, [2019-03-12T19:43:20.361506 #88811] DEBUG -- : Book Create (0.1ms) INSERT INTO "books" ("title") VALUES (?) [["title", "breakdown"]]
5297
+ D, [2019-03-12T19:43:20.362713 #88811] DEBUG -- :  (0.0ms) commit transaction
5298
+ I, [2019-03-12T19:43:20.364005 #88811] INFO -- : Completed 500 Internal Server Error in 12ms (ActiveRecord: 0.8ms)
5299
+ F, [2019-03-12T19:43:21.585482 #88811] FATAL -- :
5300
+ F, [2019-03-12T19:43:21.585588 #88811] FATAL -- : AirbrakeTestError (after_commit):
5301
+ F, [2019-03-12T19:43:21.585619 #88811] FATAL -- :
5302
+ F, [2019-03-12T19:43:21.585656 #88811] FATAL -- : lib/airbrake/rails/active_record.rb:25:in `run_callbacks'
5303
+ lib/airbrake/rack/middleware.rb:33:in `call!'
5304
+ lib/airbrake/rack/middleware.rb:21:in `call'
@@ -296,17 +296,14 @@ RSpec.describe "Rails integration specs" do
296
296
  it "sends performance breakdown info to Airbrake" do
297
297
  expect(Airbrake).to receive(:notify_performance_breakdown).with(
298
298
  hash_including(
299
- route: '/crash(.:format)',
299
+ route: '/breakdown(.:format)',
300
300
  method: 'GET',
301
301
  response_type: :html,
302
- groups: {
303
- db: anything,
304
- view: anything
305
- }
302
+ groups: hash_including(db: an_instance_of(Float))
306
303
  )
307
304
  ).at_least(:once)
308
305
 
309
- get '/crash'
306
+ get '/breakdown'
310
307
  end
311
308
  end
312
309
  end
@@ -1,7 +1,7 @@
1
1
  require 'airbrake/rails/action_controller_performance_breakdown_subscriber'
2
2
 
3
3
  RSpec.describe Airbrake::Rails::ActionControllerPerformanceBreakdownSubscriber do
4
- after { Airbrake::Rack::RequestStore[:routes] = nil }
4
+ after { Airbrake::Rack::RequestStore.clear }
5
5
 
6
6
  context "when routes are not set in the request store" do
7
7
  before { Airbrake::Rack::RequestStore[:routes] = nil }
@@ -26,8 +26,8 @@ RSpec.describe Airbrake::Rails::ActionControllerPerformanceBreakdownSubscriber d
26
26
  OpenStruct.new(
27
27
  payload: {
28
28
  format: :html,
29
- view_runtime: 1.0,
30
- db_runtime: 1.0
29
+ view_runtime: 0.5,
30
+ db_runtime: 0.5
31
31
  }
32
32
  )
33
33
  end
@@ -46,7 +46,7 @@ RSpec.describe Airbrake::Rails::ActionControllerPerformanceBreakdownSubscriber d
46
46
  route: '/test-route',
47
47
  method: 'GET',
48
48
  response_type: :html,
49
- groups: { db: 1.0, view: 1.0 }
49
+ groups: { db: 0.5, view: 0.5 }
50
50
  )
51
51
  )
52
52
  subject.call([])
@@ -55,13 +55,13 @@ RSpec.describe Airbrake::Rails::ActionControllerPerformanceBreakdownSubscriber d
55
55
  context "and when view_runtime is nil" do
56
56
  before { event.payload[:view_runtime] = nil }
57
57
 
58
- it "sets the view group runtime to 0" do
58
+ it "omits view_runtime" do
59
59
  expect(Airbrake).to receive(:notify_performance_breakdown).with(
60
60
  hash_including(
61
61
  route: '/test-route',
62
62
  method: 'GET',
63
63
  response_type: :html,
64
- groups: { db: 1.0, view: 0 }
64
+ groups: { db: 0.5 }
65
65
  )
66
66
  )
67
67
  subject.call([])
@@ -71,17 +71,61 @@ RSpec.describe Airbrake::Rails::ActionControllerPerformanceBreakdownSubscriber d
71
71
  context "and when db_runtime is nil" do
72
72
  before { event.payload[:db_runtime] = nil }
73
73
 
74
- it "sets the view group runtime to 0" do
74
+ it "omits db_runtime" do
75
75
  expect(Airbrake).to receive(:notify_performance_breakdown).with(
76
76
  hash_including(
77
77
  route: '/test-route',
78
78
  method: 'GET',
79
79
  response_type: :html,
80
- groups: { db: 0, view: 1.0 }
80
+ groups: { view: 0.5 }
81
81
  )
82
82
  )
83
83
  subject.call([])
84
84
  end
85
85
  end
86
+
87
+ context "when db_runtime is zero" do
88
+ before { event.payload[:db_runtime] = 0 }
89
+
90
+ it "omits db_runtime" do
91
+ expect(Airbrake).to receive(:notify_performance_breakdown).with(
92
+ hash_including(
93
+ route: '/test-route',
94
+ method: 'GET',
95
+ response_type: :html,
96
+ groups: { view: 0.5 }
97
+ )
98
+ )
99
+ subject.call([])
100
+ end
101
+ end
102
+
103
+ context "when view_runtime is zero" do
104
+ before { event.payload[:view_runtime] = 0 }
105
+
106
+ it "omits view_runtime" do
107
+ expect(Airbrake).to receive(:notify_performance_breakdown).with(
108
+ hash_including(
109
+ route: '/test-route',
110
+ method: 'GET',
111
+ response_type: :html,
112
+ groups: { db: 0.5 }
113
+ )
114
+ )
115
+ subject.call([])
116
+ end
117
+ end
118
+
119
+ context "when db_runtime and view_runtime are both zero" do
120
+ before do
121
+ event.payload[:db_runtime] = 0
122
+ event.payload[:view_runtime] = 0
123
+ end
124
+
125
+ it "doesn't notify Airbrake" do
126
+ expect(Airbrake).not_to receive(:notify_performance_breakdown)
127
+ subject.call([])
128
+ end
129
+ end
86
130
  end
87
131
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.3.1
4
+ version: 8.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airbrake Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-11 00:00:00.000000000 Z
11
+ date: 2019-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: airbrake-ruby